Skip to content

Conversation

hjmjohnson
Copy link
Member

@hjmjohnson hjmjohnson commented Oct 17, 2025

Improve code coverage by refactoring termination path order.

Improve code intent with explicit variable for determining if a
a cluster is found.

PR Checklist

  • No API changes were made (or the changes have been approved)
  • No major design changes were made (or the changes have been approved)
  • Added test (or behavior not changed)
  • Updated API documentation (or API not changed)

@github-actions github-actions bot added area:Segmentation Issues affecting the Segmentation module type:Style Style changes: no logic impact (indentation, comments, naming) labels Oct 17, 2025
@hjmjohnson
Copy link
Member Author

The primary purpose for this change is self-serving :).

I am using ITK as a talking point in my teaching of how
code coverage can help drive good software development
process, and I noticed that no module had 100% code coverage.

I then noticed that the code coverage exposed code that
existed in an if statement that was impossible to be true
(i.e. dead code).

So I am practicing what I preach to students: Employ
the Boy Scout principle that "encourages leaving a place
better than you found it".

So ... my good deed for the day :).

@hjmjohnson hjmjohnson force-pushed the improve-code-coverage branch from 7d80d9d to d270b3b Compare October 17, 2025 13:34
@github-actions github-actions bot added the area:Filtering Issues affecting the Filtering module label Oct 17, 2025
Improve code coverage by simplying default code flow
paths.
@hjmjohnson hjmjohnson force-pushed the improve-code-coverage branch from d270b3b to 782a3d9 Compare October 18, 2025 12:25
@hjmjohnson hjmjohnson changed the title STYLE: Remove testing for impossible situation STYLE: Increase code coverage, make intent clear Oct 18, 2025
Copy link

@SimonRit SimonRit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Improved readability and make the intent of searching for
clusters more transparent.

As a side effect, the code coverage now is at 100% in the
default case where clusters are found.
@hjmjohnson hjmjohnson force-pushed the improve-code-coverage branch from 782a3d9 to ae049cd Compare October 20, 2025 15:54
@github-actions github-actions bot added the type:Coverage Code coverage impacts label Oct 20, 2025
@hjmjohnson hjmjohnson requested a review from dzenanz October 20, 2025 15:55
@hjmjohnson hjmjohnson merged commit 86db0e6 into main Oct 20, 2025
17 checks passed
@hjmjohnson hjmjohnson deleted the improve-code-coverage branch October 20, 2025 20:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:Filtering Issues affecting the Filtering module area:Segmentation Issues affecting the Segmentation module type:Coverage Code coverage impacts type:Style Style changes: no logic impact (indentation, comments, naming)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants