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

Refactor Sentinel-1 SAR-C reader #2727

Merged
merged 17 commits into from
Apr 29, 2024

Restore get_reader_kwargs

3b40675
Select commit
Loading
Failed to load commit list.
Merged

Refactor Sentinel-1 SAR-C reader #2727

Restore get_reader_kwargs
3b40675
Select commit
Loading
Failed to load commit list.
CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main) failed Apr 29, 2024 in 1m 19s

CodeScene PR Check

Code Health Quality Gates: FAILED

  • Declining Code Health: 3 findings(s) 🚩
  • Improving Code Health: 6 findings(s) ✅
  • Affected Hotspots: 2 files(s) 🔥

View detailed results in CodeScene

Details

🚩 Declining Code Health (highest to lowest):

  • Deep, Nested Complexity sar_c_safe.py: SAFESARReader.load
  • Code Duplication test_sar_c_safe.py
  • Excess Number of Function Arguments test_sar_c_safe.py: test_filename_filtering_from_reader

✅ Improving Code Health:

  • Complex Conditional yaml_reader.py: FileYAMLReader.time_matches 🔥
  • Complex Method yaml_reader.py: FileYAMLReader.metadata_matches 🔥
  • Bumpy Road Ahead yaml_reader.py: FileYAMLReader.metadata_matches 🔥
  • Excess Number of Function Arguments sar_c_safe.py: SAFEGRD.init
  • Excess Number of Function Arguments sar_c_safe.py: interpolate_xarray
  • Large Method test_sar_c_safe.py: TestSAFEGRD.test_read_lon_lats

Annotations

Check warning on line 293 in satpy/tests/reader_tests/test_sar_c_safe.py

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)

❌ New issue: Code Duplication

The module contains 4 functions with similar structure: TestSAFEGRD.test_read_calibrated_dB,TestSAFEGRD.test_read_calibrated_natural,test_reading_from_reader,test_swath_def_contains_gcps. Avoid duplicated, aka copy-pasted, code inside the module. More duplication lowers the code health.

Check warning on line 889 in satpy/tests/reader_tests/test_sar_c_safe.py

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)

❌ New issue: Excess Number of Function Arguments

test_filename_filtering_from_reader has 5 arguments, threshold = 4. This function has too many arguments, indicating a lack of encapsulation. Avoid adding more arguments.

Check notice on line 308 in satpy/tests/reader_tests/test_sar_c_safe.py

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)

✅ No longer an issue: Large Method

TestSAFEGRD.test_read_lon_lats is no longer above the threshold for lines of code

Check notice on line 1 in satpy/readers/__init__.py

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)

ℹ Getting worse: Overall Code Complexity

The mean cyclomatic complexity increases from 4.94 to 5.00, threshold = 4. This file has many conditional statements (e.g. if, for, while) across its implementation, leading to lower code health. Avoid adding more conditionals.

Check warning on line 734 in satpy/readers/sar_c_safe.py

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)

❌ New issue: Deep, Nested Complexity

SAFESARReader.load has a nested complexity depth of 4, threshold = 4. This function contains deeply nested logic such as if statements and/or loops. The deeper the nesting, the lower the code health.

Check notice on line 556 in satpy/readers/sar_c_safe.py

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)

✅ Getting better: Excess Number of Function Arguments

SAFEGRD.__init__ decreases from 6 to 5 arguments, threshold = 4. This function has too many arguments, indicating a lack of encapsulation. Avoid adding more arguments.

Check notice on line 505 in satpy/readers/sar_c_safe.py

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)

✅ No longer an issue: Excess Number of Function Arguments

interpolate_xarray is no longer above the threshold for number of arguments. This function has too many arguments, indicating a lack of encapsulation. Avoid adding more arguments.

Check notice on line 116 in satpy/readers/sar_c_safe.py

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)

ℹ New issue: Excess Number of Function Arguments

SAFEXML.__init__ has 5 arguments, threshold = 4. This function has too many arguments, indicating a lack of encapsulation. Avoid adding more arguments.

Check notice on line 172 in satpy/readers/sar_c_safe.py

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)

