Files
codeql/javascript/ql/src/JSDoc/UndocumentedParameter.ql
Max Schaefer a803120414 Lower precision for a number of queries.
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.
2020-05-19 13:43:17 +01:00

28 lines
957 B
Plaintext

/**
* @name Undocumented parameter
* @description If some parameters of a function are documented by JSDoc 'param' tags while others
* are not, this may indicate badly maintained code.
* @kind problem
* @problem.severity recommendation
* @id js/jsdoc/missing-parameter
* @tags maintainability
* readability
* documentation
* @precision low
*/
import javascript
from Function f, Parameter parm, Variable v, JSDoc doc
where
parm = f.getAParameter() and
doc = f.getDocumentation() and
v = parm.getAVariable() and
// at least one parameter is documented
exists(doc.getATag().(JSDocParamTag).getDocumentedParameter()) and
// but v is not
not doc.getATag().(JSDocParamTag).getDocumentedParameter() = v and
// don't report an alert in ambiguous cases
strictcount(JSDoc d | d = f.getDocumentation() and d.getATag() instanceof JSDocParamTag) = 1
select parm, "Parameter " + v.getName() + " is not documented."