eclipse-velocitas / vehicle-app-python-template

Vehicle App template for Python
Apache License 2.0
17 stars 25 forks source link

[Bug]: flake8 linter fails after reformation by black #193

Closed eriksven closed 8 months ago

eriksven commented 1 year ago

Severity

Medium

What release version, tag or commit-hash did you use?

v0.1.0 (current main)

Current Behavior

When running the pre-commit task, the black tool makes changes about which then the flake8 linter complains. This causes the CI workflow to break. Because of that the release workflow can not finish as well.

Steps to Reproduce

In the vehicle application you may have code snippet like. There might be better way to express this functionality but it helps to reproduce the bug.

logger.debug(
            "Seat Position Changed " + str(data.get(
                self.Vehicle.Cabin.Seat.Row1.Pos1.Position).value)
        )

When running the pre-commit task, black converts this to

logger.debug(
            "Seat Position Changed "
            + str(data.get(self.Vehicle.Cabin.Seat.Row1.Pos1.Position).value)

Afterwards, flake8 complained about W503 line break before binary operator in that line.

Expected Behavior

I would expect that black is not making modification which conflict with the configuration of flake8. Especially, as part of the CI workflow I would not expect that the pre-commit makes any changes to my code at all.

Possible Solution

Disable black for the CI workflow or reshape the configuration for black and flake8 so that they do not create conflicting behavior.

Additional Information

No response

Code of Conduct

kse3hi commented 1 year ago

Hello @eriksven , thank you for report. We will check rules and will align black and flake8 rules. As far as black is not a linter but formatter, it is expectation that pre-commit will fix all stlyling issues, but it is pity that both tools are not aligned.

eriksven commented 1 year ago

Sounds good, thank you. At least in the CI workflow I would even prefer to disable the black formatter. Because the formatting stays inside the workflow and is not committed back to the branch. So essentially, any following linter does not work on the code in the commit but a deviatinig version.

MP91 commented 8 months ago

done with #220

eriksven commented 8 months ago

Nice, thanks for the update.