Add unit tests for gpm_api.io #8
CodeScene PR Check
❌ Quality Gates: FAILED
- Declining Code Health: 17 findings(s) 🚩
- Improving Code Health: 3 findings(s) ✅
- Affected Hotspots: 1 files(s) 🔥
Recommended Review Level: Detailed -- Inspect the code that degrades in code health.
View detailed results in CodeScene
Details
Absence of Expected Change Pattern
- gpm_api/gpm_api/io/download.py is usually changed with: gpm_api/gpm_api/io/pps.py
🚩 Negative Code Health Impact (highest to lowest):
- Large Method conftest.py: local_filepaths
- Code Duplication test_checks.py
- Complex Method checks.py: check_time
- Large Method conftest.py: server_paths
- Complex Conditional download.py: flatten_list 🔥
- Deep, Nested Complexity test_directories.py: test_get_disk_dir_pattern
- Deep, Nested Complexity test_directories.py: test_get_disk_directory
- Complex Method test_filter.py: test_filter_filepaths
- Complex Conditional test_filter.py: test_filter_filepaths
- Bumpy Road Ahead test_checks.py: test_check_product
- Bumpy Road Ahead test_checks.py: test_check_product_validity
- Bumpy Road Ahead test_filter.py: test_filter_filepaths
- Bumpy Road Ahead test_filter.py: test_filter_by_time
- Bumpy Road Ahead test_pps.py: test_find_pps_daily_filepaths_private
- Excess Number of Function Arguments test_download.py: test_download_data
- Excess Number of Function Arguments test_download.py: test_download_daily_data_private
- Excess Number of Function Arguments test_download.py: test_convert_pps_to_disk_filepaths
✅ Positive Code Health Impact (highest to lowest):
- Overall Code Complexity checks.py
- Complex Method checks.py: check_bbox
- Complex Conditional checks.py: check_bbox
Annotations
Check warning on line 1 in gpm_api/tests/conftest.py
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ New issue: Large Method
local_filepaths has 124 lines, threshold = 70. Large functions with many lines of code are generally harder to understand and lower the code health. Avoid adding more lines to this function.
Check warning on line 1 in gpm_api/tests/conftest.py
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ New issue: Large Method
server_paths has 81 lines, threshold = 70. Large functions with many lines of code are generally harder to understand and lower the code health. Avoid adding more lines to this function.
Check warning on line 1 in gpm_api/tests/io/test_checks.py
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ New issue: Code Duplication
The module contains 2 functions with similar structure: test_check_product_category,test_check_product_level. Avoid duplicated, aka copy-pasted, code inside the module. More duplication lowers the code health.
Check warning on line 1 in gpm_api/tests/io/test_checks.py
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ New issue: Bumpy Road Ahead
test_check_product 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 warning on line 1 in gpm_api/tests/io/test_checks.py
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ New issue: Bumpy Road Ahead
test_check_product_validity 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 warning on line 185 in gpm_api/io/checks.py
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ Getting worse: Complex Method
check_time increases in cyclomatic complexity from 15 to 19, 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 237 in gpm_api/io/checks.py
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
✅ No longer an issue: Complex Method
check_bbox 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 185 in gpm_api/io/checks.py
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
ℹ Getting worse: Bumpy Road Ahead
check_time increases from 2 to 3 logical blocks with deeply nested code, threshold is one single 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 gpm_api/io/checks.py
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
✅ Getting better: Overall Code Complexity
The mean cyclomatic complexity decreases from 5.76 to 5.56, 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 notice on line 237 in gpm_api/io/checks.py
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
✅ No longer an issue: Complex Conditional
check_bbox no longer has a complex conditional
Check warning on line 1 in gpm_api/tests/io/test_directories.py
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ New issue: Deep, Nested Complexity
test_get_disk_dir_pattern has a nested complexity depth of 5, 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 warning on line 1 in gpm_api/tests/io/test_directories.py
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ New issue: Deep, Nested Complexity
test_get_disk_directory has a nested complexity depth of 5, 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 warning on line 916 in gpm_api/io/download.py
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ New issue: Complex Conditional
flatten_list has 1 complex conditionals with 2 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 1 in gpm_api/io/download.py
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
ℹ Getting worse: Lines of Code in a Single File
The lines of code increases from 879 to 885, 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 gpm_api/io/download.py
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
ℹ Getting worse: Overall Code Complexity
The mean cyclomatic complexity increases from 4.58 to 4.71, 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 1 in gpm_api/tests/io/test_download.py
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ New issue: Excess Number of Function Arguments
test_download_data has 5 arguments, threshold = 4. This function has too many arguments, indicating a lack of encapsulation. Avoid adding more arguments.
Check warning on line 1 in gpm_api/tests/io/test_download.py
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ New issue: Excess Number of Function Arguments
test_download_daily_data_private has 5 arguments, threshold = 4. This function has too many arguments, indicating a lack of encapsulation. Avoid adding more arguments.
Check warning on line 1 in gpm_api/tests/io/test_download.py
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ New issue: Excess Number of Function Arguments
test_convert_pps_to_disk_filepaths has 5 arguments, threshold = 4. This function has too many arguments, indicating a lack of encapsulation. Avoid adding more arguments.
Check warning on line 1 in gpm_api/tests/io/test_filter.py
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ New issue: Complex Method
test_filter_filepaths 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 1 in gpm_api/tests/io/test_filter.py
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ New issue: Complex Conditional
test_filter_filepaths has 1 complex conditionals with 2 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 warning on line 1 in gpm_api/tests/io/test_filter.py
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ New issue: Bumpy Road Ahead
test_filter_filepaths has 3 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 warning on line 1 in gpm_api/tests/io/test_filter.py
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ New issue: Bumpy Road Ahead
test_filter_by_time has 3 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 warning on line 1 in gpm_api/tests/io/test_pps.py
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ New issue: Bumpy Road Ahead
test_find_pps_daily_filepaths_private 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.