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

Add intelligence to the assert rule to reduce results on test files #638

Closed
ericwb opened this issue Oct 14, 2024 · 0 comments · Fixed by #639
Closed

Add intelligence to the assert rule to reduce results on test files #638

ericwb opened this issue Oct 14, 2024 · 0 comments · Fixed by #639
Labels
enhancement New feature or request

Comments

@ericwb
Copy link
Contributor

ericwb commented Oct 14, 2024

Is your feature request related to a problem? Please describe.
The assert rule shows lots of results if it happens to scan a directory designed for unit tests, especially if using PyTest.

Describe the solution you'd like
Add more intelligence to the assert rule such that it inspects the scope to know if the assert is within a class of pattern "Test" or "Test", or alternatively in a function "test_".

And ideally there should be a way to configure these default settings. So a parent feature might be to implement an extensive configuration mechanism.

Describe alternatives you've considered
n/a

Additional context
n/a

Love this idea? Give it a 👍. We prioritize fulfilling features with the most 👍.

@ericwb ericwb added the enhancement New feature or request label Oct 14, 2024
ericwb added a commit to ericwb/precli that referenced this issue Oct 14, 2024
For several Python test frameworks, the assert builtin is
required to validate the test. Precli should avoid showing
results for this condition since this isn't the use case
the rule is trying to find.

Fixes: securesauce#638

Signed-off-by: Eric Brown <eric.brown@securesauce.dev>
@ericwb ericwb closed this as completed in ab60ca2 Oct 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant