ament / ament_lint

Apache License 2.0
38 stars 107 forks source link

ament_pep257 crashes during xunit generation when non-pep257 errors occur #442

Closed rjb0026 closed 1 year ago

rjb0026 commented 1 year ago

If ament_pep257 encounters an error that is not a pydocstyle.violations.Error type, the program will crash during the xunit file generation step because it expects a numeric line number to be given for each error and that field returns a '-' string in the failing case. One easy way I found to reproduce this is to run the tool on some python2 syntax that is invalid in python3:

test.py

def class Hello(object):
    def __init__(self):
        print('hello world!')

def main():
    hey = Hello()

if __name__ == '__main__':
    main()

Then run: ament_pep257 --xunit-file test-xunit test.py

Should complain about a print string formatting and not fully generate the xml file output.

OS: Ubuntu 22.04 Distro: Humble