-
Notifications
You must be signed in to change notification settings - Fork 35
Add ruff rules PL, B #814
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 rules PL, B #814
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #814 +/- ##
==========================================
+ Coverage 83.11% 83.16% +0.04%
==========================================
Files 48 48
Lines 7126 7122 -4
==========================================
Hits 5923 5923
+ Misses 1203 1199 -4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
dada363 to
8a5b984
Compare
8a5b984 to
9116a65
Compare
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.
Pull Request Overview
This PR adds new ruff rules PL (pylint) and B (flake8-bugbear) to the linting configuration and fixes violations identified by these rules throughout the codebase.
- Adds pylint (PL) and flake8-bugbear (B) rules to ruff configuration with appropriate exceptions
- Fixes code style violations related to subprocess calls, loop variables, nested conditionals, and zip operations
- Improves code maintainability by removing unused imports and simplifying conditional structures
Reviewed Changes
Copilot reviewed 26 out of 26 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| pyproject.toml | Adds PL and B ruff rules with configuration and ignored rule exceptions |
| tests/utils.py | Replaces pylint disable comment with explicit check=False parameter |
| tests/test_merge_rft_ertobs.py | Removes duplicate "report_step" from set definition |
| tests/test_field_statistics.py | Moves subprocess import to top-level, removes unused variables and comments, simplifies conditionals |
| tests/test_check_swatinit_simulators.py | Simplifies nested if-else structure to elif |
| tests/test_check_swatinit.py | Simplifies nested if-else structure to elif |
| tests/test_casegen_upcars.py | Adds strict=False to zip() calls for length safety |
| src/subscript/sw_model_utilities/sw_model_utilities.py | Fixes variable reference and adds strict=False to zip() |
| src/subscript/summaryplot/summaryplot.py | Simplifies nested if-else structure to elif |
| src/subscript/sector2fluxnum/flux_util.py | Replaces multiple or conditions with membership test |
| src/subscript/ri_wellmod/ri_wellmod.py | Adds strict=False to zip() call |
| src/subscript/restartthinner/restartthinner.py | Fixes variable reference in loop |
| src/subscript/prtvol2csv/prtvol2csv.py | Adds stacklevel parameter to warnings |
| src/subscript/pack_sim/pack_sim.py | Iterates over dict items instead of keys, simplifies conditional |
| src/subscript/ofmvol2csv/ofmvol2csv.py | Adds strict=False to zip() call |
| src/subscript/hook_implementations/forward_model_steps.py | Removes trailing comment marker |
| src/subscript/grav_subs_points/grav_subs_points.py | Prefixes unused loop variables with underscore, adds strict=False to zip() |
| src/subscript/grav_subs_maps/grav_subs_maps.py | Prefixes unused loop variables with underscore |
| src/subscript/fmuobs/parsers.py | Adds strict=False to zip() call |
| src/subscript/fmu_copy_revision/fmu_copy_revision.py | Adds noqa comment for intentional loop variable reuse |
| src/subscript/field_statistics/field_statistics.py | Moves imports to top-level |
| src/subscript/eclcompress/eclcompress.py | Simplifies conditional structure |
| src/subscript/csv_stack/csv_stack.py | Adds stacklevel parameter to warning |
| src/subscript/check_swatinit/check_swatinit.py | Adds strict=False to zip() call |
| src/subscript/casegen_upcars/model.py | Simplifies conditionals, adds strict=False to zip() calls, removes unused variables |
| src/subscript/casegen_upcars/casegen_upcars.py | Adds strict=False to zip() calls |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
|
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.
Pull Request Overview
Copilot reviewed 26 out of 26 changed files in this pull request and generated 1 comment.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
cfc849f to
08c9906
Compare
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.
Pull Request Overview
Copilot reviewed 25 out of 25 changed files in this pull request and generated 1 comment.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
7649522 to
f80938b
Compare
d4edc80 to
2ca3f1f
Compare
See https://docs.astral.sh/ruff/rules/#flake8-bugbear-b
https://docs.astral.sh/ruff/rules/#pylint-pl