Page MenuHomeVyOS Platform

Add Jinja2 linter to vyos-1x build process
Closed, ResolvedPublicFEATURE REQUEST

Description

(21:03) cpo lnx01:~/vyos-1x [j2lint] # j2lint data/templates/frr/rpki.frr.tmpl.j2
Jinja2 linting issues found
************ File data/templates/frr/rpki.frr.tmpl.j2
data/templates/frr/rpki.frr.tmpl.j2:5 Bad Indentation, expected 5, got 3 (jinja-statements-indentation)
data/templates/frr/rpki.frr.tmpl.j2:7 Bad Indentation, expected 9, got 5 (jinja-statements-indentation)
data/templates/frr/rpki.frr.tmpl.j2:9 Bad Indentation, expected 9, got 5 (jinja-statements-indentation)
data/templates/frr/rpki.frr.tmpl.j2:11 Bad Indentation, expected 9, got 5 (jinja-statements-indentation)
data/templates/frr/rpki.frr.tmpl.j2:12 Bad Indentation, expected 5, got 3 (jinja-statements-indentation)
(21:03) cpo lnx01:~/vyos-1x [j2lint] # vim data/templates/frr/rpki.frr.tmpl.j2
(21:03) cpo lnx01:~/vyos-1x [j2lint] # j2lint data/templates/frr/rpki.frr.tmpl.j2
Linting complete. No problems found.

Every Jinja2 template that should be linted requires to use .j2 file extension over .tmpl (which we currently use) - also indention is 4 spaces (like most of the world is doing - we have 2. Given the fact that our Python code uses indent=4 I am +1 on applying this on the Jinja templates, too

Then every inbound PR can get a linting check for free.

Linter: https://github.com/aristanetworks/j2lint/tree/341b5d5db86e095b622f09770cb6367a1583620e

Details

Difficulty level
Hard (possibly days)
Version
-
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Stricter validation
Issue type
Internal change (not visible to end users)

Event Timeline

c-po changed the task status from Open to In progress.Apr 11 2022, 7:04 PM
c-po claimed this task.
c-po triaged this task as Wishlist priority.
c-po created this task.
c-po changed Difficulty level from Unknown (require assessment) to Hard (possibly days).
c-po updated the task description. (Show Details)
c-po updated the task description. (Show Details)