mirror of
https://github.com/github/codeql.git
synced 2026-01-15 07:24:49 +01:00
These queries are currently run by default, but don't have their results displayed. Looking through results on LGTM.com, they are either false positives (e.g., `BitwiseSignCheck` which flags many perfectly harmless operations and `CompareIdenticalValues` which mostly flags NaN checks) or harmless results that developers are unlikely to care about (e.g., `EmptyArrayInit` or `MisspelledIdentifier`). With this PR, the only queries that are still run but not displayed are security queries, where different considerations may apply.
28 lines
994 B
Plaintext
28 lines
994 B
Plaintext
/**
|
|
* @name JSDoc tag for non-existent parameter
|
|
* @description A JSDoc 'param' tag that refers to a non-existent parameter is confusing
|
|
* and may indicate badly maintained code.
|
|
* @kind problem
|
|
* @problem.severity recommendation
|
|
* @id js/jsdoc/unknown-parameter
|
|
* @tags maintainability
|
|
* readability
|
|
* documentation
|
|
* @precision low
|
|
*/
|
|
|
|
import javascript
|
|
|
|
from Function f, JSDoc doc, JSDocParamTag tag, string parmName
|
|
where
|
|
doc = f.getDocumentation() and
|
|
tag = doc.getATag() and
|
|
parmName = tag.getName() and
|
|
tag.documentsSimpleName() and
|
|
not exists(f.getParameterByName(parmName)) and
|
|
// don't report functions without declared parameters that use `arguments`
|
|
not (f.getNumParameter() = 0 and f.usesArgumentsObject()) and
|
|
// don't report a violation in ambiguous cases
|
|
strictcount(JSDoc d | d = f.getDocumentation() and d.getATag() instanceof JSDocParamTag) = 1
|
|
select tag, "@param tag refers to non-existent parameter " + parmName + "."
|