Skip to content

Conversation

k034b363
Copy link
Contributor

Describe your changes
Deepsource identified 29 occurrences of "inconsistent return statements," where functions lacked an explicit "return None" when conditions weren't satisfied. This pull attempts to fix 27 of these, all within the file plantcv/plantcv/spectral_index/spectral_index.py wherein all functions previously terminated in a fatal_error(). I changed all the fatal_error() calls to warn() calls instead and added a "return None" line, which serves to allow workflows to continue calculating other metrics even if the requirements for one are not met.
This required also changing the associated bad input tests to an "assert ... is None," rather than a RuntimeError.

Type of update
Deepsource fix with some changes in what's allowed within a workflow.

Associated issues
N/A

Additional context
N/A

For the reviewer
See this page for instructions on how to review the pull request.

  • PR functionality reviewed in a Jupyter Notebook
  • All tests pass
  • Test coverage remains 100%
  • Documentation tested
  • New documentation pages added to plantcv/mkdocs.yml
  • Changes to function input/output signatures added to updating.md
  • Code reviewed
  • PR approved

Copy link

codecov bot commented Jan 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (faed9ed) 100.00% compared to head (f4b323d) 100.00%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##              main     #1438   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          158       158           
  Lines         6943      6970   +27     
=========================================
+ Hits          6943      6970   +27     
Flag Coverage Δ
unittests 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
plantcv/plantcv/spectral_index/spectral_index.py 100.00% <100.00%> (ø)

@k034b363 k034b363 added ready to review cleanup Code quality updates labels Jan 24, 2024
@nfahlgren nfahlgren merged commit 87c25d1 into main Jan 26, 2024
@nfahlgren nfahlgren deleted the fix-PYL-R1710 branch January 26, 2024 04:01
@nfahlgren nfahlgren added this to the PlantCV v4.3 milestone Apr 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cleanup Code quality updates ready to review
Projects
Status: Pull Requests
Development

Successfully merging this pull request may close these issues.

2 participants