Page MenuHomeVyOS Platform

equuleus: Testing: vyos-1x: syntax checking Python scripts in PR
Closed, ResolvedPublic

Description

In the past there have been quite a few tickets regarding python syntax errors on scripts rewritten to python.
To make a quickfix on some of these faults we could make a Jenkins step that executes: python3 -m compileall -q . to do a offline compile of the python files.

as for writing this tasks we have these faults in the repository:

*** Error compiling './src/conf_mode/interfaces-openvpn.py'...
Sorry: IndentationError: unindent does not match any outer indentation level (interfaces-openvpn.py, line 635)
*** Error compiling './src/conf_mode/interfaces-pseudo-ethernet.py'...
  File "./src/conf_mode/interfaces-pseudo-ethernet.py", line 130
    or peth['ipv6_autoconf'] ) ):
                                ^
SyntaxError: invalid syntax

*** Error compiling './src/conf_mode/interfaces-vxlan.py'...
  File "./src/conf_mode/interfaces-vxlan.py", line 172
    return None
    ^
SyntaxError: invalid syntax

Details

Difficulty level
Unknown (require assessment)
Version
-
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Behavior change
Issue type
Internal change (not visible to end users)

Event Timeline

runar created this object in space S1 VyOS Public.

Wouldn't it be better to add it to the vyos-1x Makefile so we could test it ourselves, before committing, making a PR, it being merged, and only then figuring out it's a problem?

The fix for the error for openvpn is already waiting in PR since yesterday, fix for pseudo-ethernet and vxlan will be ready right now.

I would also suggest doing the same using github actions so that on push to your local repository to get a warning from github.

It seems that github has special rules for the .github file and that no PR can be done for it:
https://github.com/thomas-mangin/vyos-1x/blob/T2436/.github/workflows/pythonapp.yml

This does not compile python scripts without a .py extension (there are several in src/services, src/utils that have #!/usr/bin/env python3)

Many scripts also so do implement if name == โ€œmainโ€

dmbaturin added a project: VyOS 1.3 Equuleus.
dmbaturin changed Is it a breaking change? from Unspecified (possibly destroys the router) to Behavior change.
erkin renamed this task from equuleus: Testing: vyos-1x: syntax checking python scripts in PR to equuleus: Testing: vyos-1x: syntax checking Python scripts in PR.Aug 30 2021, 6:18 AM
erkin set Issue type to Internal change (not visible to end users).
erkin removed a subscriber: Active contributors.