-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Java: Add new quality query to detect empty methods #18947
base: main
Are you sure you want to change the base?
Conversation
/** | ||
* Represents a likely a test method, which is either a method that is already | ||
* recognized as a `TestMethod` or something that is likely a JUnit test or | ||
* something in the expected test path for Java tests. | ||
*/ |
Check warning
Code scanning / CodeQL
Class QLDoc style. Warning
( | ||
this.getName().matches("JUnit%") or | ||
this.getName().matches("test%") or | ||
this.getAnAnnotation().toString().matches("%Test") |
Check warning
Code scanning / CodeQL
Using 'toString' in query logic Warning
/** | ||
* Maven surefire patterns to consider which files are testcases: | ||
* https://maven.apache.org/surefire/maven-surefire-plugin/examples/inclusion-exclusion.html | ||
*/ |
Check warning
Code scanning / CodeQL
Class QLDoc style. Warning
//permit comment lines explaining why this is empty | ||
m.getNumberOfCommentLines() = 0 and | ||
//permit a javadoc above as well as sufficient reason to leave empty | ||
not exists(Javadoc jd | m.getDoc().getJavadoc() = jd) and |
Check warning
Code scanning / CodeQL
Expression can be replaced with a cast Warning
This query is migrated from the advance security team's quality queries.
The initial version was somewhat modified to report fewer alerts. The changes reduce the alert count in MRVA top 100 from 16800 to 3800.