Introduce radiance_factor calibration level
#3292
CodeScene PR Check
Quality Gate Failed
Code Health Improved
(1 files improve in Code Health)
Gates Failed
Enforce critical code health rules
(2 files with Low Cohesion, Bumpy Road Ahead)
Enforce advisory code health rules
(8 files with Complex Method, Code Duplication, Overall Code Complexity)
Gates Passed
2 Quality Gates Passed
See analysis details in CodeScene
Reason for failure
| Enforce critical code health rules | Violations | Code Health Impact | |
|---|---|---|---|
| test_mersi_l1b.py | 1 critical rule | 9.16 → 8.09 | Suppress |
| viirs_l1b.py | 1 critical rule | 8.99 → 8.11 | Suppress |
| Enforce advisory code health rules | Violations | Code Health Impact | |
|---|---|---|---|
| viirs_l1b.py | 2 advisory rules | 8.99 → 8.11 | Suppress |
| test_slstr_l1b.py | 1 advisory rule | 10.00 → 9.39 | Suppress |
| test_goes_imager_nc_eum.py | 1 advisory rule | 10.00 → 9.39 | Suppress |
| fy4.py | 1 advisory rule | 10.00 → 9.69 | Suppress |
| mersi_l1b.py | 1 advisory rule | 9.10 → 8.82 | Suppress |
| avhrr_l1b_gaclac.py | 1 advisory rule | 8.61 → 8.56 | Suppress |
| aapp_l1b.py | 1 advisory rule | 9.01 → 8.99 | Suppress |
| viirs_compact.py | 1 advisory rule | 8.46 → 8.43 | Suppress |
View Improvements
| File | Code Health Impact | Categories Improved |
|---|---|---|
| virr_l1b.py | 9.46 → 9.54 | Complex Method |
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
🚩 Declining Code Health (highest to lowest):
- Low Cohesion test_mersi_l1b.py
- Overall Code Complexity viirs_l1b.py
- Code Duplication test_goes_imager_nc_eum.py
- Code Duplication test_slstr_l1b.py
- Complex Method aapp_l1b.py: _vis_calibrate
- Complex Method viirs_compact.py: VIIRSCompactFileHandler.read_dataset
- Complex Method fy4.py: FY4Base.calibrate
- Complex Method mersi_l1b.py: MERSIL1B.get_dataset
- Complex Method viirs_l1b.py: VIIRSL1BFileHandler._get_dataset_valid_range
- Complex Method avhrr_l1b_gaclac.py: GACLACFile.get_dataset
- Bumpy Road Ahead viirs_l1b.py: VIIRSL1BFileHandler._get_dataset_valid_range
✅ Improving Code Health:
- Code Duplication test_viirs_l1b.py: TestVIIRSL1BReaderDay.test_load_every_m_band_refl
- Complex Method virr_l1b.py: VIRR_L1B.get_dataset
Annotations
Check notice on line 135 in satpy/readers/virr_l1b.py
codescene-delta-analysis / CodeScene Code Health Review (main)
✅ Getting better: Complex Method
VIRR_L1B.get_dataset decreases in cyclomatic complexity from 14 to 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 1 in satpy/tests/reader_tests/test_viirs_l1b.py
codescene-delta-analysis / CodeScene Code Health Review (main)
✅ Getting better: Code Duplication
reduced similar code in: TestVIIRSL1BReaderDay.test_load_every_m_band_refl. Avoid duplicated, aka copy-pasted, code inside the module. More duplication lowers the code health.
Check warning on line 619 in satpy/readers/aapp_l1b.py
codescene-delta-analysis / CodeScene Code Health Review (main)
❌ Getting worse: Complex Method
_vis_calibrate increases in cyclomatic complexity from 11 to 12, 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 warning on line 158 in satpy/readers/avhrr_l1b_gaclac.py
codescene-delta-analysis / CodeScene Code Health Review (main)
❌ Getting worse: Complex Method
GACLACFile.get_dataset increases in cyclomatic complexity from 13 to 15, 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 warning on line 292 in satpy/readers/viirs_compact.py
codescene-delta-analysis / CodeScene Code Health Review (main)
❌ Getting worse: Complex Method
VIIRSCompactFileHandler.read_dataset increases in cyclomatic complexity from 11 to 12, 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 warning on line 301 in satpy/tests/reader_tests/test_slstr_l1b.py
codescene-delta-analysis / CodeScene Code Health Review (main)
❌ New issue: Code Duplication
The module contains 2 functions with similar structure: TestSLSTRCalibration.test_radiance_factor_calibration,TestSLSTRCalibration.test_reflectance_calibration. Avoid duplicated, aka copy-pasted, code inside the module. More duplication lowers the code health.
Check warning on line 158 in satpy/readers/mersi_l1b.py
codescene-delta-analysis / CodeScene Code Health Review (main)
❌ New issue: Complex Method
MERSIL1B.get_dataset 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 warning on line 1 in satpy/tests/reader_tests/test_mersi_l1b.py
codescene-delta-analysis / CodeScene Code Health Review (main)
❌ New issue: Low Cohesion
This module has at least 5 different responsibilities amongst its 27 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 warning on line 160 in satpy/readers/viirs_l1b.py
codescene-delta-analysis / CodeScene Code Health Review (main)
❌ New issue: Complex Method
VIIRSL1BFileHandler._get_dataset_valid_range has a cyclomatic complexity of 9, 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 warning on line 160 in satpy/readers/viirs_l1b.py
codescene-delta-analysis / CodeScene Code Health Review (main)
❌ New issue: Bumpy Road Ahead
VIIRSL1BFileHandler._get_dataset_valid_range has 2 blocks with nested conditional logic. Any nesting of 2 or deeper is considered. Threshold is 2 blocks 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 warning on line 1 in satpy/readers/viirs_l1b.py
codescene-delta-analysis / CodeScene Code Health Review (main)
❌ New issue: Overall Code Complexity
This module has a mean cyclomatic complexity of 4.06 across 16 functions. The mean complexity threshold is 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 141 in satpy/tests/reader_tests/test_goes_imager_nc_eum.py
codescene-delta-analysis / CodeScene Code Health Review (main)
❌ New issue: Code Duplication
The module contains 2 functions with similar structure: GOESNCEUMFileHandlerRadianceTest.setUp,GOESNCEUMFileHandlerVISTest.setUp. Avoid duplicated, aka copy-pasted, code inside the module. More duplication lowers the code health.
Check warning on line 155 in satpy/readers/core/fy4.py
codescene-delta-analysis / CodeScene Code Health Review (main)
❌ New issue: Complex Method
FY4Base.calibrate has a cyclomatic complexity of 9, 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.