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

[WIP] init commit for flakehell and black checks in the project #1088

Closed
wants to merge 14 commits into from

Conversation

devProdigy
Copy link
Contributor

@devProdigy devProdigy commented Dec 1, 2020

Test adding flakehell code checker and black formatter to the project and CI.
Check should be made only for the new changes brought in the PRs, old code will be "unified" with time.
Styles and best practices to be checked/allowed/forbidden by checker - TBD. Feel free to contribute :)

@flikka
Copy link
Contributor

flikka commented Dec 2, 2020

Isn't black already invoked with the test https://github.com/equinor/gordo/blob/master/tests/test_formatting.py?

@devProdigy
Copy link
Contributor Author

devProdigy commented Dec 2, 2020

Isn't black already invoked with the test https://github.com/equinor/gordo/blob/master/tests/test_formatting.py?

hm, seems like it's, but in a little bit weird way (through tests). And I can't see usual configs for black.
Maybe it' better to check for formatting and code-quality before running tests - cause tests running is time consuming and usually it's better to know that you misses smth as early as you can.
Maybe it's a good idea additionally to have pre-commit hooks for such tasks?

So we'll have (before local push and on the CI):

  • flake checks of code quality;
  • black formatting checks.

@flikka What do you think?

Update:
Run Black on the project when it was really turned on and got lots of error (you can see it in the CI job for this PR).
Added just one param to pyproject.toml file:

[tool.black]  
line-length = 120

Or maybe I missed smth?

@devProdigy devProdigy force-pushed the custom/bring-flakehell-and-black-checks branch from 8a68e00 to dbb750e Compare December 2, 2020 18:42
@devProdigy devProdigy force-pushed the custom/bring-flakehell-and-black-checks branch from 6092ff7 to 98835e0 Compare December 2, 2020 22:58
@flikka
Copy link
Contributor

flikka commented Dec 3, 2020

hm, seems like it's, but in a little bit weird way (through tests). And I can't see usual configs for black.

The configs were kept default (therefore no configs) intentionally, to make it as "standard" as possible (according to Black).

Maybe it's a good idea additionally to have pre-commit hooks for such tasks?

Agreed, many commits in Gordo's PR's are "fix formatting, or fix black", so I totally agree! One can also make it integrated in your own dev environment, for example in PyCharm with auto-black on save or similar.

Run Black on the project when it was really turned on and got lots of error (you can see it in the CI job for this PR).

If you see the CI for other PRs, or main, you can see that black is run, with no errors. The reason you get errors now is precisely because you also change the black config by setting the line-length = 120 parameter, thus changing black's line length from 88 to 120. This will then cause a lot of changes, naturally causing black to fail. As it should. If you want to introduce this (should be discussed among the Gordo developers, it is quite a massive change, and some people have strong feelings about this) - you should create a PR that only does that, and tell others that you are doing it. It wil change almost all of the files in the repo, so merging other ongoing PRs can be hellish.

Keep up the good work 👍

@codecov
Copy link

codecov bot commented Dec 9, 2020

Codecov Report

Merging #1088 (161916c) into master (344ac4b) will increase coverage by 0.03%.
The diff coverage is 97.14%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1088      +/-   ##
==========================================
+ Coverage   94.66%   94.70%   +0.03%     
==========================================
  Files          61       61              
  Lines        2908     2928      +20     
==========================================
+ Hits         2753     2773      +20     
  Misses        155      155              
Impacted Files Coverage Δ
gordo/cli/custom_types.py 89.47% <0.00%> (ø)
gordo/machine/model/anomaly/diff.py 97.42% <ø> (ø)
gordo/server/server.py 88.67% <ø> (ø)
gordo/builder/build_model.py 98.39% <100.00%> (ø)
gordo/cli/cli.py 96.26% <100.00%> (ø)
gordo/cli/client.py 97.80% <100.00%> (ø)
gordo/cli/workflow_generator.py 92.81% <100.00%> (+0.24%) ⬆️
gordo/machine/validators.py 86.88% <100.00%> (ø)
gordo/reporters/mlflow.py 97.85% <100.00%> (ø)
...ordo/workflow/config_elements/normalized_config.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 344ac4b...161916c. Read the comment docs.

@devProdigy devProdigy force-pushed the custom/bring-flakehell-and-black-checks branch from 2e1bee2 to 161916c Compare December 9, 2020 15:36
@devProdigy
Copy link
Contributor Author

Closing this PR due to some issues.
New PR is here

@devProdigy devProdigy closed this Dec 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants