This repository was archived by the owner on Apr 13, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +86
-0
lines changed
src/Cake.Issues.Sarif.Tests Expand file tree Collapse file tree 3 files changed +86
-0
lines changed Original file line number Diff line number Diff line change 13
13
<CodeAnalysisRuleSet >..\Cake.Issues.Sarif.Tests.ruleset</CodeAnalysisRuleSet >
14
14
</PropertyGroup >
15
15
16
+ <ItemGroup >
17
+ <None Remove =" Testfiles\eslint.sarif" />
18
+ </ItemGroup >
19
+
16
20
<ItemGroup >
17
21
<EmbeddedResource Include =" Testfiles\cake.issues.reporting.sarif.sarif" />
18
22
<EmbeddedResource Include =" Testfiles\comprehensive.sarif" />
23
+ <EmbeddedResource Include =" Testfiles\eslint.sarif" />
19
24
<EmbeddedResource Include =" Testfiles\minimal.sarif" />
20
25
<EmbeddedResource Include =" Testfiles\recommended-with-source.sarif" />
21
26
<EmbeddedResource Include =" Testfiles\recommended-without-source.sarif" />
Original file line number Diff line number Diff line change @@ -173,6 +173,30 @@ public void Should_Read_Issue_Correct_For_File_Generated_By_CakeIssuesReportingS
173
173
. WithPriority ( IssuePriority . Warning )
174
174
. Create ( ) ) ;
175
175
}
176
+
177
+ [ Fact ]
178
+ public void Should_Read_Issue_Correct_For_File_Generated_By_EsLint ( )
179
+ {
180
+ // Given
181
+ var fixture = new SarifIssuesProviderFixture ( "eslint.sarif" ) ;
182
+
183
+ // When
184
+ var issues = fixture . ReadIssues ( ) . ToList ( ) ;
185
+
186
+ // Then
187
+ issues . Count . ShouldBe ( 1 ) ;
188
+ var issue = issues . Single ( ) ;
189
+ IssueChecker . Check (
190
+ issue ,
191
+ IssueBuilder . NewIssue (
192
+ "'x' is assigned a value but never used." ,
193
+ "Cake.Issues.Sarif.SarifIssuesProvider" ,
194
+ "ESLint" )
195
+ . InFile ( @"src\collections\list.cpp" , 15 )
196
+ . OfRule ( "no-unused-vars" , new Uri ( "https://eslint.org/docs/rules/no-unused-vars" ) )
197
+ . WithPriority ( IssuePriority . Error )
198
+ . Create ( ) ) ;
199
+ }
176
200
}
177
201
}
178
202
}
Original file line number Diff line number Diff line change
1
+ {
2
+ "version" : " 2.1.0" ,
3
+ "$schema" : " http://json.schemastore.org/sarif-2.1.0-rtm.4" ,
4
+ "runs" : [
5
+ {
6
+ "tool" : {
7
+ "driver" : {
8
+ "name" : " ESLint" ,
9
+ "informationUri" : " https://eslint.org" ,
10
+ "rules" : [
11
+ {
12
+ "id" : " no-unused-vars" ,
13
+ "shortDescription" : {
14
+ "text" : " disallow unused variables"
15
+ },
16
+ "helpUri" : " https://eslint.org/docs/rules/no-unused-vars" ,
17
+ "properties" : {
18
+ "category" : " Variables"
19
+ }
20
+ }
21
+ ]
22
+ }
23
+ },
24
+ "artifacts" : [
25
+ {
26
+ "location" : {
27
+ "uri" : " file:///C:/dev/sarif/sarif-tutorials/samples/Introduction/simple-example.js"
28
+ }
29
+ }
30
+ ],
31
+ "results" : [
32
+ {
33
+ "level" : " error" ,
34
+ "message" : {
35
+ "text" : " 'x' is assigned a value but never used."
36
+ },
37
+ "locations" : [
38
+ {
39
+ "physicalLocation" : {
40
+ "artifactLocation" : {
41
+ "uri" : " file:///C:/dev/sarif/sarif-tutorials/samples/Introduction/simple-example.js" ,
42
+ "index" : 0
43
+ },
44
+ "region" : {
45
+ "startLine" : 1 ,
46
+ "startColumn" : 5
47
+ }
48
+ }
49
+ }
50
+ ],
51
+ "ruleId" : " no-unused-vars" ,
52
+ "ruleIndex" : 0
53
+ }
54
+ ]
55
+ }
56
+ ]
57
+ }
You can’t perform that action at this time.
0 commit comments