@@ -7,7 +7,6 @@ namespace StyleCop.Analyzers.Test.MaintainabilityRules
77 using System . Threading . Tasks ;
88 using Microsoft . CodeAnalysis . Testing ;
99 using StyleCop . Analyzers . MaintainabilityRules ;
10- using TestHelper ;
1110 using Xunit ;
1211 using static StyleCop . Analyzers . Test . Verifiers . StyleCopCodeFixVerifier <
1312 StyleCop . Analyzers . MaintainabilityRules . SA1119StatementMustNotUseUnnecessaryParenthesis ,
@@ -44,7 +43,7 @@ public void Bar()
4443
4544 DiagnosticResult [ ] expected =
4645 {
47- Diagnostic ( DiagnosticId ) . WithLocation ( 5 , 17 ) ,
46+ Diagnostic ( DiagnosticId ) . WithSpan ( 5 , 17 , 5 , 20 ) ,
4847 Diagnostic ( ParenthesesDiagnosticId ) . WithLocation ( 5 , 17 ) ,
4948 Diagnostic ( ParenthesesDiagnosticId ) . WithLocation ( 5 , 19 ) ,
5049 } ;
@@ -72,9 +71,9 @@ public void Bar()
7271
7372 DiagnosticResult [ ] expected =
7473 {
75- Diagnostic ( DiagnosticId ) . WithLocation ( 5 , 17 ) ,
74+ Diagnostic ( DiagnosticId ) . WithSpan ( 5 , 17 , 5 , 22 ) ,
7675 Diagnostic ( ParenthesesDiagnosticId ) . WithLocation ( 5 , 17 ) ,
77- Diagnostic ( DiagnosticId ) . WithLocation ( 5 , 18 ) ,
76+ Diagnostic ( DiagnosticId ) . WithSpan ( 5 , 18 , 5 , 21 ) ,
7877 Diagnostic ( ParenthesesDiagnosticId ) . WithLocation ( 5 , 18 ) ,
7978 Diagnostic ( ParenthesesDiagnosticId ) . WithLocation ( 5 , 20 ) ,
8079 Diagnostic ( ParenthesesDiagnosticId ) . WithLocation ( 5 , 21 ) ,
@@ -116,7 +115,7 @@ public void Bar()
116115
117116 DiagnosticResult [ ] expected =
118117 {
119- Diagnostic ( DiagnosticId ) . WithLocation ( 5 , 20 ) ,
118+ Diagnostic ( DiagnosticId ) . WithSpan ( 5 , 20 , 5 , 32 ) ,
120119 Diagnostic ( ParenthesesDiagnosticId ) . WithLocation ( 5 , 20 ) ,
121120 Diagnostic ( ParenthesesDiagnosticId ) . WithLocation ( 5 , 31 ) ,
122121 } ;
@@ -158,10 +157,10 @@ public void Bar()
158157}" ;
159158 DiagnosticResult [ ] expected =
160159 {
161- Diagnostic ( DiagnosticId ) . WithLocation ( 6 , 20 ) ,
160+ Diagnostic ( DiagnosticId ) . WithSpan ( 6 , 20 , 6 , 27 ) ,
162161 Diagnostic ( ParenthesesDiagnosticId ) . WithLocation ( 6 , 20 ) ,
163162 Diagnostic ( ParenthesesDiagnosticId ) . WithLocation ( 6 , 26 ) ,
164- Diagnostic ( DiagnosticId ) . WithLocation ( 6 , 55 ) ,
163+ Diagnostic ( DiagnosticId ) . WithSpan ( 6 , 55 , 6 , 60 ) ,
165164 Diagnostic ( ParenthesesDiagnosticId ) . WithLocation ( 6 , 55 ) ,
166165 Diagnostic ( ParenthesesDiagnosticId ) . WithLocation ( 6 , 59 ) ,
167166 } ;
@@ -205,7 +204,7 @@ public void Bar()
205204
206205 DiagnosticResult [ ] expected =
207206 {
208- Diagnostic ( DiagnosticId ) . WithLocation ( 6 , 9 ) ,
207+ Diagnostic ( DiagnosticId ) . WithSpan ( 6 , 9 , 6 , 21 ) ,
209208 Diagnostic ( ParenthesesDiagnosticId ) . WithLocation ( 6 , 9 ) ,
210209 Diagnostic ( ParenthesesDiagnosticId ) . WithLocation ( 6 , 20 ) ,
211210 } ;
@@ -234,7 +233,7 @@ public void Bar()
234233}" ;
235234 DiagnosticResult [ ] expected =
236235 {
237- Diagnostic ( DiagnosticId ) . WithLocation ( 6 , 17 ) ,
236+ Diagnostic ( DiagnosticId ) . WithSpan ( 6 , 17 , 6 , 24 ) ,
238237 Diagnostic ( ParenthesesDiagnosticId ) . WithLocation ( 6 , 17 ) ,
239238 Diagnostic ( ParenthesesDiagnosticId ) . WithLocation ( 6 , 23 ) ,
240239 } ;
@@ -276,7 +275,7 @@ public void Bar()
276275
277276 DiagnosticResult [ ] expected =
278277 {
279- Diagnostic ( DiagnosticId ) . WithLocation ( 5 , 17 ) ,
278+ Diagnostic ( DiagnosticId ) . WithSpan ( 5 , 17 , 5 , 25 ) ,
280279 Diagnostic ( ParenthesesDiagnosticId ) . WithLocation ( 5 , 17 ) ,
281280 Diagnostic ( ParenthesesDiagnosticId ) . WithLocation ( 5 , 24 ) ,
282281 } ;
@@ -318,7 +317,7 @@ public void Bar()
318317}" ;
319318 DiagnosticResult [ ] expected =
320319 {
321- Diagnostic ( DiagnosticId ) . WithLocation ( 6 , 13 ) ,
320+ Diagnostic ( DiagnosticId ) . WithSpan ( 6 , 13 , 6 , 21 ) ,
322321 Diagnostic ( ParenthesesDiagnosticId ) . WithLocation ( 6 , 13 ) ,
323322 Diagnostic ( ParenthesesDiagnosticId ) . WithLocation ( 6 , 20 ) ,
324323 } ;
@@ -398,22 +397,22 @@ public void Bar()
398397}" ;
399398 DiagnosticResult [ ] expected =
400399 {
401- Diagnostic ( DiagnosticId ) . WithLocation ( 6 , 13 ) ,
400+ Diagnostic ( DiagnosticId ) . WithSpan ( 6 , 13 , 6 , 18 ) ,
402401 Diagnostic ( ParenthesesDiagnosticId ) . WithLocation ( 6 , 13 ) ,
403402 Diagnostic ( ParenthesesDiagnosticId ) . WithLocation ( 6 , 17 ) ,
404- Diagnostic ( DiagnosticId ) . WithLocation ( 7 , 13 ) ,
403+ Diagnostic ( DiagnosticId ) . WithSpan ( 7 , 13 , 7 , 18 ) ,
405404 Diagnostic ( ParenthesesDiagnosticId ) . WithLocation ( 7 , 13 ) ,
406405 Diagnostic ( ParenthesesDiagnosticId ) . WithLocation ( 7 , 17 ) ,
407- Diagnostic ( DiagnosticId ) . WithLocation ( 8 , 13 ) ,
406+ Diagnostic ( DiagnosticId ) . WithSpan ( 8 , 13 , 8 , 18 ) ,
408407 Diagnostic ( ParenthesesDiagnosticId ) . WithLocation ( 8 , 13 ) ,
409408 Diagnostic ( ParenthesesDiagnosticId ) . WithLocation ( 8 , 17 ) ,
410- Diagnostic ( DiagnosticId ) . WithLocation ( 9 , 13 ) ,
409+ Diagnostic ( DiagnosticId ) . WithSpan ( 9 , 13 , 9 , 17 ) ,
411410 Diagnostic ( ParenthesesDiagnosticId ) . WithLocation ( 9 , 13 ) ,
412411 Diagnostic ( ParenthesesDiagnosticId ) . WithLocation ( 9 , 16 ) ,
413- Diagnostic ( DiagnosticId ) . WithLocation ( 10 , 13 ) ,
412+ Diagnostic ( DiagnosticId ) . WithSpan ( 10 , 13 , 10 , 17 ) ,
414413 Diagnostic ( ParenthesesDiagnosticId ) . WithLocation ( 10 , 13 ) ,
415414 Diagnostic ( ParenthesesDiagnosticId ) . WithLocation ( 10 , 16 ) ,
416- Diagnostic ( DiagnosticId ) . WithLocation ( 11 , 13 ) ,
415+ Diagnostic ( DiagnosticId ) . WithSpan ( 11 , 13 , 11 , 17 ) ,
417416 Diagnostic ( ParenthesesDiagnosticId ) . WithLocation ( 11 , 13 ) ,
418417 Diagnostic ( ParenthesesDiagnosticId ) . WithLocation ( 11 , 16 ) ,
419418 } ;
@@ -462,10 +461,10 @@ public void Bar()
462461
463462 DiagnosticResult [ ] expected =
464463 {
465- Diagnostic ( DiagnosticId ) . WithLocation ( 5 , 21 ) ,
464+ Diagnostic ( DiagnosticId ) . WithSpan ( 5 , 21 , 5 , 33 ) ,
466465 Diagnostic ( ParenthesesDiagnosticId ) . WithLocation ( 5 , 21 ) ,
467466 Diagnostic ( ParenthesesDiagnosticId ) . WithLocation ( 5 , 32 ) ,
468- Diagnostic ( DiagnosticId ) . WithLocation ( 6 , 17 ) ,
467+ Diagnostic ( DiagnosticId ) . WithSpan ( 6 , 17 , 6 , 31 ) ,
469468 Diagnostic ( ParenthesesDiagnosticId ) . WithLocation ( 6 , 17 ) ,
470469 Diagnostic ( ParenthesesDiagnosticId ) . WithLocation ( 6 , 30 ) ,
471470 } ;
@@ -506,7 +505,7 @@ public void Bar()
506505}" ;
507506 DiagnosticResult [ ] expected =
508507 {
509- Diagnostic ( DiagnosticId ) . WithLocation ( 5 , 20 ) ,
508+ Diagnostic ( DiagnosticId ) . WithSpan ( 5 , 20 , 5 , 33 ) ,
510509 Diagnostic ( ParenthesesDiagnosticId ) . WithLocation ( 5 , 20 ) ,
511510 Diagnostic ( ParenthesesDiagnosticId ) . WithLocation ( 5 , 32 ) ,
512511 } ;
@@ -560,10 +559,10 @@ public void Bar()
560559}" ;
561560 DiagnosticResult [ ] expected =
562561 {
563- Diagnostic ( DiagnosticId ) . WithLocation ( 5 , 18 ) ,
562+ Diagnostic ( DiagnosticId ) . WithSpan ( 5 , 18 , 5 , 32 ) ,
564563 Diagnostic ( ParenthesesDiagnosticId ) . WithLocation ( 5 , 18 ) ,
565564 Diagnostic ( ParenthesesDiagnosticId ) . WithLocation ( 5 , 31 ) ,
566- Diagnostic ( DiagnosticId ) . WithLocation ( 6 , 13 ) ,
565+ Diagnostic ( DiagnosticId ) . WithSpan ( 6 , 13 , 6 , 27 ) ,
567566 Diagnostic ( ParenthesesDiagnosticId ) . WithLocation ( 6 , 13 ) ,
568567 Diagnostic ( ParenthesesDiagnosticId ) . WithLocation ( 6 , 26 ) ,
569568 } ;
@@ -606,7 +605,7 @@ public void Bar()
606605}" ;
607606 DiagnosticResult [ ] expected =
608607 {
609- Diagnostic ( DiagnosticId ) . WithLocation ( 6 , 20 ) ,
608+ Diagnostic ( DiagnosticId ) . WithSpan ( 6 , 20 , 6 , 31 ) ,
610609 Diagnostic ( ParenthesesDiagnosticId ) . WithLocation ( 6 , 20 ) ,
611610 Diagnostic ( ParenthesesDiagnosticId ) . WithLocation ( 6 , 30 ) ,
612611 } ;
@@ -662,7 +661,7 @@ public void Bar()
662661}" ;
663662 DiagnosticResult [ ] expected =
664663 {
665- Diagnostic ( DiagnosticId ) . WithLocation ( 5 , 20 ) ,
664+ Diagnostic ( DiagnosticId ) . WithSpan ( 5 , 20 , 5 , 42 ) ,
666665 Diagnostic ( ParenthesesDiagnosticId ) . WithLocation ( 5 , 20 ) ,
667666 Diagnostic ( ParenthesesDiagnosticId ) . WithLocation ( 5 , 41 ) ,
668667 } ;
@@ -716,7 +715,7 @@ public void Bar()
716715}" ;
717716 DiagnosticResult [ ] expected =
718717 {
719- Diagnostic ( DiagnosticId ) . WithLocation ( 5 , 20 ) ,
718+ Diagnostic ( DiagnosticId ) . WithSpan ( 5 , 20 , 5 , 36 ) ,
720719 Diagnostic ( ParenthesesDiagnosticId ) . WithLocation ( 5 , 20 ) ,
721720 Diagnostic ( ParenthesesDiagnosticId ) . WithLocation ( 5 , 35 ) ,
722721 } ;
@@ -772,10 +771,10 @@ public void Bar()
772771}" ;
773772 DiagnosticResult [ ] expected =
774773 {
775- Diagnostic ( DiagnosticId ) . WithLocation ( 5 , 41 ) ,
774+ Diagnostic ( DiagnosticId ) . WithSpan ( 5 , 41 , 5 , 49 ) ,
776775 Diagnostic ( ParenthesesDiagnosticId ) . WithLocation ( 5 , 41 ) ,
777776 Diagnostic ( ParenthesesDiagnosticId ) . WithLocation ( 5 , 48 ) ,
778- Diagnostic ( DiagnosticId ) . WithLocation ( 6 , 41 ) ,
777+ Diagnostic ( DiagnosticId ) . WithSpan ( 6 , 41 , 6 , 51 ) ,
779778 Diagnostic ( ParenthesesDiagnosticId ) . WithLocation ( 6 , 41 ) ,
780779 Diagnostic ( ParenthesesDiagnosticId ) . WithLocation ( 6 , 50 ) ,
781780 } ;
@@ -830,7 +829,7 @@ public void Bar()
830829}" ;
831830 DiagnosticResult [ ] expected =
832831 {
833- Diagnostic ( DiagnosticId ) . WithLocation ( 5 , 19 ) ,
832+ Diagnostic ( DiagnosticId ) . WithSpan ( 5 , 19 , 5 , 32 ) ,
834833 Diagnostic ( ParenthesesDiagnosticId ) . WithLocation ( 5 , 19 ) ,
835834 Diagnostic ( ParenthesesDiagnosticId ) . WithLocation ( 5 , 31 ) ,
836835 } ;
@@ -885,7 +884,7 @@ public void Bar()
885884}" ;
886885 DiagnosticResult [ ] expected =
887886 {
888- Diagnostic ( DiagnosticId ) . WithLocation ( 6 , 17 ) ,
887+ Diagnostic ( DiagnosticId ) . WithSpan ( 6 , 17 , 6 , 53 ) ,
889888 Diagnostic ( ParenthesesDiagnosticId ) . WithLocation ( 6 , 17 ) ,
890889 Diagnostic ( ParenthesesDiagnosticId ) . WithLocation ( 6 , 52 ) ,
891890 } ;
@@ -972,7 +971,7 @@ private bool Test()
972971}" ;
973972 DiagnosticResult [ ] expected =
974973 {
975- Diagnostic ( DiagnosticId ) . WithLocation ( 6 , 20 ) ,
974+ Diagnostic ( DiagnosticId ) . WithSpan ( 6 , 20 , 10 , 18 ) ,
976975 Diagnostic ( ParenthesesDiagnosticId ) . WithLocation ( 6 , 20 ) ,
977976 Diagnostic ( ParenthesesDiagnosticId ) . WithLocation ( 10 , 17 ) ,
978977 } ;
@@ -992,7 +991,7 @@ public async Task TestCodeFixWorksInTriviaAsync()
992991
993992 DiagnosticResult [ ] expected =
994993 {
995- Diagnostic ( DiagnosticId ) . WithLocation ( 1 , 5 ) ,
994+ Diagnostic ( DiagnosticId ) . WithSpan ( 1 , 5 , 1 , 21 ) ,
996995 Diagnostic ( ParenthesesDiagnosticId ) . WithLocation ( 1 , 5 ) ,
997996 Diagnostic ( ParenthesesDiagnosticId ) . WithLocation ( 1 , 20 ) ,
998997 } ;
@@ -1013,7 +1012,7 @@ public string Bar()
10131012}" ;
10141013 DiagnosticResult [ ] expected =
10151014 {
1016- Diagnostic ( DiagnosticId ) . WithLocation ( 6 , 15 ) ,
1015+ Diagnostic ( DiagnosticId ) . WithSpan ( 6 , 15 , 6 , 20 ) ,
10171016 Diagnostic ( ParenthesesDiagnosticId ) . WithLocation ( 6 , 15 ) ,
10181017 Diagnostic ( ParenthesesDiagnosticId ) . WithLocation ( 6 , 19 ) ,
10191018 } ;
@@ -1043,7 +1042,7 @@ public void Bar()
10431042}" ;
10441043 DiagnosticResult [ ] expected =
10451044 {
1046- Diagnostic ( DiagnosticId ) . WithLocation ( 6 , 26 ) ,
1045+ Diagnostic ( DiagnosticId ) . WithSpan ( 6 , 26 , 6 , 32 ) ,
10471046 Diagnostic ( ParenthesesDiagnosticId ) . WithLocation ( 6 , 26 ) ,
10481047 Diagnostic ( ParenthesesDiagnosticId ) . WithLocation ( 6 , 31 ) ,
10491048 } ;
@@ -1108,7 +1107,7 @@ public string Bar()
11081107
11091108 DiagnosticResult [ ] expected =
11101109 {
1111- Diagnostic ( DiagnosticId ) . WithLocation ( 6 , 20 ) ,
1110+ Diagnostic ( DiagnosticId ) . WithSpan ( 6 , 20 , 6 , 35 ) ,
11121111 Diagnostic ( ParenthesesDiagnosticId ) . WithLocation ( 6 , 20 ) ,
11131112 Diagnostic ( ParenthesesDiagnosticId ) . WithLocation ( 6 , 34 ) ,
11141113 } ;
@@ -1191,7 +1190,7 @@ public void Bar()
11911190}" ;
11921191 DiagnosticResult [ ] expected =
11931192 {
1194- Diagnostic ( DiagnosticId ) . WithLocation ( 6 , 23 ) ,
1193+ Diagnostic ( DiagnosticId ) . WithSpan ( 6 , 23 , 6 , 43 ) ,
11951194 Diagnostic ( ParenthesesDiagnosticId ) . WithLocation ( 6 , 23 ) ,
11961195 Diagnostic ( ParenthesesDiagnosticId ) . WithLocation ( 6 , 42 ) ,
11971196 } ;
@@ -1251,7 +1250,7 @@ public void Bar()
12511250}" ;
12521251 DiagnosticResult [ ] expected =
12531252 {
1254- Diagnostic ( DiagnosticId ) . WithLocation ( 6 , 22 ) ,
1253+ Diagnostic ( DiagnosticId ) . WithSpan ( 6 , 22 , 6 , 36 ) ,
12551254 Diagnostic ( ParenthesesDiagnosticId ) . WithLocation ( 6 , 22 ) ,
12561255 Diagnostic ( ParenthesesDiagnosticId ) . WithLocation ( 6 , 35 ) ,
12571256 } ;
@@ -1311,7 +1310,7 @@ public void Bar()
13111310}" ;
13121311 DiagnosticResult [ ] expected =
13131312 {
1314- Diagnostic ( DiagnosticId ) . WithLocation ( 6 , 22 ) ,
1313+ Diagnostic ( DiagnosticId ) . WithSpan ( 6 , 22 , 6 , 31 ) ,
13151314 Diagnostic ( ParenthesesDiagnosticId ) . WithLocation ( 6 , 22 ) ,
13161315 Diagnostic ( ParenthesesDiagnosticId ) . WithLocation ( 6 , 30 ) ,
13171316 } ;
@@ -1371,7 +1370,7 @@ public void Bar()
13711370}" ;
13721371 DiagnosticResult [ ] expected =
13731372 {
1374- Diagnostic ( DiagnosticId ) . WithLocation ( 6 , 22 ) ,
1373+ Diagnostic ( DiagnosticId ) . WithSpan ( 6 , 22 , 6 , 30 ) ,
13751374 Diagnostic ( ParenthesesDiagnosticId ) . WithLocation ( 6 , 22 ) ,
13761375 Diagnostic ( ParenthesesDiagnosticId ) . WithLocation ( 6 , 29 ) ,
13771376 } ;
@@ -1420,10 +1419,10 @@ public static void Main(string[] args)
14201419" ;
14211420 DiagnosticResult [ ] expected =
14221421 {
1423- Diagnostic ( DiagnosticId ) . WithLocation ( 6 , 4 ) ,
1422+ Diagnostic ( DiagnosticId ) . WithSpan ( 6 , 4 , 6 , 11 ) ,
14241423 Diagnostic ( ParenthesesDiagnosticId ) . WithLocation ( 6 , 4 ) ,
14251424 Diagnostic ( ParenthesesDiagnosticId ) . WithLocation ( 6 , 10 ) ,
1426- Diagnostic ( DiagnosticId ) . WithLocation ( 10 , 5 ) ,
1425+ Diagnostic ( DiagnosticId ) . WithSpan ( 10 , 5 , 10 , 12 ) ,
14271426 Diagnostic ( ParenthesesDiagnosticId ) . WithLocation ( 10 , 5 ) ,
14281427 Diagnostic ( ParenthesesDiagnosticId ) . WithLocation ( 10 , 11 ) ,
14291428 } ;
0 commit comments