Skip to content

Commit a231cf9

Browse files
committed
Fix latest violations found by Devtools
- Removes one mutation in `Unparser::Commenter` that was introduced for mbj#30 but seems to no longer require checking if `node.location` exists. - Resyncs corpus integrations and adds `repo_ref` from mutant's corpus - Add Gemfile.lock for deterministic builds - Reduce unit test timeout to 100ms The slowest unit tests still run much faster that 100ms and this seems to reduce the total runtime of mutant because certain mutations don't end up wasintg two seconds a piece. Running mutant before this change on my machine: Runtime: 209.20s Killtime: 959.65s After: Runtime: 153.32s Killtime: 460.45s - Update the mutant rake task to use the appropriate amount of jobs on circle. Before this was contributing to mutant timing out the build
1 parent 88ed08d commit a231cf9

24 files changed

Lines changed: 340 additions & 108 deletions

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ measurements
3232

3333
## BUNDLER
3434
.bundle
35-
Gemfile.lock
3635

3736
## PROJECT::SPECIFIC
3837
/vendor

Gemfile.lock

Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
PATH
2+
remote: .
3+
specs:
4+
unparser (0.2.5)
5+
abstract_type (~> 0.0.7)
6+
adamantium (~> 0.2.0)
7+
concord (~> 0.1.5)
8+
diff-lcs (~> 1.2.5)
9+
equalizer (~> 0.0.9)
10+
parser (~> 2.3.0)
11+
procto (~> 0.0.2)
12+
13+
GEM
14+
remote: https://rubygems.org/
15+
specs:
16+
abstract_type (0.0.7)
17+
adamantium (0.2.0)
18+
ice_nine (~> 0.11.0)
19+
memoizable (~> 0.4.0)
20+
anima (0.3.0)
21+
abstract_type (~> 0.0.7)
22+
adamantium (~> 0.2)
23+
equalizer (~> 0.0.11)
24+
ast (2.3.0)
25+
axiom-types (0.1.1)
26+
descendants_tracker (~> 0.0.4)
27+
ice_nine (~> 0.11.0)
28+
thread_safe (~> 0.3, >= 0.3.1)
29+
codeclimate-engine-rb (0.4.0)
30+
virtus (~> 1.0)
31+
coercible (1.0.0)
32+
descendants_tracker (~> 0.0.1)
33+
concord (0.1.5)
34+
adamantium (~> 0.2.0)
35+
equalizer (~> 0.0.9)
36+
descendants_tracker (0.0.4)
37+
thread_safe (~> 0.3, >= 0.3.1)
38+
devtools (0.1.16)
39+
adamantium (~> 0.2.0)
40+
anima (~> 0.3.0)
41+
concord (~> 0.1.5)
42+
flay (~> 2.8.1)
43+
flog (~> 4.4.0)
44+
mutant (~> 0.8.11)
45+
mutant-rspec (~> 0.8.11)
46+
procto (~> 0.0.3)
47+
rake (~> 11.3.0)
48+
reek (~> 4.5.0)
49+
rspec (~> 3.5.0)
50+
rspec-core (~> 3.5.4)
51+
rspec-its (~> 1.2.0)
52+
rubocop (~> 0.47.0)
53+
simplecov (~> 0.12.0)
54+
yard (~> 0.9.1)
55+
yardstick (~> 0.9.9)
56+
diff-lcs (1.2.5)
57+
docile (1.1.5)
58+
equalizer (0.0.11)
59+
erubis (2.7.0)
60+
flay (2.8.1)
61+
erubis (~> 2.7.0)
62+
path_expander (~> 1.0)
63+
ruby_parser (~> 3.0)
64+
sexp_processor (~> 4.0)
65+
flog (4.4.1)
66+
path_expander (~> 1.0)
67+
ruby_parser (~> 3.1, > 3.1.0)
68+
sexp_processor (~> 4.4)
69+
ice_nine (0.11.2)
70+
json (2.0.3)
71+
memoizable (0.4.2)
72+
thread_safe (~> 0.3, >= 0.3.1)
73+
morpher (0.2.6)
74+
abstract_type (~> 0.0.7)
75+
adamantium (~> 0.2.0)
76+
anima (~> 0.3.0)
77+
ast (~> 2.2)
78+
concord (~> 0.1.5)
79+
equalizer (~> 0.0.9)
80+
ice_nine (~> 0.11.0)
81+
procto (~> 0.0.2)
82+
mutant (0.8.12)
83+
abstract_type (~> 0.0.7)
84+
adamantium (~> 0.2.0)
85+
anima (~> 0.3.0)
86+
ast (~> 2.2)
87+
concord (~> 0.1.5)
88+
diff-lcs (~> 1.2)
89+
equalizer (~> 0.0.9)
90+
ice_nine (~> 0.11.1)
91+
memoizable (~> 0.4.2)
92+
morpher (~> 0.2.6)
93+
parallel (~> 1.3)
94+
parser (~> 2.3.1, >= 2.3.1.4)
95+
procto (~> 0.0.2)
96+
regexp_parser (~> 0.3.6)
97+
unparser (~> 0.2.5)
98+
mutant-rspec (0.8.11)
99+
mutant (~> 0.8.11)
100+
rspec-core (>= 3.4.0, < 3.6.0)
101+
parallel (1.10.0)
102+
parser (2.3.3.1)
103+
ast (~> 2.2)
104+
path_expander (1.0.1)
105+
powerpack (0.1.1)
106+
procto (0.0.3)
107+
rainbow (2.2.1)
108+
rake (11.3.0)
109+
reek (4.5.4)
110+
codeclimate-engine-rb (~> 0.4.0)
111+
parser (~> 2.3.1, >= 2.3.1.2)
112+
rainbow (~> 2.0)
113+
regexp_parser (0.3.6)
114+
rspec (3.5.0)
115+
rspec-core (~> 3.5.0)
116+
rspec-expectations (~> 3.5.0)
117+
rspec-mocks (~> 3.5.0)
118+
rspec-core (3.5.4)
119+
rspec-support (~> 3.5.0)
120+
rspec-expectations (3.5.0)
121+
diff-lcs (>= 1.2.0, < 2.0)
122+
rspec-support (~> 3.5.0)
123+
rspec-its (1.2.0)
124+
rspec-core (>= 3.0.0)
125+
rspec-expectations (>= 3.0.0)
126+
rspec-mocks (3.5.0)
127+
diff-lcs (>= 1.2.0, < 2.0)
128+
rspec-support (~> 3.5.0)
129+
rspec-support (3.5.0)
130+
rubocop (0.47.1)
131+
parser (>= 2.3.3.1, < 3.0)
132+
powerpack (~> 0.1)
133+
rainbow (>= 1.99.1, < 3.0)
134+
ruby-progressbar (~> 1.7)
135+
unicode-display_width (~> 1.0, >= 1.0.1)
136+
ruby-progressbar (1.8.1)
137+
ruby_parser (3.8.4)
138+
sexp_processor (~> 4.1)
139+
sexp_processor (4.7.0)
140+
simplecov (0.12.0)
141+
docile (~> 1.1.0)
142+
json (>= 1.8, < 3)
143+
simplecov-html (~> 0.10.0)
144+
simplecov-html (0.10.0)
145+
thread_safe (0.3.5)
146+
unicode-display_width (1.1.3)
147+
virtus (1.0.5)
148+
axiom-types (~> 0.1)
149+
coercible (~> 1.0)
150+
descendants_tracker (~> 0.0, >= 0.0.3)
151+
equalizer (~> 0.0, >= 0.0.9)
152+
yard (0.9.8)
153+
yardstick (0.9.9)
154+
yard (~> 0.8, >= 0.8.7.2)
155+
156+
PLATFORMS
157+
ruby
158+
159+
DEPENDENCIES
160+
anima (~> 0.3.0)
161+
devtools (~> 0.1.3)
162+
morpher (~> 0.2.6)
163+
unparser!
164+
165+
BUNDLED WITH
166+
1.13.2

Rakefile

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,16 @@ task('metrics:mutant').clear
66

77
namespace :metrics do
88
task mutant: :coverage do
9-
system(*%w[
9+
args = %w[
1010
bundle exec mutant
11-
--include lib
12-
--require unparser
13-
--use rspec
14-
--zombie
15-
--since HEAD~1
16-
--
17-
Unparser*
18-
]) or fail "Mutant task failed"
11+
--include lib
12+
--require unparser
13+
--use rspec
14+
--zombie
15+
--since HEAD~1
16+
]
17+
args.concat(%w[--jobs 4]) if ENV.key?('CIRCLECI')
18+
19+
system(*args.concat(%w[-- Unparser*])) or fail "Mutant task failed"
1920
end
2021
end

config/devtools.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
unit_test_timeout: 2.0
2+
unit_test_timeout: 0.1

config/flay.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
---
22
threshold: 13
3-
total_score: 673
3+
total_score: 659

config/rubocop.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ AllCops:
55
- '**/*.rake'
66
- 'Gemfile'
77
- 'Gemfile.triage'
8+
TargetRubyVersion: 2.1
89

910
# Avoid parameter lists longer than five parameters.
1011
ParameterLists:
@@ -37,6 +38,23 @@ LineLength:
3738
ClassLength:
3839
Max: 204
3940

41+
# Prefer modifiers and explicit if statements over returning early for small methods
42+
GuardClause:
43+
Enabled: false
44+
45+
Metrics/BlockLength:
46+
Exclude:
47+
# Ignore RSpec DSL
48+
- spec/**/*
49+
50+
# Flags freezes for singletons that could still be mutated like Regexps
51+
RedundantFreeze:
52+
Enabled: false
53+
54+
# Allow Fixnum and Bignum. This Gem supports versions before 2.4
55+
UnifiedInteger:
56+
Enabled: false
57+
4058
# Disabled because of indenting with private keyword in class bodies.
4159
IndentationWidth:
4260
Enabled: false

lib/unparser/ast.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
module Unparser
22
# Namespace for AST processing tools
3+
# :reek:TooManyConstants
34
module AST
45

56
FIRST_CHILD = ->(node) { node.children.first }.freeze

lib/unparser/cli.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99

1010
module Unparser
1111
# Unparser CLI implementation
12+
#
13+
# :reek:InstanceVariableAssumption
1214
class CLI
1315

1416
EXIT_SUCCESS = 0
@@ -148,10 +150,9 @@ def effective_sources
148150
#
149151
def sources(file_name)
150152
files =
151-
case
152-
when File.directory?(file_name)
153+
if File.directory?(file_name)
153154
Dir.glob(File.join(file_name, '**/*.rb')).sort
154-
when File.file?(file_name)
155+
elsif File.file?(file_name)
155156
[file_name]
156157
else
157158
Dir.glob(file_name).sort

lib/unparser/cli/color.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class Color
1212
# @api private
1313
#
1414
def format(text)
15-
"\e[#{@code}m#{text}\e[0m"
15+
"\e[#{code}m#{text}\e[0m"
1616
end
1717

1818
NONE = Class.new(self) do
@@ -38,8 +38,7 @@ def format(text)
3838
#
3939
# @api private
4040
#
41-
def initialize
42-
end
41+
def initialize; end
4342

4443
end.new
4544

0 commit comments

Comments
 (0)