code-scanning-rubocop 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +18 -18
- data/lib/code_scanning/rubocop/rule.rb +50 -23
- data/lib/code_scanning/rubocop/sarif_formatter.rb +7 -6
- data/lib/code_scanning/rubocop/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aede2d4f861c011d78db9d9f6df567bdd94322ed40951f3d15613b844e3e48b5
|
4
|
+
data.tar.gz: d2fdb4fc5b34b560c5a9af454def6730d75c4ed80cbfd6865027175df10b393c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f44b470a1e45e04a535fb6becc9ee6348da281405ea14cd96f726894327bec3523ecd627ece9b2426ae409ca13f14d9eaca5110d4bd5b8ba9515d1ad60edd7bd
|
7
|
+
data.tar.gz: 5f790f1cdcfb47d202e7b4afb613450ebe108fa3cc3b301140ee14cf98b63f7b15b2ad694a7be6ec29968569905e4029cdbfea5fe3b7c353b3d7651785998286
|
data/Gemfile.lock
CHANGED
@@ -1,34 +1,34 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
code-scanning-rubocop (0.
|
5
|
-
rubocop (
|
4
|
+
code-scanning-rubocop (0.5.0)
|
5
|
+
rubocop (~> 1.0)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
ast (2.4.
|
10
|
+
ast (2.4.2)
|
11
11
|
minitest (5.14.0)
|
12
|
-
parallel (1.
|
13
|
-
parser (
|
12
|
+
parallel (1.21.0)
|
13
|
+
parser (3.1.0.0)
|
14
14
|
ast (~> 2.4.1)
|
15
|
-
rainbow (3.
|
15
|
+
rainbow (3.1.1)
|
16
16
|
rake (12.3.3)
|
17
|
-
regexp_parser (
|
18
|
-
rexml (3.2.
|
19
|
-
rubocop (
|
17
|
+
regexp_parser (2.2.0)
|
18
|
+
rexml (3.2.5)
|
19
|
+
rubocop (1.24.1)
|
20
20
|
parallel (~> 1.10)
|
21
|
-
parser (>=
|
21
|
+
parser (>= 3.0.0.0)
|
22
22
|
rainbow (>= 2.2.2, < 4.0)
|
23
|
-
regexp_parser (>= 1.
|
23
|
+
regexp_parser (>= 1.8, < 3.0)
|
24
24
|
rexml
|
25
|
-
rubocop-ast (>=
|
25
|
+
rubocop-ast (>= 1.15.1, < 2.0)
|
26
26
|
ruby-progressbar (~> 1.7)
|
27
|
-
unicode-display_width (>= 1.4.0, <
|
28
|
-
rubocop-ast (
|
29
|
-
parser (>=
|
30
|
-
ruby-progressbar (1.
|
31
|
-
unicode-display_width (1.
|
27
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
28
|
+
rubocop-ast (1.15.1)
|
29
|
+
parser (>= 3.0.1.1)
|
30
|
+
ruby-progressbar (1.11.0)
|
31
|
+
unicode-display_width (2.1.0)
|
32
32
|
|
33
33
|
PLATFORMS
|
34
34
|
ruby
|
@@ -39,4 +39,4 @@ DEPENDENCIES
|
|
39
39
|
rake (~> 12.0)
|
40
40
|
|
41
41
|
BUNDLED WITH
|
42
|
-
2.
|
42
|
+
2.3.4
|
@@ -8,19 +8,19 @@ module CodeScanning
|
|
8
8
|
@cop_name = cop_name
|
9
9
|
@severity = severity.to_s
|
10
10
|
@cop = RuboCop::Cop::Cop.registry.find_by_cop_name(cop_name)
|
11
|
-
@help = StringIO.new
|
12
11
|
end
|
13
12
|
|
14
13
|
def id
|
15
14
|
@cop_name
|
16
15
|
end
|
17
16
|
|
18
|
-
def
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
17
|
+
def help(format)
|
18
|
+
case format
|
19
|
+
when :text
|
20
|
+
"More info: #{help_uri}"
|
21
|
+
when :markdown
|
22
|
+
"[More info](#{help_uri})"
|
23
|
+
end
|
24
24
|
end
|
25
25
|
|
26
26
|
def ==(other)
|
@@ -41,12 +41,36 @@ module CodeScanning
|
|
41
41
|
"none"
|
42
42
|
end
|
43
43
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
"
|
44
|
+
def help_uri
|
45
|
+
return @cop.documentation_url if @cop.documentation_url
|
46
|
+
return nil unless department_uri
|
47
|
+
|
48
|
+
anchor = "#{badge.department}#{badge.cop_name}".downcase.tr("/", "")
|
49
|
+
"#{department_uri}##{anchor}"
|
50
|
+
end
|
51
|
+
|
52
|
+
def department_uri
|
53
|
+
case badge.department
|
54
|
+
when :Performance
|
55
|
+
"https://docs.rubocop.org/rubocop-performance/index.html"
|
56
|
+
when :Packaging
|
57
|
+
"https://docs.rubocop.org/rubocop-packaging/cops_packaging.html"
|
58
|
+
when :Rails
|
59
|
+
"https://docs.rubocop.org/rubocop-rails/cops_rails.html"
|
60
|
+
when :Minitest
|
61
|
+
"https://docs.rubocop.org/rubocop-minitest/cops_minitest.html"
|
62
|
+
when :RSpec
|
63
|
+
"https://docs.rubocop.org/rubocop-rspec/cops_rspec.html"
|
64
|
+
when :"RSpec/Rails"
|
65
|
+
"https://docs.rubocop.org/rubocop-rspec/cops_rspec_rails.html"
|
66
|
+
when :"RSpec/Capybara"
|
67
|
+
"https://docs.rubocop.org/rubocop-rspec/cops_rspec_capybara.html"
|
68
|
+
when :"RSpec/FactoryBot"
|
69
|
+
"https://docs.rubocop.org/rubocop-rspec/cops_rspec_factorybot.html"
|
70
|
+
else
|
71
|
+
STDERR.puts "WARNING: Unknown docs URI for department #{badge.department}"
|
72
|
+
nil
|
73
|
+
end
|
50
74
|
end
|
51
75
|
|
52
76
|
def to_json(opts = {})
|
@@ -66,7 +90,7 @@ module CodeScanning
|
|
66
90
|
|
67
91
|
h = {
|
68
92
|
"id" => @cop_name,
|
69
|
-
"name" => @cop_name,
|
93
|
+
"name" => @cop_name.tr("/", "").gsub("RSpec", "Rspec"),
|
70
94
|
"defaultConfiguration" => {
|
71
95
|
"level" => sarif_severity
|
72
96
|
},
|
@@ -80,19 +104,22 @@ module CodeScanning
|
|
80
104
|
properties["description"] = desc
|
81
105
|
end
|
82
106
|
|
83
|
-
unless help_empty?
|
84
|
-
help = @help.string
|
85
|
-
h["help"] = {
|
86
|
-
"text" => help,
|
87
|
-
"markdown" => help
|
88
|
-
}
|
89
|
-
properties["queryURI"] = query_uri if badge.qualified?
|
90
|
-
end
|
91
|
-
|
92
107
|
if badge.qualified?
|
93
108
|
kind = badge.department.to_s
|
94
109
|
properties["tags"] = [kind.downcase]
|
95
110
|
end
|
111
|
+
|
112
|
+
if help_uri
|
113
|
+
h.merge!(
|
114
|
+
"queryURI" => help_uri,
|
115
|
+
"helpUri" => help_uri,
|
116
|
+
"help" => {
|
117
|
+
"text" => help(:text),
|
118
|
+
"markdown" => help(:markdown)
|
119
|
+
}
|
120
|
+
)
|
121
|
+
end
|
122
|
+
|
96
123
|
h
|
97
124
|
end
|
98
125
|
end
|
@@ -17,7 +17,12 @@ module CodeScanning
|
|
17
17
|
@sarif["runs"] = [
|
18
18
|
{
|
19
19
|
"tool" => {
|
20
|
-
"driver" => {
|
20
|
+
"driver" => {
|
21
|
+
"name" => "RuboCop",
|
22
|
+
"version" => RuboCop::Version.version,
|
23
|
+
"informationUri" => "https://rubocop.org",
|
24
|
+
"rules" => @rules
|
25
|
+
}
|
21
26
|
},
|
22
27
|
"results" => @results
|
23
28
|
}
|
@@ -52,7 +57,6 @@ module CodeScanning
|
|
52
57
|
"artifactLocation" => {
|
53
58
|
"uri" => relative_path,
|
54
59
|
"uriBaseId" => "%SRCROOT%",
|
55
|
-
"index" => 0
|
56
60
|
},
|
57
61
|
"region" => {
|
58
62
|
"startLine" => o.line,
|
@@ -61,10 +65,7 @@ module CodeScanning
|
|
61
65
|
}
|
62
66
|
}
|
63
67
|
}
|
64
|
-
]
|
65
|
-
"partialFingerprints" => {
|
66
|
-
# This will be computed by the upload action for now
|
67
|
-
}
|
68
|
+
]
|
68
69
|
}
|
69
70
|
end
|
70
71
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: code-scanning-rubocop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arthur Neves
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-02-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|
@@ -76,7 +76,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
76
76
|
- !ruby/object:Gem::Version
|
77
77
|
version: '0'
|
78
78
|
requirements: []
|
79
|
-
rubygems_version: 3.
|
79
|
+
rubygems_version: 3.3.3
|
80
80
|
signing_key:
|
81
81
|
specification_version: 4
|
82
82
|
summary: Extra formater to make rubocop compatible with GitHub's code-scanning feature.
|