forked from github/codeql
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommentedCode.js
More file actions
145 lines (113 loc) · 2.14 KB
/
commentedCode.js
File metadata and controls
145 lines (113 loc) · 2.14 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
/**
* @return {String}
*/
function sayHello() {
/*
this line is fine, but the following is not
if (something) {
*/
// the following line is not ok
// if (something) {
// and neither are the following lines
// if (x) {
// alert("Hi");
// }
// // commented-out comments are bad
/*// commented-out comments are bad*/
/* // commented-out comments are bad*/
// /// commented-out comments are bad //
/*//// commented-out comments are bad */
/* /// commented-out comments are bad */
//// this is not a commented-out comment
// and neither is this http://www.example.com
// nor is this //
/*
* This comment is fine, since it contains an explicit "code" block.
*
* <code>
* {
* f();
* g();
* h();
* k();
* if (x) {
* m();
* }
* }
* </code>
*/
/*
* This comment is fine, since it contains an explicit "pre" block.
*
* <pre>
* {
* f();
* g();
* h();
* k();
* if (x) {
* m();
* }
* }
* </pre>
*/
/*
* This comment is fine, since it contains an explicit "example" tag.
*
* @example
* {
* f();
* g();
* h();
* k();
* if (x) {
* m();
* }
* }
*/
// good
// ====
// ----
// ++++
/** @type {!String} */
/*
* This comment is fine, since it contains a Markdown code block.
*
* ```
* {
* f();
* g();
* h();
* k();
* if (x) {
* m();
* }
* }
* ```
*/
}
/** @private {(int|boolean)} */
var x;
/** @private {*} */
var y;
/** @type {function(this: !A, ?string=, int[]) : Object.<string, int>} */
var z;
/** @typedef {{msg: string}} */
var MessageContainer;
/** @type {$tp} */
var foo;
var empty = ""; //$NON-NLS-1$
var alsoEmpty = "" + ""; //$NON-NLS-1$ //$NON-NLS-2$
/*: type foo = number; */
/*::
* type foo = number;
* type bar = string; */
/* flow-include type foo = number; */
/** @type {!./ampdoc-impl.AmpDoc} */
var ampdoc;
// something like this: { foo, bar }
//alert("reached here yo");
// false positive:
// scale to {0, 255}
// false negative:
// if(x instanceof Array) {