You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* To use this message you should provide a comment on each line of the source file where you expect an issue.
66
+
* For example:
67
+
* <pre>
68
+
* var x = 1; // Noncompliant {{A message for this line.}}
69
+
*
70
+
* function foo() { // Noncompliant [[effortToFix=2]] [[secondary=+0,+1]] [[sc=5;ec=6;el=+0]]
71
+
* }
72
+
* </pre>
73
+
* How to write these comments:
74
+
* <ul>
75
+
* <li>Put a comment starting with "Noncompliant" if you expect an issue on this line.</li>
76
+
* <li>In double curly braces <code>{{MESSAGE}}</code> provide expected message.</li>
77
+
* <li>In double brackets provide expected effort to fix (cost) with <code>effortToFix</code> keyword.</li>
78
+
* <li>In double brackets provide precise location description with <code>sc, ec, el</code> keywords respectively for start column, end column and end line.</li>
79
+
* <li>In double brackets provide secondary locations with <code>secondary</code> keyword.</li>
80
+
* <li>To specify the line you can use relative location by putting <code>+</code> or <code>-</code>.</li>
81
+
* <li>All listed elements are optional (except "Noncompliant").</li>
thrownewAssertionError("Unexpected issue at line " + line(actual) + ": \"" + message(actual) + "\"");
85
123
}
86
124
if (expected.message() != null) {
87
-
Assertions.assertThat(message(actual)).as("Bad message at line " + expected.line()).isEqualTo(expected.message());
125
+
assertThat(message(actual)).as("Bad message at line " + expected.line()).isEqualTo(expected.message());
88
126
}
89
127
if (expected.effortToFix() != null) {
90
-
Assertions.assertThat(actual.cost()).as("Bad effortToFix at line " + expected.line()).isEqualTo(expected.effortToFix());
128
+
assertThat(actual.cost()).as("Bad effortToFix at line " + expected.line()).isEqualTo(expected.effortToFix());
91
129
}
92
130
if (expected.startColumn() != null) {
93
-
Assertions.assertThat(((PreciseIssue) actual).primaryLocation().startLineOffset() + 1).as("Bad start column at line " + expected.line()).isEqualTo(expected.startColumn());
131
+
assertThat(((PreciseIssue) actual).primaryLocation().startLineOffset() + 1).as("Bad start column at line " + expected.line()).isEqualTo(expected.startColumn());
94
132
}
95
133
if (expected.endColumn() != null) {
96
-
Assertions.assertThat(((PreciseIssue) actual).primaryLocation().endLineOffset() + 1).as("Bad end column at line " + expected.line()).isEqualTo(expected.endColumn());
134
+
assertThat(((PreciseIssue) actual).primaryLocation().endLineOffset() + 1).as("Bad end column at line " + expected.line()).isEqualTo(expected.endColumn());
97
135
}
98
136
if (expected.endLine() != null) {
99
-
Assertions.assertThat(((PreciseIssue) actual).primaryLocation().endLine()).as("Bad end line at line " + expected.line()).isEqualTo(expected.endLine());
137
+
assertThat(((PreciseIssue) actual).primaryLocation().endLine()).as("Bad end line at line " + expected.line()).isEqualTo(expected.endLine());
100
138
}
101
139
if (expected.secondaryLines() != null) {
102
-
Assertions.assertThat(secondary(actual)).as("Bad secondary locations at line " + expected.line()).isEqualTo(expected.secondaryLines());
140
+
assertThat(secondary(actual)).as("Bad secondary locations at line " + expected.line()).isEqualTo(expected.secondaryLines());
103
141
}
104
142
}
105
143
@@ -137,7 +175,7 @@ public void visitNode(Tree tree) {
Copy file name to clipboardExpand all lines: javascript-checks-testkit/src/test/java/org/sonar/javascript/checks/verifier/JavaScriptCheckVerifierTest.java
+1-4Lines changed: 1 addition & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -17,7 +17,7 @@
17
17
* along with this program; if not, write to the Free Software Foundation,
18
18
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
0 commit comments