Skip to content

Conversation

larsevj
Copy link
Contributor

@larsevj larsevj commented Oct 2, 2025

@codecov-commenter
Copy link

codecov-commenter commented Oct 2, 2025

Codecov Report

❌ Patch coverage is 88.57143% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.67%. Comparing base (544a0e3) to head (1b24f8e).

Files with missing lines Patch % Lines
...subscript/sw_model_utilities/sw_model_utilities.py 0.00% 2 Missing ⚠️
src/subscript/csv_stack/csv_stack.py 0.00% 1 Missing ⚠️
src/subscript/ri_wellmod/ri_wellmod.py 0.00% 1 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@larsevj larsevj force-pushed the add_ruff_rules_PL branch from dada363 to 8a5b984 Compare October 2, 2025 12:18
@larsevj larsevj changed the title Add ruff rules PL Add ruff rules PL, B Oct 2, 2025
@larsevj larsevj force-pushed the add_ruff_rules_PL branch from 8a5b984 to 9116a65 Compare October 2, 2025 12:26
@larsevj larsevj requested a review from Copilot October 2, 2025 12:27
Copy link

@Copilot Copilot AI left a 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)
Copy link

Copilot AI Oct 2, 2025

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]
Copy link

Copilot AI Oct 2, 2025

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.

@larsevj
Copy link
Contributor Author

larsevj commented Oct 2, 2025

Test for field_statistics failed with too many values to unpack:

ValueError: too many values to unpack (expected 13)
======================================================================================= short test summary info =======================================================================================
FAILED tests/test_field_statistics.py::test_main[config_file0-config_dict0] - subprocess.CalledProcessError: Command '['field_statistics', '-c', '/tmp/pytest-of-levje/pytest-315/test_main_config_file0_config_0/testdata_field_statistics/config_example.yml', '-p', '/tmp/pyt...

meaning that this module cannot have been working as expected before..

@larsevj larsevj requested a review from Copilot October 2, 2025 13:02
Copy link

@Copilot Copilot AI left a 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]
Copy link

Copilot AI Oct 2, 2025

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.

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