warder 0.0.4 → 0.0.5
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/.travis.yml +9 -0
- data/README.md +3 -0
- data/Rakefile +5 -5
- data/bin/warder +7 -2
- data/features/detects_code_duplications.feature +1 -1
- data/features/detects_code_smells.feature +22 -0
- data/features/step_definitions/detects_code_smells_steps.rb +8 -0
- data/lib/warder.rb +2 -1
- data/lib/warder/cli.rb +15 -4
- data/lib/warder/{code_duplication_runner.rb → code_duplications_runner.rb} +2 -2
- data/lib/warder/code_smells_runner.rb +20 -0
- data/lib/warder/version.rb +1 -1
- data/spec/fixtures/invalid_code_smells.rb +4 -0
- data/spec/fixtures/valid.rb +1 -0
- data/warder.gemspec +1 -1
- metadata +24 -3
- data/rubocop-todo.yml +0 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fc8cbd6a237c8d556bc4687b9b60e9e15f85f949
|
4
|
+
data.tar.gz: 2a924aac4f06f29fc2b0d4316d0be2bfb9781985
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2db930a7f422e391811b59e8af1fc81ae3aa4b348887f7339550f819ccf567122570ac906de866e46cced52a8c1ffc23b956c70c6e78d32f4b2fe9dbcaab35c8
|
7
|
+
data.tar.gz: 70a4af9fe6971c9587db930cd7d6bb24fa29dc77a8a69e1b3e7cc6b0e867cecc3f13e2d7f36e12769184375943b5ff4f5b2a1de7bbca61b628e80b57952e8a46
|
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
# Warder
|
2
2
|
|
3
|
+
[](https://travis-ci.org/yltsrc/warder)
|
4
|
+
[](https://codeclimate.com/github/yltsrc/warder)
|
5
|
+
|
3
6
|
TODO: Write a gem description
|
4
7
|
|
5
8
|
## Installation
|
data/Rakefile
CHANGED
@@ -43,11 +43,11 @@ namespace :cucumber do
|
|
43
43
|
end
|
44
44
|
|
45
45
|
desc 'Alias for cucumber:ok'
|
46
|
-
task :
|
46
|
+
task cucumber: 'cucumber:ok'
|
47
47
|
|
48
48
|
desc 'Alias for spec:ok'
|
49
|
-
task :
|
49
|
+
task spec: 'spec:ok'
|
50
50
|
|
51
|
-
task :
|
52
|
-
task :
|
53
|
-
task :
|
51
|
+
task wip: %w(spec:wip cucumber:wip)
|
52
|
+
task all: %w(spec:all cucumber:all)
|
53
|
+
task default: %w(spec cucumber)
|
data/bin/warder
CHANGED
@@ -8,12 +8,12 @@ require 'warder'
|
|
8
8
|
options = {}
|
9
9
|
OptionParser.new do |opts|
|
10
10
|
desc = 'Run style guide validation'
|
11
|
-
opts.on('-
|
11
|
+
opts.on('-g', '--[no-]style-guide', desc) do |value|
|
12
12
|
options[:style_guide] = value
|
13
13
|
end
|
14
14
|
|
15
15
|
desc = 'Run magick numbers validation'
|
16
|
-
opts.on('-
|
16
|
+
opts.on('-m', '--[no-]magick-numbers', desc) do |value|
|
17
17
|
options[:magick_numbers] = value
|
18
18
|
end
|
19
19
|
|
@@ -21,6 +21,11 @@ OptionParser.new do |opts|
|
|
21
21
|
opts.on('-d', '--[no-]code-duplications', desc) do |value|
|
22
22
|
options[:code_duplications] = value
|
23
23
|
end
|
24
|
+
|
25
|
+
desc = 'Run code smells validation'
|
26
|
+
opts.on('-s', '--[no-]code-smells', desc) do |value|
|
27
|
+
options[:code_smells] = value
|
28
|
+
end
|
24
29
|
end.parse!
|
25
30
|
|
26
31
|
Warder::CLI.new(options).perform
|
@@ -16,7 +16,7 @@ Feature: detects code duplications
|
|
16
16
|
Then the exit status should be 1
|
17
17
|
|
18
18
|
Scenario: run warder with disabled code duplications option on invalid file
|
19
|
-
Given I have
|
19
|
+
Given I have invalid_code_duplications file in directory
|
20
20
|
When I run `warder --no-code-duplications`
|
21
21
|
Then warder does nothing
|
22
22
|
Then the exit status should be 0
|
@@ -0,0 +1,22 @@
|
|
1
|
+
Feature: detects code smells
|
2
|
+
In order to find code smells
|
3
|
+
As a ruby developer
|
4
|
+
I want to run warder with --code-smells option
|
5
|
+
|
6
|
+
Scenario: run warder with enabled code smells option
|
7
|
+
Given I have valid file in directory
|
8
|
+
When I run `warder --code-smells`
|
9
|
+
Then warder detects code smells
|
10
|
+
Then the exit status should be 0
|
11
|
+
|
12
|
+
Scenario: run warder with enabled code smells option on invalid file
|
13
|
+
Given I have invalid_code_smells file in directory
|
14
|
+
When I run `warder --code-smells`
|
15
|
+
Then warder detects code smells
|
16
|
+
Then the exit status should be 1
|
17
|
+
|
18
|
+
Scenario: run warder with disabled code smells option on invalid file
|
19
|
+
Given I have invalid_code_smells file in directory
|
20
|
+
When I run `warder --no-code-smells`
|
21
|
+
Then warder does nothing
|
22
|
+
Then the exit status should be 0
|
@@ -0,0 +1,8 @@
|
|
1
|
+
Then(/^warder detects code smells$/) do
|
2
|
+
executing_reek_output = "executing 'reek .'"
|
3
|
+
success_reek_output = `cd spec/fixtures/ && reek #{@filename}`
|
4
|
+
step "the output should contain \"#{executing_reek_output}\""
|
5
|
+
success_reek_output.split("\n").each do |string|
|
6
|
+
step "the output should contain \"#{string.sub('spec/fixtures/', './')}\""
|
7
|
+
end
|
8
|
+
end
|
data/lib/warder.rb
CHANGED
@@ -2,5 +2,6 @@ require 'warder/version'
|
|
2
2
|
require 'warder/runner'
|
3
3
|
require 'warder/style_guide_runner'
|
4
4
|
require 'warder/magick_numbers_runner'
|
5
|
-
require 'warder/
|
5
|
+
require 'warder/code_duplications_runner'
|
6
|
+
require 'warder/code_smells_runner'
|
6
7
|
require 'warder/cli'
|
data/lib/warder/cli.rb
CHANGED
@@ -6,8 +6,10 @@ module Warder
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def perform
|
9
|
-
exit perform_style_guide_validation +
|
10
|
-
|
9
|
+
exit perform_style_guide_validation +
|
10
|
+
perform_magick_numbers_validation +
|
11
|
+
perform_code_duplications_validation +
|
12
|
+
perform_code_smells_validation
|
11
13
|
end
|
12
14
|
|
13
15
|
private
|
@@ -30,9 +32,18 @@ module Warder
|
|
30
32
|
end
|
31
33
|
end
|
32
34
|
|
33
|
-
def
|
35
|
+
def perform_code_duplications_validation
|
34
36
|
if @options[:code_duplications]
|
35
|
-
runner =
|
37
|
+
runner = CodeDuplicationsRunner.new(@options)
|
38
|
+
runner.perform
|
39
|
+
else
|
40
|
+
0
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def perform_code_smells_validation
|
45
|
+
if @options[:code_smells]
|
46
|
+
runner = CodeSmellsRunner.new(@options)
|
36
47
|
runner.perform
|
37
48
|
else
|
38
49
|
0
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Warder
|
2
|
+
# responsible for run code smells validation
|
3
|
+
class CodeSmellsRunner < Runner
|
4
|
+
def initialize(options = {})
|
5
|
+
@options = options
|
6
|
+
end
|
7
|
+
|
8
|
+
private
|
9
|
+
|
10
|
+
def command
|
11
|
+
'reek .'
|
12
|
+
end
|
13
|
+
|
14
|
+
def failed?(line)
|
15
|
+
match = line.match(/ -- (\d+) warnings?:/)
|
16
|
+
|
17
|
+
match && match[1].to_i != 0
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/lib/warder/version.rb
CHANGED
data/spec/fixtures/valid.rb
CHANGED
data/warder.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: warder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yura Tolstik
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: reek
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: flay
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -145,6 +159,7 @@ extensions: []
|
|
145
159
|
extra_rdoc_files: []
|
146
160
|
files:
|
147
161
|
- .gitignore
|
162
|
+
- .travis.yml
|
148
163
|
- Gemfile
|
149
164
|
- LICENSE.txt
|
150
165
|
- README.md
|
@@ -152,9 +167,11 @@ files:
|
|
152
167
|
- bin/warder
|
153
168
|
- cucumber.yml
|
154
169
|
- features/detects_code_duplications.feature
|
170
|
+
- features/detects_code_smells.feature
|
155
171
|
- features/detects_magick_numbers.feature
|
156
172
|
- features/run.feature
|
157
173
|
- features/step_definitions/detects_code_duplications_steps.rb
|
174
|
+
- features/step_definitions/detects_code_smells_steps.rb
|
158
175
|
- features/step_definitions/detects_magick_numbers_steps.rb
|
159
176
|
- features/step_definitions/run_steps.rb
|
160
177
|
- features/step_definitions/validates_style_guide_steps.rb
|
@@ -162,13 +179,14 @@ files:
|
|
162
179
|
- features/validates_style_guide.feature
|
163
180
|
- lib/warder.rb
|
164
181
|
- lib/warder/cli.rb
|
165
|
-
- lib/warder/
|
182
|
+
- lib/warder/code_duplications_runner.rb
|
183
|
+
- lib/warder/code_smells_runner.rb
|
166
184
|
- lib/warder/magick_numbers_runner.rb
|
167
185
|
- lib/warder/runner.rb
|
168
186
|
- lib/warder/style_guide_runner.rb
|
169
187
|
- lib/warder/version.rb
|
170
|
-
- rubocop-todo.yml
|
171
188
|
- spec/fixtures/invalid_code_duplications.rb
|
189
|
+
- spec/fixtures/invalid_code_smells.rb
|
172
190
|
- spec/fixtures/invalid_magick_numbers.rb
|
173
191
|
- spec/fixtures/invalid_style_guide.rb
|
174
192
|
- spec/fixtures/strictly_invalid_style_guide.rb
|
@@ -201,15 +219,18 @@ specification_version: 4
|
|
201
219
|
summary: Warder of ruby code
|
202
220
|
test_files:
|
203
221
|
- features/detects_code_duplications.feature
|
222
|
+
- features/detects_code_smells.feature
|
204
223
|
- features/detects_magick_numbers.feature
|
205
224
|
- features/run.feature
|
206
225
|
- features/step_definitions/detects_code_duplications_steps.rb
|
226
|
+
- features/step_definitions/detects_code_smells_steps.rb
|
207
227
|
- features/step_definitions/detects_magick_numbers_steps.rb
|
208
228
|
- features/step_definitions/run_steps.rb
|
209
229
|
- features/step_definitions/validates_style_guide_steps.rb
|
210
230
|
- features/support/env.rb
|
211
231
|
- features/validates_style_guide.feature
|
212
232
|
- spec/fixtures/invalid_code_duplications.rb
|
233
|
+
- spec/fixtures/invalid_code_smells.rb
|
213
234
|
- spec/fixtures/invalid_magick_numbers.rb
|
214
235
|
- spec/fixtures/invalid_style_guide.rb
|
215
236
|
- spec/fixtures/strictly_invalid_style_guide.rb
|
data/rubocop-todo.yml
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
# This configuration was generated by `rubocop --auto-gen-config`.
|
2
|
-
# The point is for the user to remove these configuration records
|
3
|
-
# one by one as the offences are removed from the code base.
|
4
|
-
|
5
|
-
AssignmentInCondition:
|
6
|
-
Enabled: false
|
7
|
-
|
8
|
-
Documentation:
|
9
|
-
Enabled: false
|
10
|
-
|
11
|
-
EmptyLinesAroundBody:
|
12
|
-
Enabled: false
|
13
|
-
|
14
|
-
IfUnlessModifier:
|
15
|
-
Enabled: false
|
16
|
-
|
17
|
-
UselessAssignment:
|
18
|
-
Enabled: false
|