-
Notifications
You must be signed in to change notification settings - Fork 1
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
Imposing "correct" isort as requirement for a green pipeline #73
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code looks and behaves well but let's have a discussion about standardising items like
- line width
- import layout
- hard failure on static code analysis
if: ${{ failure() }} | ||
run: | | ||
echo "::notice::In project root run 'python.exe -m isort .' and commit changes to fix errors." | ||
exit 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is failure the right thing to do? Maybe stylistic issues should only be reported as warnings, like it is done with codecov
reports?
original flake8
line for ER has
--exit-zero
so errors are treated as warnings
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can do it differently. The reason why I decided to go for an exit 1 of the echo step is an attempt to make it more obvious that the user might want to consult the produced statement that contains a proposed fix to the issue.
The pipeline itself has already failed in the preceding step.
We should probably discuss.
[tool.hatch.build.targets.wheel] | ||
packages = ["EasyReflectometry"] | ||
[tool.isort] | ||
line_length = 88 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is probably too conservative. With hi res monitors, we tend to write long lines, especially for message formatting.
We specify 120 as the standard max length.
Any good reason to limit the width to 88 (apart from this being the standard in black
?)
Likewise, the original flake8
line for this project lists
--max-line-length=127
which, while being inconsistent with the EasyScience standard ( 😅 ) is less restrictive than 88
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was just a value that frequently showed up.
Monkey see, monkey do ;)
The CI pipeline will now fail if python imports are done "wrongly" according to isort.
The requirements for the
isort
sorting are defined inpyproject.toml
It is also possible to get the requirements applied on file save in VSCode by using the
settings.json
file invscode_template
.To help the user in case of a failing pipeline the following now step echo's a potential resolution to the error. This is not an optimal solution, but it is considered good enough for now.
Bumped: