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: apply bandit checks #387

Merged

Conversation

kenibrewer
Copy link
Member

@kenibrewer kenibrewer commented Mar 30, 2024

Description

This PR is intended to be merged after #386 .
It enables the bandit set of linting checks for the repository along with making some of the needed fixes. As my main priority with these changes is to ensure the full set of planned linting checks are in place for new development efforts, some path and line-based ignores have been applied.
In addition, this PR also in a slight decrease in test coverage. However, because none of the replaced assert statements were triggered in previous test cases this is a coverage decrease in form but not function. As such, I propose merging this PR with the improvements already present, and tackle the missing coverage during the planned post-core refactor.

Note: For review purposes this is currently targeting the branch cytomining:ci/update-ruff-to-0.3.4. It will be switched to target main after that branch is merged.

What is the nature of your change?

  • Bug fix (fixes an issue).
  • Enhancement (adds functionality).
  • Breaking change (fix or feature that would cause existing functionality to not work as expected).
  • This change requires a documentation update.

Checklist

Please ensure that all boxes are checked before indicating that a pull request is ready for review.

  • I have read the CONTRIBUTING.md guidelines.
  • My code follows the style guidelines of this project.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • My changes generate no new warnings.
  • New and existing unit tests pass locally with my changes.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have deleted all non-relevant text in this pull request template.

@kenibrewer kenibrewer force-pushed the refactor/apply-bandit-checks-and-fixes branch from 1aa12e2 to 071fa1c Compare March 30, 2024 01:38
@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 92.68293% with 9 lines in your changes are missing coverage. Please review.

Project coverage is 94.72%. Comparing base (af5a4ef) to head (071fa1c).
Report is 2 commits behind head on main.

Files Patch % Lines
pycytominer/feature_select.py 50.00% 2 Missing ⚠️
pycytominer/operations/variance_threshold.py 50.00% 2 Missing ⚠️
pycytominer/annotate.py 50.00% 1 Missing ⚠️
pycytominer/cyto_utils/collate.py 0.00% 1 Missing ⚠️
pycytominer/normalize.py 50.00% 1 Missing ⚠️
pycytominer/operations/correlation_threshold.py 50.00% 1 Missing ⚠️
pycytominer/operations/transform.py 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #387      +/-   ##
==========================================
- Coverage   94.96%   94.72%   -0.24%     
==========================================
  Files          56       56              
  Lines        3137     3147      +10     
==========================================
+ Hits         2979     2981       +2     
- Misses        158      166       +8     
Flag Coverage Δ
unittests 94.72% <92.68%> (-0.24%) ⬇️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@kenibrewer kenibrewer changed the base branch from main to ci/update-ruff-to-0.3.4 March 30, 2024 19:42
@kenibrewer kenibrewer marked this pull request as ready for review March 30, 2024 19:44
@kenibrewer kenibrewer requested a review from d33bs March 30, 2024 19:51
Copy link
Member

@d33bs d33bs left a comment

Choose a reason for hiding this comment

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

Good work, glad to see these changes applied! I left a minor comment about the ignore rules / noqa. In addition, if it's not already in place, consider adding an issue (or two) to help address ruff ignores for S108 and S603 at a later point. Generally, I feel these are distinct and important enough to warrant their own issues / PR's (as noqa's may become ignored / invisible on their own).

Please don't hesitate to let me know if you have any questions.

pyproject.toml Outdated Show resolved Hide resolved
@kenibrewer kenibrewer changed the base branch from ci/update-ruff-to-0.3.4 to main April 1, 2024 21:25
@kenibrewer kenibrewer merged commit 3286270 into cytomining:main Apr 2, 2024
11 checks passed
@kenibrewer kenibrewer deleted the refactor/apply-bandit-checks-and-fixes branch April 2, 2024 21:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants