nucop 0.2.0 → 0.3.3
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 +35 -35
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4e4d4bc70ff2bafe59ff5f5d0f139076cb223f45127c0af10879d7ca59e6ad58
|
4
|
+
data.tar.gz: 1eb6b93afe63711f4663959b62fc584d86b8f0cb2808311018b3fb125c312c30
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9718086bfdf283e30fa209b9ca997092f2eca1c417cc259e0490d1f25a02ca18103e3a8a6c07019a196889b854bbb1137000e46b3c626d70d451033923142713
|
7
|
+
data.tar.gz: c5d56ef473496fadc2a544e6cdd1f2faf6ab83c0b94c0324aa9cfeb00b46be41769314479f7202fcf285edcb8fa8d2f7543ba0df31f1eec6d3c5c27fec40accd
|
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.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason Schweier
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-09-02 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.90.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.90.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.1
|
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.1
|
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.7.1
|
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.7.1
|
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.43.2
|
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.43.2
|
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
|
@@ -171,7 +171,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
171
171
|
- !ruby/object:Gem::Version
|
172
172
|
version: '0'
|
173
173
|
requirements: []
|
174
|
-
rubygems_version: 3.1.
|
174
|
+
rubygems_version: 3.1.4
|
175
175
|
signing_key:
|
176
176
|
specification_version: 4
|
177
177
|
summary: Nulogy's implementation of RuboCop, including custom cops and additional
|