-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathUndocumentedParameter.ql
More file actions
27 lines (25 loc) · 957 Bytes
/
UndocumentedParameter.ql
File metadata and controls
27 lines (25 loc) · 957 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/**
* @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."