-
-
Notifications
You must be signed in to change notification settings - Fork 194
Expand file tree
/
Copy pathParsersTest.java
More file actions
1104 lines (924 loc) · 38.4 KB
/
Copy pathParsersTest.java
File metadata and controls
1104 lines (924 loc) · 38.4 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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
package edu.hm.hafner.analysis.registry;
import org.junit.jupiter.api.Test;
import edu.hm.hafner.analysis.FileReaderFactory;
import edu.hm.hafner.analysis.Issue;
import edu.hm.hafner.analysis.ParsingException;
import edu.hm.hafner.analysis.Report;
import edu.hm.hafner.util.ResourceTest;
import java.util.Arrays;
import static edu.hm.hafner.analysis.assertions.Assertions.*;
/**
* Integration tests of all parsers.
*
* @author Ullrich Hafner
*/
@SuppressWarnings("PMD.CyclomaticComplexity")
class ParsersTest extends ResourceTest {
private static final String CODE_FRAGMENT = """
<pre><code>
#
ERROR HANDLING: N/A
#
REMARKS: N/A
#
****************************** END HEADER *************************************
#
***************************** BEGIN PDL ***************************************
#
****************************** END PDL ****************************************
#
***************************** BEGIN CODE **************************************
**
*******************************************************************************
*******************************************************************************
*******************************************************************************
if [ $# -lt 3 ]
then
exit 1
fi
*******************************************************************************
initialize local variables
shift input parameter (twice) to leave only files to copy
*******************************************************************************
files=""
shift
shift
*******************************************************************************
*******************************************************************************
for i in $*
do
files="$files $directory/$i"
done
</code>
</pre>
""";
/** Verifies that a broken file does not fail. */
@Test
void shouldSilentlyIgnoreWrongFile() {
assertThatExceptionOfType(ParsingException.class).isThrownBy(() ->
findIssuesOfTool(0, "checkstyle", "CargoCheck.json"));
}
/**
* Runs with several tools that internally delegate to CheckStyle's parser on an output file that contains 6
* issues.
*/
@Test
void shouldFindAllIssuesForCheckStyleAlias() {
for (String tool : Arrays.asList("detekt", "eslint", "ktlint", "php-code-sniffer",
"swiftlint", "stylelint", "tslint")) {
findIssuesOfTool(4, tool, "checkstyle.xml");
}
}
/** Runs the Semgrep analysis parser on an output file that contains 1 issue. */
@Test
void shouldFindAllSemgrepIssues() {
findIssuesOfTool(1, "semgrep", "violations/semgrep-report.json");
}
/** Runs the ShellCheck parser on an output file that contains 8 issues. */
@Test
void shouldFindAllShellCheckIssues() {
findIssuesOfTool(8, "shellcheck", "shellcheck.json");
}
/** Runs the Dart analysis parser on an output file that contains 6 issues. */
@Test
void shouldFindAllDartIssues() {
findIssuesOfTool(6, "dart", "dart.log");
}
/** Runs the SARIF parser on an output file that contains 2 issues. */
@Test
void shouldFindAllSarifIssues() {
findIssuesOfTool(2, "sarif", "sarif.json");
}
/** Runs the Roslyn Analyzers parser on an output file that contains 3 issues. */
@Test
void shouldFindAllRoslynAnalyzersIssues() {
findIssuesOfTool(3, "roslyn-analyzers", "roslyn-analyzers-report.sarif");
}
/** Runs the Cmake parser on an output file that contains 8 issues. */
@Test
void shouldFindAllCmakeIssues() {
findIssuesOfTool(8, "cmake", "cmake.txt");
}
/** Runs the Cargo parser on an output file that contains 2 issues. */
@Test
void shouldFindAllCargoIssues() {
findIssuesOfTool(2, "cargo", "CargoCheck.json");
}
/** Runs the rust-analyzer parser on an output file that contains 2 issues. */
@Test
void shouldFindAllRustAnalyzerIssues() {
findIssuesOfTool(2, "rust-analyzer", "rust-analyzer.json");
}
/** Runs the Intelephense parser on an output file that contains 3 issues. */
@Test
void shouldFindAllIntelephenseIssues() {
findIssuesOfTool(3, "intelephense", "intelephense-report.json");
}
/** Runs the Cargo Audit parser on an output file that contains 3 issues. */
@Test
void shouldFindAllCargoAuditIssues() {
findIssuesOfTool(3, "cargo-audit", "cargo-audit.json");
}
/** Runs the AWS CodeGuru Security parser on an output file that contains 3 issues. */
@Test
void shouldFindAllCodeGuruSecurityIssues() {
findIssuesOfTool(3, "codeguru-security", "codeguru-security-report.json");
}
/** Runs the KICS parser on an output file that contains 3 issues. */
@Test
void shouldFindAllKicsIssues() {
findIssuesOfTool(3, "kics", "kics-report.json");
}
/** Runs the Pmd parser on an output file that contains 262 issues. */
@Test
void shouldFindAllIssuesForPmdAlias() {
findIssuesOfTool(262, "infer", "pmd-6.xml");
}
/** Runs the MSBuild parser on an output file that contains 262 issues. */
@Test
void shouldFindAllIssuesForMsBuildAlias() {
findIssuesOfTool(8, "pclint", "msbuild.txt");
}
/** Runs the YamlLint parser on an output file that contains 4 issues. */
@Test
void shouldFindAllYamlLintIssues() {
findIssuesOfTool(4, "yamllint", "yamllint.txt");
}
/** Runs the Iar parser on an output file that contains 6 issues. */
@Test
void shouldFindAllIarIssues() {
findIssuesOfTool(6, "iar", "iar.txt");
}
/** Runs the IbLinter parser on an output file that contains 1 issue. */
@Test
void shouldFindAllIbLinterIssues() {
findIssuesOfTool(1, "iblinter", "iblinter.xml");
}
/** Runs the IarCStat parser on an output file that contains 6 issues. */
@Test
void shouldFindAllIarCStatIssues() {
findIssuesOfTool(6, "iar-cstat", "iar-cstat.txt");
}
/** Runs the SonarQube parsers on two files that contains 6 and 31 issues. */
@Test
void shouldFindAllSonarQubeIssues() {
findIssuesOfTool(32 + 6, "sonar", "sonarqube-api.json", "sonarqube-differential.json");
}
/** Runs the TagList parser on an output file that contains 6 issues. */
@Test
void shouldFindAllTagListIssues() {
findIssuesOfTool(4, "taglist", "taglist.xml");
}
/** Runs the Ccm parser on an output file that contains 6 issues. */
@Test
void shouldFindAllCcmIssues() {
findIssuesOfTool(6, "ccm", "ccm.xml");
}
/** Runs the ruboCop parser on an output file that contains 2 issues. */
@Test
void shouldFindAllRuboCopIssues() {
findIssuesOfTool(3, "rubocop", "rubocop.log");
}
/** Runs the flawfinder parser on an output file that contains 3 issues. */
@Test
void shouldFindAllFlawfinderIssues() {
findIssuesOfTool(3, "flawfinder", "flawfinder.log");
}
/** Runs the Android Lint parser on an output file that contains 2 issues. */
@Test
void shouldFindAllAndroidLintIssues() {
findIssuesOfTool(2, "android-lint", "android-lint.xml");
}
/** Runs the CodeNarc parser on an output file that contains 11 issues. */
@Test
void shouldFindAllCodeNArcIssues() {
findIssuesOfTool(11, "codenarc", "codeNarc.xml");
}
/** Runs the Cppcheck parser on an output file that contains 3 issues. */
@Test
void shouldFindAllCppCheckIssues() {
findIssuesOfTool(3, "cppcheck", "cppcheck.xml");
}
/** Runs the DocFx parser on an output file that contains 3 issues. */
@Test
void shouldFindAllDocFXIssues() {
findIssuesOfTool(3, "docfx", "docfx.json");
}
/** Runs the ErrorProne parser on output files that contain 9 + 2 issues. */
@Test
void shouldFindAllErrorProneIssues() {
findIssuesOfTool(9 + 2, "error-prone", "errorprone-maven.log", "gradle-error-prone.log");
}
/** Runs the Flake8 parser on an output file that contains 12 issues. */
@Test
void shouldFindAllFlake8Issues() {
findIssuesOfTool(12, "flake8", "flake8.txt");
}
/** Runs the JSHint parser on an output file that contains 6 issues. */
@Test
void shouldFindAllJsHintIssues() {
findIssuesOfTool(6, "js-hint", "jshint.xml");
}
/**
* Runs the JUnit parser on an output file that contains 2 and 1 issues.
*/
@Test
void shouldFindAllJUnitIssues() {
findIssuesOfTool(2, "junit", "junit.xml");
findIssuesOfTool(1, "junit", "TEST-org.jenkinsci.plugins.jvctb.perform.JvctbPerformerTest.xml");
}
/** Runs the Klocwork parser on an output file that contains 2 issues. */
@Test
void shouldFindAllKlocWorkIssues() {
findIssuesOfTool(2, "klocwork", "klocwork.xml");
}
/** Runs the MyPy parser on an output file that contains 5 issues. */
@Test
void shouldFindAllMyPyIssues() {
findIssuesOfTool(5, "mypy", "mypy.txt");
}
/** Runs the PIT parser on an output file that contains 25 issues. */
@Test
void shouldFindAllPitIssues() {
findIssuesOfTool(2, "pit", "pit.xml");
}
/** Runs the PyDocStyle parser on an output file that contains 33 issues. */
@Test
void shouldFindAllPyDocStyleIssues() {
findIssuesOfTool(33, "pydocstyle", "pydocstyle.txt");
}
/** Runs the XML Lint parser on an output file that contains 3 issues. */
@Test
void shouldFindAllXmlLintStyleIssues() {
findIssuesOfTool(3, "xmllint", "xmllint.txt");
}
/** Runs the zptlint parser on an output file that contains 2 issues. */
@Test
void shouldFindAllZptLintStyleIssues() {
findIssuesOfTool(2, "zptlint", "zptlint.log");
}
/** Runs the CPD parser on an output file that contains 2 issues. */
@Test
void shouldFindAllCpdIssues() {
var cpd = "cpd";
var report = findIssuesOfTool(2, cpd, "cpd.xml");
assertThatDescriptionOfIssueIsSet(cpd, report.get(0), CODE_FRAGMENT);
}
/** Runs the Simian parser on an output file that contains 4 issues. */
@Test
void shouldFindAllSimianIssues() {
findIssuesOfTool(4, "simian", "simian.xml");
}
/** Runs the DupFinder parser on an output file that contains 2 issues. */
@Test
void shouldFindAllDupFinderIssues() {
var dupfinder = "dupfinder";
var report = findIssuesOfTool(2, dupfinder, "dupfinder.xml");
assertThatDescriptionOfIssueIsSet(dupfinder, report.get(0),
"""
<pre><code>
if (items == null) throw new ArgumentNullException("items");
</code>
</pre>
""");
}
/** Runs the Armcc parser on output files that contain 3 + 3 issues. */
@Test
void shouldFindAllArmccIssues() {
findIssuesOfTool(3 + 3, "armcc", "armcc.txt", "armcc5.txt");
}
/** Runs the Buckminster parser on an output file that contains 3 issues. */
@Test
void shouldFindAllBuckminsterIssues() {
findIssuesOfTool(3, "buckminster", "buckminster.txt");
}
/** Runs the Cadence parser on an output file that contains 3 issues. */
@Test
void shouldFindAllCadenceIssues() {
findIssuesOfTool(3, "cadence", "CadenceIncisive.txt");
}
/** Runs the Mentor parser on an output file that contains 12 issues. */
@Test
void shouldFindAllMentorGraphicsIssues() {
findIssuesOfTool(12, "modelsim", "MentorGraphics.log");
}
/** Runs the BluePearl an output file that contains 8 issues. */
@Test
void shouldFindAllBluePearlIssues() {
findIssuesOfTool(12, "bluepearl", "bluepearl.log");
}
/** Runs the PMD parser on an output file that contains 262 issues (PMD 6.1.0). */
@Test
void shouldFindAllPmdIssues() {
var pmd = "pmd";
var report = findIssuesOfTool(262, pmd, "pmd-6.xml");
assertThatDescriptionOfIssueIsSet(pmd, report.get(0),
"A high number of imports can indicate a high degree of coupling within an object.");
}
/** Runs the CheckStyle parser on an output file that contains 6 issues. */
@Test
void shouldFindAllCheckStyleIssues() {
var checkstyle = "checkstyle";
var report = findIssuesOfTool(4, checkstyle, "checkstyle.xml");
assertThatDescriptionOfIssueIsSet(checkstyle, report.get(2),
"<p>Since Checkstyle 3.1</p><p>");
assertThatDescriptionOfIssueIsSet(checkstyle, report.get(2),
"The check finds classes that are designed for extension (subclass creation).");
}
/** Runs the Phan parser on an output file that contains 3 issues. */
@Test
void shouldFindAllPhanIssues() {
findIssuesOfTool(3, "phan", "phan-report.json");
}
private void assertThatDescriptionOfIssueIsSet(final String tool, final Issue issue,
final String expectedDescription) {
var parserRegistry = new ParserRegistry();
var descriptor = parserRegistry.get(tool);
assertThat(issue).hasDescription("");
assertThat(descriptor.getDescription(issue)).contains(expectedDescription);
}
/** Runs the FindBugs parser on an output file that contains 2 issues. */
@Test
void shouldFindAllFindBugsIssues() {
var findbugs = "findbugs";
var report = findIssuesOfTool(2, findbugs, "findbugs-native.xml");
assertThatDescriptionOfIssueIsSet(findbugs, report.get(0),
"""
<p> The fields of this class appear to be accessed inconsistently with respect
to synchronization. This bug report indicates that the bug pattern detector
judged that
</p>
<ul>
<li> The class contains a mix of locked and unlocked accesses,</li>
<li> The class is <b>not</b> annotated as javax.annotation.concurrent.NotThreadSafe,</li>
<li> At least one locked access was performed by one of the class's own methods, and</li>
<li> The number of unsynchronized field accesses (reads and writes) was no more than
one third of all accesses, with writes being weighed twice as high as reads</li>
</ul>
<p> A typical bug matching this bug pattern is forgetting to synchronize
one of the methods in a class that is intended to be thread-safe.</p>
<p> You can select the nodes labeled "Unsynchronized access" to show the
code locations where the detector believed that a field was accessed
without synchronization.</p>
<p> Note that there are various sources of inaccuracy in this detector;
for example, the detector cannot statically detect all situations in which
a lock is held. Also, even when the detector is accurate in
distinguishing locked vs. unlocked accesses, the code in question may still
be correct.</p>""");
}
/** Runs the SpotBugs parser on an output file that contains 2 issues. */
@Test
void shouldFindAllSpotBugsIssues() {
var expectedDescription = """
<p>This code calls a method and ignores the return value. However our analysis shows that
the method (including its implementations in subclasses if any) does not produce any effect
other than return value. Thus this call can be removed.
</p>
<p>We are trying to reduce the false positives as much as possible, but in some cases this warning might be wrong.
Common false-positive cases include:</p>
<p>- The method is designed to be overridden and produce a side effect in other projects which are out of the scope of the analysis.</p>
<p>- The method is called to trigger the class loading which may have a side effect.</p>
<p>- The method is called just to get some exception.</p>
<p>If you feel that our assumption is incorrect, you can use a @CheckReturnValue annotation
to instruct SpotBugs that ignoring the return value of this method is acceptable.
</p>""";
var spotBugs = "spotbugs";
var report = findIssuesOfTool(2, spotBugs, "spotbugsXml.xml");
assertThatDescriptionOfIssueIsSet(spotBugs, report.get(0), expectedDescription);
}
/** Runs the SpotBugs parser on an output file that contains 2 issues. */
@Test
void shouldProvideMessagesAndDescriptionForSecurityIssuesWithSpotBugs() {
var expectedDescription = """
<p>A file is opened to read its content. The filename comes from an <b>input</b> parameter.
If an unfiltered parameter is passed to this file API, files from an arbitrary filesystem location could be read.</p>
<p>This rule identifies <b>potential</b> path traversal vulnerabilities. In many cases, the constructed file path cannot be controlled
by the user. If that is the case, the reported instance is a false positive.</p>""";
var spotBugs = "spotbugs";
var report = findIssuesOfTool(1, spotBugs, "issue55707.xml");
var issue = report.get(0);
assertThatDescriptionOfIssueIsSet(spotBugs, issue, expectedDescription);
assertThat(issue).hasMessage(
"java/nio/file/Paths.get(Ljava/lang/String;[Ljava/lang/String;)Ljava/nio/file/Path; reads a file whose location might be specified by user input");
}
/** Runs the Clang-Analyzer parser on an output file that contains 3 issues. */
@Test
void shouldFindAllClangAnalyzerIssues() {
findIssuesOfTool(3, "clang-analyzer", "ClangAnalyzer.txt");
}
/** Runs the Clang-Tidy parser on an output file that contains 8 issues. */
@Test
void shouldFindAllClangTidyIssues() {
findIssuesOfTool(9, "clang-tidy", "ClangTidy.txt");
}
/** Runs the Clang parser on an output file that contains 9 issues. */
@Test
void shouldFindAllClangIssues() {
findIssuesOfTool(9, "clang", "apple-llvm-clang.txt");
}
/** Runs the Clang parser on mixed compiler and linker errors. */
@Test
void shouldFindAllClangAndLldIssues() {
findIssuesOfTool(4, "clang", "mixed-clang-lld-errors.log");
}
/** Runs the Coolflux parser on an output file that contains 1 issues. */
@Test
void shouldFindAllCoolfluxIssues() {
findIssuesOfTool(1, "coolflux", "coolfluxchesscc.txt");
}
/** Runs the CppLint parser on an output file that contains 1031 issues. */
@Test
void shouldFindAllCppLintIssues() {
findIssuesOfTool(1031, "cpplint", "cpplint.txt");
}
/** Runs the CodeAnalysis parser on an output file that contains 3 issues. */
@Test
void shouldFindAllCodeAnalysisIssues() {
findIssuesOfTool(3, "code-analysis", "codeanalysis.txt");
}
/** Runs the DScanner parser on an output file that contains 4 issues. */
@Test
void shouldFindAllDScannerIssues() {
findIssuesOfTool(4, "dscanner", "dscanner-report.json");
}
/** Runs the GoLint parser on an output file that contains 7 issues. */
@Test
void shouldFindAllGoLintIssues() {
findIssuesOfTool(7, "golint", "golint.txt");
}
/** Runs the GoVet parser on an output file that contains 2 issues. */
@Test
void shouldFindAllGoVetIssues() {
findIssuesOfTool(2, "go-vet", "govet.txt");
}
/** Runs the gosec parser on an output file that contains 3 issues. */
@Test
void shouldFindAllGosecIssues() {
findIssuesOfTool(3, "gosec", "gosec-report.json");
}
/** Runs the Revive parser on an output file that contains 6 issues. */
@Test
void shouldFindAllReviveIssues() {
findIssuesOfTool(6, "revive", "revive-report.json");
}
/** Runs the SunC parser on an output file that contains 8 issues. */
@Test
void shouldFindAllSunCIssues() {
findIssuesOfTool(8, "sunc", "sunc.txt");
}
/** Runs the JcReport parser on an output file that contains 6 issues. */
@Test
void shouldFindAllJcReportIssues() {
findIssuesOfTool(6, "jc-report", "jcreport.xml");
}
/** Runs the StyleCop parser on an output file that contains 5 issues. */
@Test
void shouldFindAllStyleCopIssues() {
findIssuesOfTool(5, "stylecop", "stylecop.xml");
}
/** Runs the Tasking VX parser on an output file that contains 10 issues. */
@Test
void shouldFindAllTaskingVxIssues() {
findIssuesOfTool(10, "tasking-vx", "tasking-vx.txt");
}
/** Runs the tnsdl translator parser on an output file that contains 4 issues. */
@Test
void shouldFindAllTnsdlIssues() {
findIssuesOfTool(4, "tnsdl", "tnsdl.txt");
}
/** Runs the Texas Instruments Code Composer Studio parser on an output file that contains 10 issues. */
@Test
void shouldFindAllTiCssIssues() {
findIssuesOfTool(10, "code-composer", "ticcs.txt");
}
/** Runs the IBM XLC compiler and linker parser on an output file that contains 1 + 1 issues. */
@Test
void shouldFindAllXlcIssues() {
findIssuesOfTool(1, "xlc", "xlc.txt");
}
/** Runs the YIU compressor parser on an output file that contains 3 issues. */
@Test
void shouldFindAllYuiCompressorIssues() {
findIssuesOfTool(4, "yui", "yui.txt");
}
/** Runs the Erlc parser on an output file that contains 2 issues. */
@Test
void shouldFindAllErlcIssues() {
findIssuesOfTool(2, "erlc", "erlc.txt");
}
/** Runs the FlexSdk parser on an output file that contains 5 issues. */
@Test
void shouldFindAllFlexSDKIssues() {
findIssuesOfTool(5, "flex", "flexsdk.txt");
}
/** Runs the FxCop parser on an output file that contains 2 issues. */
@Test
void shouldFindAllFxcopSDKIssues() {
findIssuesOfTool(2, "fxcop", "fxcop.xml");
}
/** Runs the Gendarme parser on an output file that contains 3 issues. */
@Test
void shouldFindAllGendarmeIssues() {
findIssuesOfTool(3, "gendarme", "Gendarme.xml");
}
/** Runs the GhsMulti parser on an output file that contains 3 issues. */
@Test
void shouldFindAllGhsMultiIssues() {
findIssuesOfTool(7, "ghs-multi", "ghsmulti.txt");
}
/**
* Runs the Gnat parser on an output file that contains 9 issues.
*/
@Test
void shouldFindAllGnatIssues() {
findIssuesOfTool(9, "gnat", "gnat.txt");
}
/** Runs the GnuFortran parser on an output file that contains 4 issues. */
@Test
void shouldFindAllGnuFortranIssues() {
findIssuesOfTool(4, "fortran", "GnuFortran.txt");
}
/** Runs the MsBuild parser on an output file that contains 6 issues. */
@Test
void shouldFindAllMsBuildIssues() {
findIssuesOfTool(8, "msbuild", "msbuild.txt");
}
/** Runs the NagFortran parser on an output file that contains 10 issues. */
@Test
void shouldFindAllNagFortranIssues() {
findIssuesOfTool(14, "nag-fortran", "NagFortran.txt");
}
/** Runs the Perforce parser on an output file that contains 4 issues. */
@Test
void shouldFindAllP4Issues() {
findIssuesOfTool(4, "perforce", "perforce.txt");
}
/** Runs the Pep8 parser on an output file: the build should report 8 issues. */
@Test
void shouldFindAllPep8Issues() {
findIssuesOfTool(8, "pep8", "pep8Test.txt");
}
/** Runs the Gcc3Compiler parser on an output file that contains 8 issues. */
@Test
void shouldFindAllGcc3CompilerIssues() {
findIssuesOfTool(8, "gcc3", "gcc.txt");
}
/** Runs the Gcc4Compiler and Gcc4Linker parsers on separate output file that contains 16 + 7 issues. */
@Test
void shouldFindAllGcc4Issues() {
findIssuesOfTool(16 + 7 - 1, "gcc", "gcc4.txt", "gcc4ld.txt"); // one duplicate warning
}
/** Runs the Maven console parser on output files that contain 4 + 3 issues. */
@Test
void shouldFindAllMavenConsoleIssues() {
findIssuesOfTool(5 + 3, "maven-warnings", "maven-console.txt", "issue13969.txt");
}
/** Runs the MetrowerksCWCompiler parser on two output files that contains 5 + 3 issues. */
@Test
void shouldFindAllMetrowerksCWCompilerIssues() {
findIssuesOfTool(5 + 3, "metrowerks", "MetrowerksCWCompiler.txt", "MetrowerksCWLinker.txt");
}
/** Runs the AcuCobol parser on an output file that contains 4 issues. */
@Test
void shouldFindAllAcuCobolIssues() {
findIssuesOfTool(4, "acu-cobol", "acu.txt");
}
/** Runs the Ajc parser on an output file that contains 9 issues. */
@Test
void shouldFindAllAjcIssues() {
findIssuesOfTool(9, "aspectj", "ajc.txt");
}
/** Runs the AnsibleLint parser on an output file that contains 13 issues. */
@Test
void shouldFindAllAnsibleLintIssues() {
findIssuesOfTool(13, "ansiblelint", "ansibleLint.txt");
}
/**
* Runs the Perl::Critic parser on an output file that contains 105 issues.
*/
@Test
void shouldFindAllPerlCriticIssues() {
findIssuesOfTool(105, "perl-critic", "perlcritic.txt");
}
/** Runs the Php parser on an output file that contains 5 issues. */
@Test
void shouldFindAllPhpIssues() {
findIssuesOfTool(5, "php", "php.txt");
}
/**
* Runs the PHPStan scanner on an output file that contains 14 issues.
*/
@Test
void shouldFindAllPhpStanIssues() {
findIssuesOfTool(11, "phpstan", "phpstan.xml");
}
/** Runs the PHP Mess Detector parser on an output file that contains 4 issues. */
@Test
void shouldFindAllPhpMdIssues() {
findIssuesOfTool(4, "php-md", "phpmd-report.json");
}
/** Runs the Microsoft PreFast parser on an output file that contains 11 issues. */
@Test
void shouldFindAllPREfastIssues() {
findIssuesOfTool(11, "prefast", "PREfast.xml");
}
/** Runs the Puppet Lint parser on an output file that contains 5 issues. */
@Test
void shouldFindAllPuppetLintIssues() {
findIssuesOfTool(5, "puppetlint", "puppet-lint.txt");
}
/** Runs the Eclipse parser on an output file that contains 8 issues. */
@Test
void shouldFindAllEclipseIssues() {
var eclipse = "eclipse";
findIssuesOfTool(8, eclipse, "eclipse.txt");
// FIXME: fails if offline
findIssuesOfTool(6, eclipse, "eclipse-withinfo.xml");
findIssuesOfTool(8 + 6, eclipse, "eclipse-withinfo.xml", "eclipse.txt");
}
/** Runs the OpenSCAP parser on an output file that contains 3 issues. */
@Test
void shouldFindAllOpenSCAPIssues() {
findIssuesOfTool(3, "openscap", "openscap-report.json");
}
/** Runs the PyLint parser on output files that contains 6 + 19 issues. */
@Test
void shouldFindAllPyLintParserIssues() {
var pylint = "pylint";
var report = findIssuesOfTool(9 + 22, pylint, "pyLint.txt", "pylint_parseable.txt");
assertThatDescriptionOfIssueIsSet(pylint, report.get(1),
"Used when the name doesn't match the regular expression associated to its type(constant, variable, class...).");
assertThatDescriptionOfIssueIsSet(pylint, report.get(7),
"Used when an imported module or variable is not used.");
}
/**
* Runs the QacSourceCodeAnalyser parser on an output file that contains 9 issues.
*/
@Test
void shouldFindAllQACSourceCodeAnalyserIssues() {
findIssuesOfTool(9, "qac", "QACSourceCodeAnalyser.txt");
}
/** Runs the Resharper parser on an output file that contains 3 issues. */
@Test
void shouldFindAllResharperInspectCodeIssues() {
findIssuesOfTool(3, "resharper", "ResharperInspectCode.xml");
}
/** Runs the RfLint parser on an output file that contains 6 issues. */
@Test
void shouldFindAllRfLintIssues() {
findIssuesOfTool(25, "rflint", "rflint.txt");
}
/** Runs the Robocopy parser on an output file: the build should report 3 issues. */
@Test
void shouldFindAllRobocopyIssues() {
findIssuesOfTool(3, "robocopy", "robocopy.txt");
}
/** Runs the Scala and SbtScala parser on separate output files: the build should report 2+3 issues. */
@Test
void shouldFindAllScalaIssues() {
findIssuesOfTool(2 + 5, "scala", "scalac.txt", "sbtScalac.txt");
}
/** Runs the Sphinx build parser on 2 output files: the build should report 7 + 6 issues. */
@Test
void shouldFindAllSphinxIssues() {
findIssuesOfTool(7 + 6, "sphinx", "sphinxbuild.txt", "sphinxbuildlinkcheck.txt");
}
/** Runs the Idea Inspection parser on an output file that contains 1 issues. */
@Test
void shouldFindAllIdeaInspectionIssues() {
findIssuesOfTool(1, "idea", "IdeaInspectionExample.xml");
}
/** Runs the Intel parser on an output file that contains 7 issues. */
@Test
void shouldFindAllIntelIssues() {
findIssuesOfTool(9, "intel", "intelc.txt");
}
/** Runs the Oracle Invalids parser on an output file that contains 3 issues. */
@Test
void shouldFindAllInvalidsIssues() {
findIssuesOfTool(3, "invalids", "invalids.txt");
}
/** Runs the Java parser on several output files that contain 2 + 1 + 1 + 1 + 2 issues. */
@Test
void shouldFindAllJavaIssues() {
findIssuesOfTool(2 + 1 + 1 + 1 + 2, "java", "javac.txt", "gradle.java.log",
"gradle.another.java.log",
"ant-javac.txt", "hpi.txt");
}
/**
* Runs the Kotlin parser on several output files that contain 1 issues.
*/
@Test
void shouldFindAllKotlinIssues() {
findIssuesOfTool(1, "kotlin", "kotlin.txt");
}
/**
* Runs the CssLint parser on an output file that contains 51 issues.
*/
@Test
void shouldFindAllCssLintIssues() {
findIssuesOfTool(51, "csslint", "csslint.xml");
}
/** Runs the DiabC parser on an output file that contains 12 issues. */
@Test
void shouldFindAllDiabCIssues() {
findIssuesOfTool(12, "diabc", "diabc.txt");
}
/** Runs the Doxygen parser on an output file that contains 18 issues. */
@Test
void shouldFindAllDoxygenIssues() {
findIssuesOfTool(19, "doxygen", "doxygen.txt");
}
/** Runs the Dr. Memory parser on an output file that contains 8 issues. */
@Test
void shouldFindAllDrMemoryIssues() {
findIssuesOfTool(8, "dr-memory", "drmemory.txt");
}
/** Runs the PVS-Studio parser on an output file that contains 33 issues. */
@Test
void shouldFindAllPVSStudioIssues() {
findIssuesOfTool(33, "pvs-studio", "TestReport.plog");
}
/** Runs the JavaC parser on an output file of the Eclipse compiler: the build should report no issues. */
@Test
void shouldFindNoJavacIssuesInEclipseOutput() {
findIssuesOfTool(0, "java", "eclipse.txt");
}
/** Runs the ProtoLint parser on a plaintext output file that contains 2591 issues. */
@Test
void shouldFindAllProtoLintIssues() {
findIssuesOfTool(2591, "protolint", "protolint.txt");
}
/** Runs the ProtoLint parser on a json output file that contains 462 issues. */
@Test
void shouldFindAllProtoLintIssuesJsonFormat() {
findIssuesOfTool(462, "protolint", "protolint_0.50.2.json");
}
/** Runs the HadoLint parser on an output file that contains 5 issues. */
@Test
void shouldFindAllHadoLintIssues() {
findIssuesOfTool(5, "hadolint", "hadolint.json");
}
/** Runs the Ruff parser on an output file that contains 6 issues. */
@Test
void shouldFindAllRuffIssues() {
findIssuesOfTool(6, "ruff", "ruff.json");
}
/** Runs the MarkdownLint parser on an output file that contains 4 issues. */
@Test
void shouldFindAllMarkdownLintIssues() {
findIssuesOfTool(4, "markdownlint", "markdownlint.json");
}
/** Runs the KubeLinter parser on an output file that contains 3 issues. */
@Test
void shouldFindAllKubeLinterIssues() {
findIssuesOfTool(3, "kube-linter", "kubelinter.json");
}
/** Runs the Kube Hunter parser on an output file that contains 3 issues. */
@Test
void shouldFindAllKubeHunterIssues() {
findIssuesOfTool(3, "kube-hunter", "kube-hunter.json");
}
/** Runs the kube-score parser on an output file that contains 3 issues. */
@Test
void shouldFindAllKubeScoreIssues() {
findIssuesOfTool(3, "kube-score", "kube-score.json");
}
/** Runs the Kyverno parser on an output file that contains 5 issues. */
@Test
void shouldFindAllKyvernoIssues() {
findIssuesOfTool(5, "kyverno", "kyverno-report.json");
}
/** Runs the Kubesec parser on an output file that contains 6 issues. */
@Test
void shouldFindAllKubesecIssues() {
findIssuesOfTool(6, "kubesec", "kubesec.json");
}
/** Runs the DockerLint parser on an output file that contains 3 issues. */
@Test
void shouldFindAllDockerLintIssues() {
findIssuesOfTool(7, "dockerlint", "dockerlint.json");
}
/** Runs the Clair parser on an output file that contains 112 issues. */
@Test
void shouldFindAllClairIssues() {
findIssuesOfTool(112, "clair", "clair.json");
}
/** Runs the Detectify parser on an output file that contains 3 issues. */
@Test
void shouldFindAllDetectifyIssues() {
findIssuesOfTool(3, "detectify", "detectify-report.json");
}
/** Runs the FOSSA parser on an output file that contains 3 issues. */
@Test
void shouldFindAllFossaIssues() {
findIssuesOfTool(3, "fossa", "fossa-report.json");
}
/** Runs the CFN-Lint parser on an output file that contains 3 issues. */
@Test
void shouldFindAllCfnLintIssues() {
findIssuesOfTool(3, "cfn-lint", "cfn-lint-report.json");
}
/** Runs the CFN-Nag parser on an output file that contains 3 issues. */
@Test
void shouldFindAllCfnNagIssues() {
findIssuesOfTool(3, "cfn-nag", "cfn-nag-report.json");
}
/** Runs the OTDockerLint parser on an output file that contains 5 issues. */
@Test
void shouldFindAllOTDockerLintIssues() {
findIssuesOfTool(3, "ot-docker-linter", "ot-docker-linter.json");
}
/** Runs the Brakeman parser on an output file that contains 32 issues. */
@Test
void shouldFindAllBrakemanIssues() {
findIssuesOfTool(32, "brakeman", "brakeman.json");
}
/** Runs the Terraform Lint parser on an output file that contains 4 issues. */