Closed hello-amal closed 5 months ago
What are your thoughts on flake8 vs Black for linting Python code?
They are complementary. black
is a formatter, so it automatically formats the code (e.g., for readability and consistency). flake8
is a linter, so it points out potential style and syntax errors. There are some overlaps (like with line length), but generally both are useful. For example, a linter will point out things like a missing import, an unused import/variable, catching too broad of an exception, etc., which a formatter will not.
Gotcha, so this PR adds the linter and optional type checking (with Mypy), but not the formatter. Is that correct?
Yes. The previous PR (#42 ) added the formatter.
The reason I split it up this way is that the formatter is guaranteed to not change code functionality. Whereas when I implement linting fixes, it is possible to change code functionality. So I wanted them to be in two separate PRs, to be able to more easily test and compare the diff.
Great, that makes sense. Since you've confirmed that no functionality is broken from the changes in these large PRs, I've approved these two PRs (#42 and this one). Are you planning on merging them into mainline?
Yes I'll merge them. I'm just waiting on to test it on a Stretch 2 without a dex wrist, and will then merge them in.
Cool! I have one, so I can test this next week if you need it.
Merging without testing on the "Stretch RE2 + no dex wrist w/ beta teleop kit" configuration because:
Description
This PR, in partial service of #43 , builds off of #42 to add Python linting to the pre-commit hooks.
Testing procedure
Before opening a pull request
From the top-level of this repository, run:
pre-commit run --all-files
To merge
Squash & Merge