ℹ New issue: Excess Number of Function Arguments

Calibrator.__init__ has 5 arguments, threshold = 4. This function has too many arguments, indicating a lack of encapsulation. Avoid adding more arguments.

Check notice on line 215 in satpy/readers/sar_c_safe.py

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)

ℹ New issue: Excess Number of Function Arguments

Denoiser.__init__ has 5 arguments, threshold = 4. This function has too many arguments, indicating a lack of encapsulation. Avoid adding more arguments.

Check notice on line 1 in satpy/readers/yaml_reader.py

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)

ℹ Getting worse: Lines of Code in a Single File

The lines of code increases from 1070 to 1076, improve code health by reducing it to 600. The number of Lines of Code in a single file. More Lines of Code lowers the code health.

Check notice on line 1 in satpy/readers/yaml_reader.py

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)

ℹ Getting worse: Number of Functions in a Single Module

The number of functions increases from 100 to 102, threshold = 75. This file contains too many functions. Beyond a certain threshold, more functions lower the code health.

Check notice on line 591 in satpy/readers/yaml_reader.py

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)

✅ No longer an issue: Complex Method

FileYAMLReader.metadata_matches is no longer above the threshold for cyclomatic complexity. This function has many conditional statements (e.g. if, for, while), leading to lower code health. Avoid adding more conditionals and code to it without refactoring.

Check notice on line 444 in satpy/readers/yaml_reader.py

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)

ℹ New issue: Complex Method

GenericYAMLReader.metadata_matches has a cyclomatic complexity of 11, threshold = 9. This function has many conditional statements (e.g. if, for, while), leading to lower code health. Avoid adding more conditionals and code to it without refactoring.

Check notice on line 591 in satpy/readers/yaml_reader.py

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)

✅ No longer an issue: Complex Conditional

FileYAMLReader.time_matches no longer has a complex conditional. A complex conditional is an expression inside a branch (e.g. if, for, while) which consists of multiple, logical operators such as AND/OR. The more logical operators in an expression, the more severe the code smell.

Check notice on line 453 in satpy/readers/yaml_reader.py

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)

ℹ New issue: Complex Conditional

GenericYAMLReader.time_matches has 2 complex conditionals with 4 branches, threshold = 2. A complex conditional is an expression inside a branch (e.g. if, for, while) which consists of multiple, logical operators such as AND/OR. The more logical operators in an expression, the more severe the code smell.

Check notice on line 591 in satpy/readers/yaml_reader.py

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)

✅ No longer an issue: Bumpy Road Ahead

FileYAMLReader.metadata_matches is no longer above the threshold for logical blocks with deeply nested code. The Bumpy Road code smell is a function that contains multiple chunks of nested conditional logic. The deeper the nesting and the more bumps, the lower the code health.

Check notice on line 444 in satpy/readers/yaml_reader.py

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)

ℹ New issue: Bumpy Road Ahead

GenericYAMLReader.metadata_matches has 2 blocks with nested conditional logic. Any nesting of 2 or deeper is considered. Threshold is one single, nested block per function. The Bumpy Road code smell is a function that contains multiple chunks of nested conditional logic. The deeper the nesting and the more bumps, the lower the code health.

Check notice on line 1 in satpy/tests/test_readers.py

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)

ℹ Getting worse: Lines of Code in a Single File

The lines of code increases from 837 to 845, improve code health by reducing it to 600. The number of Lines of Code in a single file. More Lines of Code lowers the code health.

Check notice on line 1 in satpy/tests/test_readers.py

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)

ℹ Getting worse: Number of Functions in a Single Module

The number of functions increases from 96 to 97, threshold = 75. This file contains too many functions. Beyond a certain threshold, more functions lower the code health.

Check notice on line 1 in satpy/tests/test_readers.py

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)

ℹ Getting worse: Low Cohesion

The number of different responsibilities increases from 51 to 52, threshold = 4. Cohesion is calculated using the LCOM4 metric. Low cohesion means that the module/class has multiple unrelated responsibilities, doing too many things and breaking the Single Responsibility Principle.