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

Add ruff linter #3299

Merged
merged 7 commits into from Jan 18, 2024
Merged

Add ruff linter #3299

merged 7 commits into from Jan 18, 2024

Conversation

ericpre
Copy link
Member

@ericpre ericpre commented Jan 14, 2024

Ruff can be used for linting and formatting. This PR update code to pass ruff check (https://docs.astral.sh/ruff/linter/) which does the same as flake8.

Progress of the PR

  • Use ruff for linting code,
  • [n/a] update docstring (if appropriate),
  • update contributor guide (if appropriate),
  • add an changelog entry in the upcoming_changes folder (see upcoming_changes/README.rst),
  • Check formatting changelog entry in the readthedocs doc build of this PR (link in github checks)
  • [n/a] add tests,
  • ready for review.

Copy link

codecov bot commented Jan 14, 2024

Codecov Report

Attention: 13 lines in your changes are missing coverage. Please review.

Comparison is base (17595ab) 80.25% compared to head (a01b869) 80.14%.

Files Patch % Lines
hyperspy/samfire_utils/samfire_kernel.py 0.00% 4 Missing ⚠️
hyperspy/defaults_parser.py 0.00% 2 Missing and 1 partial ⚠️
hyperspy/learn/mva.py 50.00% 0 Missing and 2 partials ⚠️
hyperspy/drawing/utils.py 75.00% 1 Missing ⚠️
hyperspy/drawing/widget.py 0.00% 1 Missing ⚠️
hyperspy/signal_tools.py 0.00% 1 Missing ⚠️
hyperspy/ui_registry.py 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@                  Coverage Diff                   @@
##           RELEASE_next_patch    #3299      +/-   ##
======================================================
- Coverage               80.25%   80.14%   -0.11%     
======================================================
  Files                     147      147              
  Lines                   21859    21840      -19     
  Branches                 5143     5144       +1     
======================================================
- Hits                    17542    17504      -38     
- Misses                   3111     3126      +15     
- Partials                 1206     1210       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@CSSFrancis CSSFrancis left a comment

Choose a reason for hiding this comment

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

Most of these changes look good but is there a reason not to take the unused imports and set:

__all__=["previously_unused_import", ... ]

Or is there a reason against this?

@@ -63,7 +65,7 @@
user_agent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36 Edg/108.0.1462.54"

try:
import sphinxcontrib.spelling
import sphinxcontrib.spelling # noqa: F401
Copy link
Member

Choose a reason for hiding this comment

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

It might be good to add this to the dev guide as how to stop the linter from linting :)

Copy link
Member Author

Choose a reason for hiding this comment

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

Done!

hyperspy/api.py Show resolved Hide resolved
@ericpre ericpre merged commit 01270a8 into hyperspy:RELEASE_next_patch Jan 18, 2024
23 of 25 checks passed
@ericpre ericpre deleted the ruff_check branch January 18, 2024 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants