nucop 0.1.2 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/nucop +1 -1
- data/lib/nucop.rb +3 -3
- data/lib/nucop/cli.rb +24 -7
- data/lib/nucop/formatters/junit_formatter.rb +11 -10
- data/lib/nucop/helpers/factory_bot_helper.rb +1 -1
- data/lib/nucop/helpers/next_cop_for_promotion.rb +1 -1
- data/lib/nucop/version.rb +1 -1
- metadata +43 -39
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 40f334562fcb3d2ff95256e19d78f2f33ab300a155814d11dae6d5aa7d2c6f3e
|
4
|
+
data.tar.gz: 61b561150890b4f2cd0ec877ebaaf11468af19a1087e5a0ebbb7791a7bec9c26
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c5d7935525a7f3e71779314e40de44e5a65efeed0a878a4340ec88cb030d54bc40c34e7dc2d00923d0ee272aa9be9ac7d52d9ea641b85e8f007068dfe0d067d7
|
7
|
+
data.tar.gz: 327247f6c795b46fda02787e460d6a4a38e8e8464f5c4ae73dad4709a1694a398d6926fe86d25465b8ed768a73d5b24734031928260fb3777e83a2a59f2a96fc
|
data/bin/nucop
CHANGED
data/lib/nucop.rb
CHANGED
@@ -3,9 +3,9 @@ require "nucop/version"
|
|
3
3
|
require "rubocop"
|
4
4
|
require "git_diff_parser"
|
5
5
|
|
6
|
-
Dir[File.join(__dir__, "nucop/helpers/**/*.rb")].each { |f| require f }
|
7
|
-
Dir[File.join(__dir__, "nucop/formatters/**/*.rb")].each { |f| require f }
|
8
|
-
Dir[File.join(__dir__, "nucop/cops/**/*.rb")].each { |f| require f }
|
6
|
+
Dir[File.join(__dir__, "nucop/helpers/**/*.rb")].sort.each { |f| require f }
|
7
|
+
Dir[File.join(__dir__, "nucop/formatters/**/*.rb")].sort.each { |f| require f }
|
8
|
+
Dir[File.join(__dir__, "nucop/cops/**/*.rb")].sort.each { |f| require f }
|
9
9
|
|
10
10
|
module Nucop
|
11
11
|
end
|
data/lib/nucop/cli.rb
CHANGED
@@ -5,11 +5,12 @@ RUBOCOP_DEFAULT_CONFIG_FILE = ".rubocop.yml"
|
|
5
5
|
CONFIGURATION_FILEPATH = ".nucop.yml"
|
6
6
|
|
7
7
|
module Nucop
|
8
|
-
class
|
8
|
+
class Cli < Thor
|
9
9
|
desc "diff_enforced", "run RuboCop on the current diff using only the enforced cops"
|
10
10
|
method_option "commit-spec", default: "origin/master", desc: "the commit used to determine the diff."
|
11
11
|
method_option "auto-correct", type: :boolean, default: false, desc: "runs RuboCop with auto-correct option"
|
12
|
-
method_option "junit_report", type: :string, default:
|
12
|
+
method_option "junit_report", type: :string, default: nil, desc: "runs RuboCop with junit formatter option"
|
13
|
+
method_option "json", type: :string, default: nil, desc: "Output results as JSON format to the provided file"
|
13
14
|
def diff_enforced
|
14
15
|
invoke :diff, nil, options.merge(only: cops_to_enforce.join(","))
|
15
16
|
end
|
@@ -66,16 +67,30 @@ module Nucop
|
|
66
67
|
def rubocop(files = nil)
|
67
68
|
print_cops_being_run(options[:only])
|
68
69
|
config_file = options[:"exclude-backlog"] ? RUBOCOP_DEFAULT_CONFIG_FILE : options[:rubocop_todo_config_file]
|
69
|
-
junit_report_path = options[:"junit_report"]
|
70
|
-
junit_report_options = junit_report_path.to_s.empty? ? "" : "--format Nucop::Formatters::JUnitFormatter --out #{junit_report_path} --format progress"
|
71
|
-
|
72
70
|
rubocop_requires = [
|
73
71
|
"--require rubocop-rspec",
|
74
72
|
"--require rubocop-performance",
|
75
73
|
"--require rubocop-rails"
|
76
74
|
]
|
77
75
|
|
78
|
-
|
76
|
+
formatters = []
|
77
|
+
formatters << "--format Nucop::Formatters::JUnitFormatter --out #{options[:junit_report]}" if options[:junit_report]
|
78
|
+
formatters << "--format json --out #{options[:json]}" if options[:json]
|
79
|
+
formatters << "--format progress" if formatters.any?
|
80
|
+
|
81
|
+
command = [
|
82
|
+
"bundle exec rubocop",
|
83
|
+
"--parallel",
|
84
|
+
rubocop_requires.join(" "),
|
85
|
+
formatters.join(" "),
|
86
|
+
"--force-exclusion",
|
87
|
+
"--config", config_file,
|
88
|
+
pass_through_option(options, "auto-correct"),
|
89
|
+
pass_through_flag(options, "only"),
|
90
|
+
files
|
91
|
+
].join(" ")
|
92
|
+
|
93
|
+
system(command)
|
79
94
|
end
|
80
95
|
|
81
96
|
desc "regen_backlog", "update the RuboCop backlog, disabling offending files and excluding all cops with over 500 violating files."
|
@@ -235,7 +250,9 @@ module Nucop
|
|
235
250
|
end
|
236
251
|
|
237
252
|
def enabled_cops
|
238
|
-
YAML.load(`bundle exec rubocop --parallel --show-cops`)
|
253
|
+
YAML.load(`bundle exec rubocop --parallel --show-cops`) # rubocop:disable Security/YAMLLoad
|
254
|
+
.select { |_, config| config["Enabled"] }
|
255
|
+
.map(&:first)
|
239
256
|
end
|
240
257
|
|
241
258
|
# Override Thor's options method to include Nucop's options
|
@@ -21,16 +21,17 @@ module Nucop
|
|
21
21
|
# One test case per cop per file
|
22
22
|
COPS.each do |cop|
|
23
23
|
cop_offences = offences.select { |offence| offence.cop_name == cop.cop_name }
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
24
|
+
|
25
|
+
next if cop_offences.empty?
|
26
|
+
|
27
|
+
REXML::Element.new("testcase", @testsuite).tap do |f|
|
28
|
+
f.attributes["classname"] = file.gsub(/\.rb\Z/, "").gsub("#{Dir.pwd}/", "").tr("/", ".")
|
29
|
+
f.attributes["name"] = "Rubocop: #{cop.cop_name}"
|
30
|
+
f.attributes["file"] = cop.cop_name
|
31
|
+
cop_offences.each do |offence|
|
32
|
+
REXML::Element.new("failure", f).tap do |e|
|
33
|
+
e.add_text("#{offence.message}\n\n")
|
34
|
+
e.add_text(offence.location.to_s.sub("/usr/src/app/", ""))
|
34
35
|
end
|
35
36
|
end
|
36
37
|
end
|
data/lib/nucop/version.rb
CHANGED
metadata
CHANGED
@@ -1,127 +1,127 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nucop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason Schweier
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-07-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: git_diff_parser
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
20
|
-
type: :
|
19
|
+
version: '3.2'
|
20
|
+
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: '3.2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: rubocop
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
34
|
-
type: :
|
33
|
+
version: 0.88.0
|
34
|
+
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 0.88.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: rubocop-performance
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - '='
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 1.7.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - '='
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 1.7.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name: rubocop
|
56
|
+
name: rubocop-rails
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - '='
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: 2.6.0
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - '='
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
68
|
+
version: 2.6.0
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name: rubocop-
|
70
|
+
name: rubocop-rspec
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - '='
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 1.
|
75
|
+
version: 1.42.0
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - '='
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 1.
|
82
|
+
version: 1.42.0
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: ruby-progressbar
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
89
|
+
version: '1.10'
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
96
|
+
version: '1.10'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
98
|
+
name: rake
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
104
|
-
type: :
|
103
|
+
version: 13.0.1
|
104
|
+
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
108
|
+
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version:
|
110
|
+
version: 13.0.1
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
112
|
+
name: rspec
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
115
|
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version:
|
118
|
-
type: :
|
117
|
+
version: 3.9.0
|
118
|
+
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version:
|
124
|
+
version: 3.9.0
|
125
125
|
description:
|
126
126
|
email:
|
127
127
|
- jasons@nulogy.com
|
@@ -148,9 +148,14 @@ files:
|
|
148
148
|
- lib/nucop/helpers/next_cop_for_promotion.rb
|
149
149
|
- lib/nucop/version.rb
|
150
150
|
- spec/spec_helper.rb
|
151
|
-
homepage:
|
152
|
-
licenses:
|
153
|
-
|
151
|
+
homepage: https://rubygems.org/gems/nucop
|
152
|
+
licenses:
|
153
|
+
- MIT
|
154
|
+
metadata:
|
155
|
+
homepage_uri: https://github.com/nulogy/nucop
|
156
|
+
changelog_uri: https://github.com/nulogy/nucop/blob/master/CHANGELOG.md
|
157
|
+
source_code_uri: https://github.com/nulogy/nucop
|
158
|
+
bug_tracker_uri: https://github.com/nulogy/nucop/issues
|
154
159
|
post_install_message:
|
155
160
|
rdoc_options: []
|
156
161
|
require_paths:
|
@@ -166,8 +171,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
166
171
|
- !ruby/object:Gem::Version
|
167
172
|
version: '0'
|
168
173
|
requirements: []
|
169
|
-
|
170
|
-
rubygems_version: 2.7.6
|
174
|
+
rubygems_version: 3.1.4
|
171
175
|
signing_key:
|
172
176
|
specification_version: 4
|
173
177
|
summary: Nulogy's implementation of RuboCop, including custom cops and additional
|