Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
1 task done
eriksven opened this issue Sep 6, 2023 · 4 comments
Closed
1 task done

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

eriksven opened this issue Sep 6, 2023 · 4 comments
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@eriksven
Copy link

eriksven commented Sep 6, 2023

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

  • I agree to follow this project's "Code of Conduct".
@eriksven eriksven added the bug Something isn't working label Sep 6, 2023
@kse3hi
Copy link
Contributor

kse3hi commented Sep 7, 2023

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.

@kse3hi kse3hi moved this from 🆕 New to 📋 Backlog in Velocitas Backlog Sep 7, 2023
@kse3hi kse3hi added the good first issue Good for newcomers label Sep 7, 2023
@eriksven
Copy link
Author

eriksven commented Sep 7, 2023

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 MP91 mentioned this issue Jan 22, 2024
10 tasks
@MP91
Copy link
Contributor

MP91 commented Jan 22, 2024

done with #220

@MP91 MP91 closed this as completed Jan 22, 2024
@github-project-automation github-project-automation bot moved this from 📋 Backlog to ✅ Done in Velocitas Backlog Jan 22, 2024
@eriksven
Copy link
Author

Nice, thanks for the update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
Status: Done
Development

No branches or pull requests

3 participants