Refactor _resampled_scene() and _reduce_data() methods of the Scene class
#3178
CodeScene PR Check
Quality Gate Passed
Code Health Improved
(1 files improve in Code Health)
Gates Passed
4 Quality Gates Passed
See analysis details in CodeScene
View Improvements
| File | Code Health Impact | Categories Improved |
|---|---|---|
| scene.py | 6.96 → 7.26 | Complex Method, Bumpy Road Ahead, Excess Number of Function Arguments |
Quality Gate Profile: Clean Code Collective
Want more control? Customize Code Health rules or catch issues early with our IDE extension and CLI tool.
Details
✅ Improving Code Health:
- Complex Method scene.py: Scene._resampled_scene 🔥
- Bumpy Road Ahead scene.py: Scene._resampled_scene 🔥
- Excess Number of Function Arguments scene.py: Scene._reduce_data 🔥
Annotations
Check notice on line 890 in satpy/scene.py
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
✅ No longer an issue: Complex Method
Scene._resampled_scene 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 890 in satpy/scene.py
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
✅ No longer an issue: Bumpy Road Ahead
Scene._resampled_scene 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 966 in satpy/scene.py
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
✅ Getting better: Excess Number of Function Arguments
Scene._reduce_data decreases from 6 to 5 arguments, threshold = 4. This function has too many arguments, indicating a lack of encapsulation. Avoid adding more arguments.