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 CFWriter utility into CF directory #2524

Merged
merged 42 commits into from
Nov 28, 2023

Fix style

b4e8fa5
Select commit
Loading
Failed to load commit list.
Merged

Refactor CFWriter utility into CF directory #2524

Fix style
b4e8fa5
Select commit
Loading
Failed to load commit list.
CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main) succeeded Nov 28, 2023 in 1m 51s

CodeScene PR Check

Code Health Quality Gates: OK

  • Declining Code Health: 4 findings(s) 🚩
  • Improving Code Health: 21 findings(s) ✅
  • Affected Hotspots: 0 files(s) 🔥

Recommended Review Level: Detailed -- Increased risk for defects: The change involves more modules and modified lines of code than 99% of the historic high-risk change sets. The risk is lower since it is an experienced author responsible for 42% of all commits in this repo.
View detailed results in CodeScene

Details

🚩 Declining Code Health (highest to lowest):

  • Large Method _test_data.py: get_test_attrs
  • Excess Number of Function Arguments data_array.py: make_cf_data_array
  • Excess Number of Function Arguments datasets.py: collect_cf_datasets
  • Excess Number of Function Arguments datasets.py: _collect_cf_dataset

✅ Improving Code Health:

  • Low Cohesion test_writers.py
  • Excess Number of Function Arguments cf_writer.py: make_cf_dataarray
  • Excess Number of Function Arguments cf_writer.py: _collect_cf_dataset
  • Excess Number of Function Arguments cf_writer.py: collect_cf_datasets
  • Large Method _scene_converters.py: to_xarray
  • Lines of Code in a Single File test_cf.py
  • Large Method test_cf.py: TestCFWriter.test__add_grid_mapping
  • Large Method test_cf.py: TestCFWriter.get_test_attrs
  • Bumpy Road Ahead test_cf.py: TestCFWriter.assertDictWithArraysEqual
  • Lines of Code in a Single File cf_writer.py
  • Complex Method cf_writer.py: make_alt_coords_unique
  • Complex Method cf_writer.py: _encode_nc
  • Complex Conditional cf_writer.py: area2cf
  • Complex Conditional cf_writer.py: _preprocess_dataarray_name
  • Large Method cf_writer.py: collect_cf_datasets
  • Large Method cf_writer.py: CFWriter.save_datasets
  • Bumpy Road Ahead cf_writer.py: make_alt_coords_unique
  • Bumpy Road Ahead cf_writer.py: link_coords
  • Deep, Nested Complexity cf_writer.py: make_alt_coords_unique
  • Deep, Nested Complexity cf_writer.py: link_coords
  • Deep, Nested Complexity cf_writer.py: _get_groups

Annotations

Check notice on line 1 in satpy/tests/writer_tests/test_cf.py

See this annotation in the file changed.

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

✅ No longer an issue: Lines of Code in a Single File

The lines of code in this module is no longer above the threshold

Check notice on line 396 in satpy/tests/writer_tests/test_cf.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

TestCFWriter.test__add_grid_mapping is no longer above the threshold for lines of code

Check notice on line 396 in satpy/tests/writer_tests/test_cf.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

TestCFWriter.get_test_attrs is no longer above the threshold for lines of code

Check notice on line 396 in satpy/tests/writer_tests/test_cf.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

TestCFWriter.assertDictWithArraysEqual is no longer above the threshold for logical blocks with deeply nested code

Check notice on line 205 in satpy/writers/cf_writer.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

make_cf_dataarray 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 205 in satpy/writers/cf_writer.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

_collect_cf_dataset 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 205 in satpy/writers/cf_writer.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

collect_cf_datasets 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/writers/cf_writer.py

See this annotation in the file changed.

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

✅ No longer an issue: Lines of Code in a Single File

The lines of code in this module is no longer above the threshold

Check notice on line 205 in satpy/writers/cf_writer.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

make_alt_coords_unique is no longer above the threshold for cyclomatic complexity

Check notice on line 205 in satpy/writers/cf_writer.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

_encode_nc is no longer above the threshold for cyclomatic complexity

Check notice on line 205 in satpy/writers/cf_writer.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

area2cf no longer has a complex conditional

Check notice on line 205 in satpy/writers/cf_writer.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

_preprocess_dataarray_name no longer has a complex conditional

Check notice on line 205 in satpy/writers/cf_writer.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

collect_cf_datasets is no longer above the threshold for lines of code

Check notice on line 307 in satpy/writers/cf_writer.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

CFWriter.save_datasets is no longer above the threshold for lines of code

Check notice on line 205 in satpy/writers/cf_writer.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

make_alt_coords_unique is no longer above the threshold for logical blocks with deeply nested code

Check notice on line 205 in satpy/writers/cf_writer.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

link_coords is no longer above the threshold for logical blocks with deeply nested code

Check notice on line 205 in satpy/writers/cf_writer.py

See this annotation in the file changed.

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

✅ No longer an issue: Deep, Nested Complexity

make_alt_coords_unique is no longer above the threshold for nested complexity depth

Check notice on line 205 in satpy/writers/cf_writer.py

See this annotation in the file changed.

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

✅ No longer an issue: Deep, Nested Complexity

link_coords is no longer above the threshold for nested complexity depth

Check notice on line 205 in satpy/writers/cf_writer.py

See this annotation in the file changed.

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

✅ No longer an issue: Deep, Nested Complexity

_get_groups is no longer above the threshold for nested complexity depth

Check notice on line 83 in satpy/_scene_converters.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

to_xarray is no longer above the threshold for lines of code

Check warning on line 161 in satpy/cf/datasets.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

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

Check warning on line 249 in satpy/cf/datasets.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

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

Check warning on line 111 in satpy/tests/cf_tests/_test_data.py

See this annotation in the file changed.

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

❌ New issue: Large Method

get_test_attrs has 85 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 notice on line 1 in satpy/tests/test_writers.py

See this annotation in the file changed.

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

✅ Getting better: Low Cohesion

The number of different responsibilities decreases from 17 to 16, 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 88 in satpy/cf/data_array.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

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