===================================================================================
Today we first ran an analysis on Python code that is auto-formatted by Black (https://github.com/ambv/black). In a number of files, Sonarcloud throws a parse error: Unable to parse file: … Parse error at line # …
After looking into the code, we found the following issue with the parsing. If this example function
The parse error is causes by the , after the 8. Note that that , is not necessary (and other auto-formatters do not add it) but it is not wrong either; the code runs perfectly fine with or without that extra , and no linting warnings are generated in either case. So Sonarcloud throws an error on working, pep8-compliant code.
Hi Robin,
You are right, if code auto-formatted by Black produces a parse error when there’s variable number of arguments, we should fix this bug in the next version of SonarPython. I added a comment on SONARPY-290 to ensure this.
Thanks for the feedback,
Alban