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

Enable flake8 checks #1127

Merged
merged 8 commits into from
May 1, 2021
Merged

Conversation

aksalcido
Copy link
Contributor

@aksalcido aksalcido commented Apr 30, 2021

Removed majority of the flake8 checks listed in #1116 under # TODO. Also edited the corresponding files that were throwing the flake8 checks once they were no longer being ignored. The only error code that was not handled completely was F541, only some of the F541 errors were handled, but not all. The remaining errors for F541 is for strings that begin with fr"string". Was a bit confused on if this was an intentional design so I wanted clarification before I handled them. I wanted feedback on if this seems good since this is my first contribution to Open Source and feel a bit anxious on if I was working on it incorrectly on my end.

  • I have added a changelog entry for this pull request.
  • If adding new functionality, I have added tests and
    docstrings.
  • I have fixed any newly failing tests.

@github-actions github-actions bot added plasmapy.diagnostics Related to the plasmapy.diagnostics subpackage docs PlasmaPy Docs at http://docs.plasmapy.org plasmapy.formulary Related to the plasmapy.formulary subpackage plasmapy.particles Related to the plasmapy.particles subpackage plasmapy.plasma Related to the plasmapy.plasma subpackage plasmapy.utils Related to the plasmapy.utils subpackage labels Apr 30, 2021
@StanczakDominik
Copy link
Member

Hey, I'll look through this within a few hours :)

@StanczakDominik StanczakDominik self-requested a review April 30, 2021 13:22
Copy link
Member

@StanczakDominik StanczakDominik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, first up, once again - thanks for tackling this! :)

A few notes:

  • This got me to realize we have a collective habit of using f-strings everywhere... The code is, of course simpler without them, but I wouldn't mind disabling the check and letting people use them "as defaults" in the future (keeping the removals in this PR as is, of course). I'm not sure which way is better, though, so - this is not a strong opinion.
  • A few cases where variable == False was replaced with not variable, which would make sense in general but doesn't work with numpy arrays in particular. I've made suggestions wherever that happened to replace those. (EDIT: I think I missed a case with the suggestions, but if you apply the one suggestion I made, failing tests should tell us if there's actually any missing case).
  • There are a bunch of errors still being raised in https://github.com/PlasmaPy/PlasmaPy/pull/1127/checks?check_run_id=2475959193#step:6:2581. I notice:
    • The RST210 errors are being found by the flake8-rst-docstrings plugin (installed in the tests https://github.com/StanczakDominik/PlasmaPy/blob/83e6337031d88380bda740e1ec2f9e71951d9fc6/.github/workflows/linters.yml#L16 ), which I didn't ask you to install through email, as I didn't think you'd be doing them all in one go! So, you've already gone the extra mile here; but we can revert the removals of those exclusions from setup.cfg if you'd prefer to keep this PR shorter. We can always tackle those in the future.
    • A couple of missed f-strings (F541)?
    • and a few W605, which I honestly don't understand why it's being raised and I'm absolutely down to keep excluding them unless we gain that understanding somehow! :)

All in all, great first PR, and I'm happy to merge it with minor revisions! ;)

plasmapy/plasma/grids.py Outdated Show resolved Hide resolved
plasmapy/utils/decorators/validators.py Show resolved Hide resolved
plasmapy/formulary/__init__.py Outdated Show resolved Hide resolved
plasmapy/particles/particle_collections.py Outdated Show resolved Hide resolved
@github-actions github-actions bot removed the plasmapy.formulary Related to the plasmapy.formulary subpackage label May 1, 2021
@aksalcido aksalcido marked this pull request as ready for review May 1, 2021 02:13
Copy link
Member

@StanczakDominik StanczakDominik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, let's get it in! :)

@StanczakDominik StanczakDominik enabled auto-merge (squash) May 1, 2021 02:46
@StanczakDominik
Copy link
Member

I'm in the phone ATM and it looks like the github app is having some issues right now. I suppose this isn't merging because of merge conflicts? If so I'll clean those up later today.

@codecov
Copy link

codecov bot commented May 1, 2021

Codecov Report

Merging #1127 (47eb608) into master (429700e) will not change coverage.
The diff coverage is 96.55%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1127   +/-   ##
=======================================
  Coverage   96.91%   96.91%           
=======================================
  Files          70       70           
  Lines        6930     6930           
=======================================
  Hits         6716     6716           
  Misses        214      214           
Impacted Files Coverage Δ
plasmapy/particles/decorators.py 100.00% <ø> (ø)
plasmapy/particles/ionization_state_collection.py 91.05% <ø> (ø)
plasmapy/particles/particle_class.py 98.74% <ø> (ø)
plasmapy/particles/serialization.py 100.00% <ø> (ø)
plasmapy/utils/pytest_helpers/pytest_helpers.py 91.46% <50.00%> (ø)
plasmapy/analysis/fit_functions.py 97.82% <100.00%> (ø)
plasmapy/analysis/swept_langmuir/helpers.py 100.00% <100.00%> (ø)
plasmapy/diagnostics/langmuir.py 93.75% <100.00%> (ø)
plasmapy/dispersion/two_fluid_dispersion.py 100.00% <100.00%> (ø)
plasmapy/particles/atomic.py 100.00% <100.00%> (ø)
... and 6 more

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 429700e...47eb608. Read the comment docs.

@StanczakDominik
Copy link
Member

Oooooh. So because of https://github.blog/2021-04-22-github-actions-update-helping-maintainers-combat-bad-actors/ we now have to have approve every single workflow run on a first contributor's PR, rather than approving it on a per-PR basis. That's... just silly, honestly.

@StanczakDominik StanczakDominik merged commit 22985a4 into PlasmaPy:master May 1, 2021
@StanczakDominik
Copy link
Member

I also untagged Erik and Nick because that's just CODEOWNERS being overzealous, here.

@StanczakDominik
Copy link
Member

Haha, whoops. My previous failing auto-merge triggered despite flake8 failing. My bad!

I was already going to do some minor fixes to the CI setup, so I'll fix the two remaining RST errors while I'm at it today.

Thanks, @aksalcido! :)

StanczakDominik added a commit to StanczakDominik/PlasmaPy that referenced this pull request May 1, 2021
this follows up on PlasmaPy#1127,
where I had an automerge mishap and merged the PR before flake8
started passing (it's not set to "required" right now).
StanczakDominik added a commit that referenced this pull request May 1, 2021
* Add "linters" env to tox

This is supposed to incorporate our configuration from
.github/workflows/linters.yml, so that it can be easily
run locally.

* Add linters env to testing

* Remove separate linters workflow

* Restore RST213, RST306 exclusions in setup.cfg

this follows up on #1127,
where I had an automerge mishap and merged the PR before flake8
started passing (it's not set to "required" right now).

* Change tox path separators to OS-agnostic {/}
@namurphy namurphy added the linters Code linters and autoformatters label May 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs PlasmaPy Docs at http://docs.plasmapy.org linters Code linters and autoformatters plasmapy.diagnostics Related to the plasmapy.diagnostics subpackage plasmapy.particles Related to the plasmapy.particles subpackage plasmapy.plasma Related to the plasmapy.plasma subpackage plasmapy.utils Related to the plasmapy.utils subpackage
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants