Potential fix for code scanning alert no. 11: Unused import#164
Merged
Conversation
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #164 +/- ##
=======================================
Coverage 66.34% 66.34%
=======================================
Files 33 33
Lines 4627 4627
Branches 1608 1608
=======================================
Hits 3070 3070
Misses 637 637
Partials 920 920 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR addresses CodeQL code scanning alert #11 (“Unused import”) in the Python test suite by removing an unused pytest import while keeping the test behavior unchanged.
Changes:
- Removed the unused
markname fromfrom pytest import approx, raises, mark. - Kept
approxandraises, which are used in the file.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Potential fix for https://github.com/dftd3/simple-dftd3/security/code-scanning/11
To fix an unused import, remove the unused name from the import statement (or delete the whole import if none of its names are used). This reduces unnecessary dependencies and keeps the module clean.
In this file, the problematic line is
from pytest import approx, raises, mark. According to CodeQL, onlymarkis unused. The best minimal fix that preserves all existing functionality is to keepapproxandraises(which are presumably used elsewhere in the file) and dropmarkfrom the import list. No other changes are required.Concretely:
python/dftd3/test_interface.py, at line 28, changefrom pytest import approx, raises, marktofrom pytest import approx, raises.Suggested fixes powered by Copilot Autofix. Review carefully before merging.