-
Notifications
You must be signed in to change notification settings - Fork 34
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
base: main
Are you sure you want to change the base?
Add ruff rules PL, B #814
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #814 +/- ##
==========================================
+ Coverage 79.64% 79.67% +0.02%
==========================================
Files 49 49
Lines 7513 7513
==========================================
+ Hits 5984 5986 +2
+ Misses 1529 1527 -2 ☔ 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.
desc[ix] | ||
+ " a=" | ||
+ str(av[ix]) | ||
+ str(_vec) |
Copilot
AI
Oct 2, 2025
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 variable _vec
is not defined in this scope. This should likely be av[ix]
based on the original code context and the similar usage patterns in lines 171.
Copilot uses AI. Check for mistakes.
) | ||
|
||
swn = av[ix] * (hei * math.sqrt(perm[ix] / poro[ix])) ** bv[ix] | ||
swn = _vec * (hei * math.sqrt(perm[ix] / poro[ix])) ** bv[ix] |
Copilot
AI
Oct 2, 2025
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 variable _vec
is not defined in this scope. This should likely be av[ix]
based on the pattern seen in the original code and context.
Copilot uses AI. Check for mistakes.
Test for field_statistics failed with too many values to unpack:
meaning that this module cannot have been working as expected before.. |
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.
) | ||
|
||
swn = av[ix] * (hei * math.sqrt(perm[ix] / poro[ix])) ** bv[ix] | ||
swn = _vec * (hei * math.sqrt(perm[ix] / poro[ix])) ** bv[ix] |
Copilot
AI
Oct 2, 2025
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 variable _vec
is undefined. This should likely be av[ix]
based on the surrounding code context.
Copilot uses AI. Check for mistakes.
See https://docs.astral.sh/ruff/rules/#flake8-bugbear-b
https://docs.astral.sh/ruff/rules/#pylint-pl