Refactor code for Sun zenith angle corrections and change to effective_solar_pathlength_corrected instead of sunz_corrected for built-in RGB recipes
#3397
CodeScene PR Check
Quality Gate Failed
Code Health Improved
(1 files improve in Code Health)
Gates Failed
Enforce critical code health rules
(1 file with Low Cohesion)
Enforce advisory code health rules
(1 file with Complex Method)
Gates Passed
2 Quality Gates Passed
See analysis details in CodeScene
Reason for failure
| Enforce critical code health rules | Violations | Code Health Impact | |
|---|---|---|---|
| test_modifiers.py | 1 critical rule | 9.10 → 8.28 | Suppress |
| Enforce advisory code health rules | Violations | Code Health Impact | |
|---|---|---|---|
| angles.py | 1 advisory rule | 9.69 → 9.39 | Suppress |
View Improvements
| File | Code Health Impact | Categories Improved |
|---|---|---|
| geometry.py | 9.39 → 10.00 | Code Duplication |
Quality Gate Profile: Clean Code Collective
Install CodeScene MCP: safeguard and uplift AI-generated code. Catch issues early with our IDE extension and CLI tool.
Details
🚩 Declining Code Health (highest to lowest):
- Low Cohesion test_modifiers.py
- Complex Method angles.py: sunzen_corr_cos
✅ Improving Code Health:
- Low Cohesion utils.py 🔥
- Lines of Code in a Single File utils.py 🔥
- Excess Number of Function Arguments angles.py: _sunzen_reduction_ndarray
- Code Duplication geometry.py
- Code Duplication test_modifiers.py
Annotations
Check warning on line 618 in satpy/modifiers/angles.py
codescene-delta-analysis / CodeScene Code Health Review (main)
❌ New issue: Complex Method
sunzen_corr_cos has a cyclomatic complexity of 10, 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 668 in satpy/modifiers/angles.py
codescene-delta-analysis / CodeScene Code Health Review (main)
✅ No longer an issue: Excess Number of Function Arguments
_sunzen_reduction_ndarray 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 1 in satpy/modifiers/geometry.py
codescene-delta-analysis / CodeScene Code Health Review (main)
✅ No longer an issue: Code Duplication
The module no longer contains too many functions with similar structure
Check notice on line 1 in satpy/utils.py
codescene-delta-analysis / CodeScene Code Health Review (main)
✅ Getting better: Lines of Code in a Single File
The lines of code decreases from 678 to 651, 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/utils.py
codescene-delta-analysis / CodeScene Code Health Review (main)
✅ Getting better: Low Cohesion
The number of different responsibilities decreases from 24 to 23, 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.
Check warning on line 1 in satpy/tests/test_modifiers.py
codescene-delta-analysis / CodeScene Code Health Review (main)
❌ New issue: Low Cohesion
This module has at least 12 different responsibilities amongst its 41 functions, 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.
Check notice on line 1 in satpy/tests/test_modifiers.py
codescene-delta-analysis / CodeScene Code Health Review (main)
✅ No longer an issue: Code Duplication
The module no longer contains too many functions with similar structure