-
Notifications
You must be signed in to change notification settings - Fork 227
[pylint] Test No Secrets #13476
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
[pylint] Test No Secrets #13476
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds a new pylint checker DoNotStoreSecretsInTestVariables (C4773) to prevent storing secrets in variables within test files, encouraging developers to use secrets directly in function calls instead.
Key Changes:
- Implements the new checker class with logic to detect secret assignments and usage in test files
- Adds comprehensive test coverage for the new checker
- Updates documentation to reflect the new C4773 rule
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
pylint_guidelines_checker.py |
Implements the DoNotStoreSecretsInTestVariables checker class (C4773) that detects when secrets are assigned to variables in test files and flags both the assignment and usage |
test_pylint_custom_plugins.py |
Adds comprehensive test cases covering secret assignments, multiple secrets, different contexts (if/for), direct usage, and non-test file scenarios |
test_do_not_store_secrets_in_test_variables.py |
Provides test data with mock classes and functions demonstrating both problematic patterns (storing secrets in variables) and correct patterns (direct secret usage) |
README.md |
Updates documentation range to C4717-C4773 and adds the new rule entry with description, disable command, guideline link, and example reference |
__init__.py |
Replaces external imports with local class definitions to improve test isolation |
tools/pylint-extensions/azure-pylint-guidelines-checker/pylint_guidelines_checker.py
Outdated
Show resolved
Hide resolved
tools/pylint-extensions/azure-pylint-guidelines-checker/pylint_guidelines_checker.py
Outdated
Show resolved
Hide resolved
...re-pylint-guidelines-checker/tests/test_files/test_do_not_store_secrets_in_test_variables.py
Show resolved
Hide resolved
tools/pylint-extensions/azure-pylint-guidelines-checker/pylint_guidelines_checker.py
Outdated
Show resolved
Hide resolved
tools/pylint-extensions/azure-pylint-guidelines-checker/pylint_guidelines_checker.py
Outdated
Show resolved
Hide resolved
tools/pylint-extensions/azure-pylint-guidelines-checker/pylint_guidelines_checker.py
Show resolved
Hide resolved
tools/pylint-extensions/azure-pylint-guidelines-checker/tests/test_pylint_custom_plugins.py
Show resolved
Hide resolved
iscai-msft
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
have you any wool
Uh oh!
There was an error while loading. Please reload this page.