warder 0.3.2 → 0.3.4

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.
Files changed (98) hide show
  1. checksums.yaml +4 -4
  2. data/lib/warder/version.rb +1 -1
  3. metadata +26 -214
  4. data/.gitignore +0 -20
  5. data/.travis.yml +0 -15
  6. data/Gemfile +0 -4
  7. data/LICENSE.txt +0 -22
  8. data/README.md +0 -130
  9. data/Rakefile +0 -53
  10. data/cucumber.yml +0 -4
  11. data/features/checks_for_all_issues.feature +0 -36
  12. data/features/checks_for_rails_best_practices.feature +0 -25
  13. data/features/checks_for_rails_related_issues.feature +0 -27
  14. data/features/checks_for_rails_security_issues.feature +0 -25
  15. data/features/checks_for_sandi_metz_rules.feature +0 -25
  16. data/features/checks_for_vulnerable_gems.feature +0 -25
  17. data/features/detects_code_complexity.feature +0 -29
  18. data/features/detects_code_duplication.feature +0 -32
  19. data/features/detects_code_smell.feature +0 -29
  20. data/features/detects_magick_numbers.feature +0 -29
  21. data/features/quiet.feature +0 -10
  22. data/features/run.feature +0 -9
  23. data/features/show_version.feature +0 -8
  24. data/features/statistics.feature +0 -22
  25. data/features/step_definitions/checks_for_rails_best_practices_steps.rb +0 -14
  26. data/features/step_definitions/checks_for_rails_security_issues_steps.rb +0 -24
  27. data/features/step_definitions/checks_for_sandi_metz_rules_step.rb +0 -7
  28. data/features/step_definitions/checks_for_vulnerable_gems_steps.rb +0 -15
  29. data/features/step_definitions/detects_code_complexity_steps.rb +0 -11
  30. data/features/step_definitions/detects_code_duplication_steps.rb +0 -7
  31. data/features/step_definitions/detects_code_smell_steps.rb +0 -7
  32. data/features/step_definitions/detects_magick_numbers_steps.rb +0 -7
  33. data/features/step_definitions/run_steps.rb +0 -38
  34. data/features/step_definitions/show_version_steps.rb +0 -3
  35. data/features/step_definitions/statistics_steps.rb +0 -4
  36. data/features/step_definitions/validates_coffeescript_style_guide_steps.rb +0 -12
  37. data/features/step_definitions/validates_ruby_style_guide_steps.rb +0 -7
  38. data/features/support/env.rb +0 -23
  39. data/features/validates_coffeescript_style_guide.feature +0 -29
  40. data/features/validates_ruby_style_guide.feature +0 -29
  41. data/spec/fixtures/invalid_code_complexity.rb +0 -13
  42. data/spec/fixtures/invalid_code_duplication.rb +0 -40
  43. data/spec/fixtures/invalid_code_smell.rb +0 -4
  44. data/spec/fixtures/invalid_coffee_lint.coffee +0 -6
  45. data/spec/fixtures/invalid_magick_numbers.rb +0 -1
  46. data/spec/fixtures/invalid_rails_app/Gemfile +0 -4
  47. data/spec/fixtures/invalid_rails_app/Gemfile_lock +0 -82
  48. data/spec/fixtures/invalid_rails_app/Rakefile +0 -6
  49. data/spec/fixtures/invalid_rails_app/app/assets/javascripts/invalid_coffee_lint.coffee +0 -6
  50. data/spec/fixtures/invalid_rails_app/app/controllers/application_controller.rb +0 -19
  51. data/spec/fixtures/invalid_rails_app/app/models/user.rb +0 -5
  52. data/spec/fixtures/invalid_rails_app/app/views/layouts/application.html.erb +0 -14
  53. data/spec/fixtures/invalid_rails_app/config.ru +0 -4
  54. data/spec/fixtures/invalid_rails_app/config/application.rb +0 -24
  55. data/spec/fixtures/invalid_rails_app/config/boot.rb +0 -4
  56. data/spec/fixtures/invalid_rails_app/config/database.yml +0 -25
  57. data/spec/fixtures/invalid_rails_app/config/environment.rb +0 -5
  58. data/spec/fixtures/invalid_rails_app/config/environments/development.rb +0 -29
  59. data/spec/fixtures/invalid_rails_app/config/environments/production.rb +0 -80
  60. data/spec/fixtures/invalid_rails_app/config/environments/test.rb +0 -36
  61. data/spec/fixtures/invalid_rails_app/config/initializers/backtrace_silencers.rb +0 -7
  62. data/spec/fixtures/invalid_rails_app/config/initializers/filter_parameter_logging.rb +0 -4
  63. data/spec/fixtures/invalid_rails_app/config/initializers/inflections.rb +0 -16
  64. data/spec/fixtures/invalid_rails_app/config/initializers/mime_types.rb +0 -5
  65. data/spec/fixtures/invalid_rails_app/config/initializers/secret_token.rb +0 -12
  66. data/spec/fixtures/invalid_rails_app/config/initializers/session_store.rb +0 -3
  67. data/spec/fixtures/invalid_rails_app/config/initializers/wrap_parameters.rb +0 -14
  68. data/spec/fixtures/invalid_rails_app/config/locales/en.yml +0 -23
  69. data/spec/fixtures/invalid_rails_app/config/routes.rb +0 -5
  70. data/spec/fixtures/invalid_rails_app/lib/invalid_code_complexity.rb +0 -13
  71. data/spec/fixtures/invalid_rails_app/lib/invalid_code_duplication.rb +0 -40
  72. data/spec/fixtures/invalid_style_guide.rb +0 -3
  73. data/spec/fixtures/strictly_invalid_style_guide.rb +0 -3
  74. data/spec/fixtures/valid.rb +0 -1
  75. data/spec/fixtures/valid_coffee_lint.coffee +0 -6
  76. data/spec/fixtures/valid_rails_app/Gemfile +0 -5
  77. data/spec/fixtures/valid_rails_app/Gemfile_lock +0 -105
  78. data/spec/fixtures/valid_rails_app/Rakefile +0 -7
  79. data/spec/fixtures/valid_rails_app/app/assets/javascripts/valid.coffee +0 -6
  80. data/spec/fixtures/valid_rails_app/app/controllers/application_controller.rb +0 -6
  81. data/spec/fixtures/valid_rails_app/app/views/layouts/application.html.erb +0 -14
  82. data/spec/fixtures/valid_rails_app/config.ru +0 -4
  83. data/spec/fixtures/valid_rails_app/config/application.rb +0 -29
  84. data/spec/fixtures/valid_rails_app/config/boot.rb +0 -4
  85. data/spec/fixtures/valid_rails_app/config/database.yml +0 -25
  86. data/spec/fixtures/valid_rails_app/config/environment.rb +0 -5
  87. data/spec/fixtures/valid_rails_app/config/environments/development.rb +0 -30
  88. data/spec/fixtures/valid_rails_app/config/environments/production.rb +0 -86
  89. data/spec/fixtures/valid_rails_app/config/environments/test.rb +0 -37
  90. data/spec/fixtures/valid_rails_app/config/initializers/filter_parameter_logging.rb +0 -4
  91. data/spec/fixtures/valid_rails_app/config/initializers/mime_types.rb +0 -5
  92. data/spec/fixtures/valid_rails_app/config/initializers/secret_token.rb +0 -13
  93. data/spec/fixtures/valid_rails_app/config/initializers/session_store.rb +0 -3
  94. data/spec/fixtures/valid_rails_app/config/initializers/wrap_parameters.rb +0 -15
  95. data/spec/fixtures/valid_rails_app/config/locales/en.yml +0 -23
  96. data/spec/fixtures/valid_rails_app/config/routes.rb +0 -2
  97. data/spec/spec_helper.rb +0 -8
  98. data/warder.gemspec +0 -38
@@ -1,29 +0,0 @@
1
- Feature: detects code smell
2
- In order to find code smell
3
- As a ruby developer
4
- I want to run warder with --code-smell option
5
-
6
- Scenario: run warder with enabled code smell option
7
- Given I have valid file in directory
8
- When I run `warder --code-smell`
9
- Then warder detects code smell issues
10
- Then the exit status should be 0
11
-
12
- Scenario: run warder with enabled code smell option on invalid file
13
- Given I have invalid_code_smell file in directory
14
- When I run `warder --code-smell`
15
- Then warder detects code smell issues
16
- Then the exit status should be 1
17
-
18
- Scenario: run warder with enabled code smell option on valid file only
19
- Given I have valid file in directory
20
- And I have invalid_code_smell file in directory
21
- When I run `warder --code-smell valid.rb`
22
- Then warder does nothing
23
- Then the exit status should be 0
24
-
25
- Scenario: run warder with disabled code smell option on invalid file
26
- Given I have invalid_code_smell file in directory
27
- When I run `warder --no-code-smell`
28
- Then warder does nothing
29
- Then the exit status should be 0
@@ -1,29 +0,0 @@
1
- Feature: detects magick numbers
2
- In order to find magick numbers
3
- As a ruby developer
4
- I want to run warder with --magick-numbers option
5
-
6
- Scenario: run warder with enabled magick numbers option
7
- Given I have valid file in directory
8
- When I run `warder --magick-numbers`
9
- Then warder detects magick numbers issues
10
- Then the exit status should be 0
11
-
12
- Scenario: run warder with enabled magick numbers option on invalid file
13
- Given I have invalid_magick_numbers file in directory
14
- When I run `warder --magick-numbers`
15
- Then warder detects magick numbers issues
16
- Then the exit status should be 1
17
-
18
- Scenario: run warder with enabled magick numbers option on valid file only
19
- Given I have valid file in directory
20
- And I have invalid_magick_numbers file in directory
21
- When I run `warder --magick-numbers valid.rb`
22
- Then warder does nothing
23
- Then the exit status should be 0
24
-
25
- Scenario: run warder with disabled style guide option on invalid file
26
- Given I have invalid_magick_numbers file in directory
27
- When I run `warder --no-magick-numbers`
28
- Then warder does nothing
29
- Then the exit status should be 0
@@ -1,10 +0,0 @@
1
- Feature: run warder in quiet mode
2
- In order to silent validators output
3
- As a ruby developer
4
- I want to run warder with --quiet option
5
-
6
- Scenario: run warder with enabled quiet option
7
- Given I have valid file in directory
8
- When I run `warder --quiet --magick-numbers`
9
- Then warder detects no magick numbers issues
10
- And the exit status should be 0
@@ -1,9 +0,0 @@
1
- Feature: run warder
2
- In order to check project codebase
3
- I want to run warder
4
-
5
- Scenario: run warder with no options
6
- Given I have valid file in directory
7
- When I run `warder`
8
- Then warder does nothing
9
- And the exit status should be 0
@@ -1,8 +0,0 @@
1
- Feature: show version
2
- In order to check program version
3
- I want to run warder with --version option
4
-
5
- Scenario: run warder with enabled version option
6
- When I run `warder --version`
7
- Then warder shows version
8
- And the exit status should be 0
@@ -1,22 +0,0 @@
1
- Feature: run warder in statistics mode
2
- In order to get results
3
- As a ruby developer
4
- I want to run warder with --stats option
5
-
6
- Scenario: run warder with enabled stats option
7
- Given I have valid file in directory
8
- When I run `warder --stats --magick-numbers`
9
- Then 0 magick numbers stats should be printed
10
- And the exit status should be 0
11
-
12
- Scenario: run warder with enabled stats option on invalid rails app
13
- Given I have invalid_rails_app project in directory
14
- When I run `warder --stats --sandi-rules`
15
- Then the output should contain "broken 3 out of 4 sandi rules"
16
- And the exit status should be 1
17
-
18
- Scenario: run warder with disabled stats option
19
- Given I have valid file in directory
20
- When I run `warder --no-stats --code-complexity`
21
- Then 0 code complexity stats should not be printed
22
- And the exit status should be 0
@@ -1,14 +0,0 @@
1
- def rails_best_practices_cmd
2
- 'rails_best_practices --without-color --silent --spec --test --features .'
3
- end
4
-
5
- def executing_rails_best_practices
6
- "executing '#{rails_best_practices_cmd}'"
7
- end
8
-
9
- def rails_best_practices_output
10
- `cd tmp/aruba/#{@projectname}/ && #{rails_best_practices_cmd}`
11
- .split("\n")
12
- .reject { |line| line.match(/Found \d+ warnings/) }
13
- .join("\n")
14
- end
@@ -1,24 +0,0 @@
1
- def executing_rails_security
2
- "executing 'brakeman -q -p .'"
3
- end
4
-
5
- def rails_security_output
6
- regexp = Warder::RailsSecurityRunner::PRINTABLE_REGEXP
7
- `cd tmp/aruba/#{@projectname}/ && brakeman -q -p .`
8
- .split("\n")
9
- .reject { |line| !regexp.match(line) }
10
- .join("\n")
11
- end
12
-
13
- Given(/^I have ((in)?valid_rails_app) project in directory$/) do |name, _|
14
- @projectname = name
15
- FileUtils.cp_r "spec/fixtures/#{@projectname}", 'tmp/aruba/'
16
- FileUtils.mv "tmp/aruba/#{@projectname}/Gemfile_lock",
17
- "tmp/aruba/#{@projectname}/Gemfile.lock"
18
- expect(`ls tmp/aruba`).to match(@projectname)
19
- end
20
-
21
- Given(/^I am on project directory$/) do
22
- dir = Aruba::ArubaPath.new("tmp/aruba/#{@projectname}")
23
- aruba.instance_variable_set('@current_directory', dir)
24
- end
@@ -1,7 +0,0 @@
1
- def executing_sandi_rules
2
- "executing 'sandi_meter -d -p .'"
3
- end
4
-
5
- def sandi_rules_output
6
- `cd tmp/aruba/#{@projectname}/ && sandi_meter -d -p .`
7
- end
@@ -1,15 +0,0 @@
1
- def executing_gem_freshness
2
- "executing 'bundle-audit update &> /dev/null && (cd . && bundle-audit check)'"
3
- end
4
-
5
- def gem_freshness_output
6
- if @projectname
7
- prep = "cd spec/fixtures/#{@projectname}/ && cp Gemfile_lock Gemfile.lock"
8
- `#{prep} && bundle-audit check; rm -f Gemfile.lock`
9
- .split("\n")
10
- .reject { |line| line.match('ulnerabilities found') }
11
- .join("\n")
12
- else
13
- fail NotImplementedError
14
- end
15
- end
@@ -1,11 +0,0 @@
1
- def executing_code_complexity
2
- "executing 'flog -a -c -g -m .'"
3
- end
4
-
5
- def code_complexity_output
6
- raw_output = command_output_for_project_or_file('flog -a -c -g -m')
7
- raw_output.split("\n").reject do |line|
8
- /total|average/.match(line) ||
9
- Warder::CodeComplexityRunner::FAILURE_THRESHOLD > line.to_i
10
- end.join("\n")
11
- end
@@ -1,7 +0,0 @@
1
- def executing_code_duplication
2
- "executing 'flay -m 15 .'"
3
- end
4
-
5
- def code_duplication_output
6
- command_output_for_project_or_file('flay')
7
- end
@@ -1,7 +0,0 @@
1
- def executing_code_smell
2
- "executing 'reek --no-color .'"
3
- end
4
-
5
- def code_smell_output
6
- command_output_for_project_or_file('reek')
7
- end
@@ -1,7 +0,0 @@
1
- def executing_magick_numbers
2
- "executing 'mago .'"
3
- end
4
-
5
- def magick_numbers_output
6
- command_output_for_project_or_file('mago')
7
- end
@@ -1,38 +0,0 @@
1
- Before do
2
- FileUtils.mkdir_p 'tmp/aruba'
3
- end
4
-
5
- After do
6
- FileUtils.rm_rf 'tmp/aruba'
7
- end
8
-
9
- Given(/^I have (\w+) file in directory$/) do |name|
10
- @filename = "#{name}.rb"
11
- @filename = "#{name}.coffee" unless File.exist? "spec/fixtures/#{@filename}"
12
- FileUtils.ln_s "../../spec/fixtures/#{@filename}", 'tmp/aruba/'
13
- expect(`ls tmp/aruba`).to match(@filename)
14
- end
15
-
16
- Then(/^warder does nothing$/) do
17
- step 'the output should match /.{0}/'
18
- end
19
-
20
- Then(/^warder detects( no)? (.+) (issues|violations)$/) do |no, what, _|
21
- executing_output = send(:"executing_#{what.tr(' ', '_')}")
22
- step "the output should#{' not' if no} contain \"#{executing_output}\""
23
-
24
- validation_output = send(:"#{what.tr(' ', '_')}_output")
25
- validation_output.split("\n").each do |string|
26
- step "the output should#{' not' if no} contain \"#{string}\""
27
- end
28
- end
29
-
30
- def command_output_for_project_or_file(cmd)
31
- if @filename
32
- `cd spec/fixtures/ && #{cmd} #{'./' unless cmd == 'reek'}#{@filename}`
33
- elsif @projectname
34
- `cd spec/fixtures/#{@projectname} && #{cmd} ./`
35
- else
36
- fail NotImplementedError
37
- end
38
- end
@@ -1,3 +0,0 @@
1
- Then(/^warder shows version$/) do
2
- step "the output should contain \"#{Warder::VERSION}\""
3
- end
@@ -1,4 +0,0 @@
1
- Given(/^(\d+) (.+) stats should( not)? be printed$/) do |number, what, no|
2
- string = "found #{number} #{what} issues"
3
- step "the output should#{no} contain \"#{string}\""
4
- end
@@ -1,12 +0,0 @@
1
- def executing_coffee_lint
2
- "executing 'coffeelint .'"
3
- end
4
-
5
- def coffee_lint_output
6
- output = command_output_for_project_or_file('coffeelint.rb -r .')
7
- .split("\n")
8
- .reject { |line| !line.match(/✗ #\d+:/) }
9
- output.map do |str|
10
- str.gsub("\e[32m", '').gsub("\e[0m", '').sub('✗', 'ERROR:')
11
- end.join("\n")
12
- end
@@ -1,7 +0,0 @@
1
- def executing_style_guide
2
- "executing 'rubocop --no-color --format clang .'"
3
- end
4
-
5
- def style_guide_output
6
- command_output_for_project_or_file('rubocop --no-color --format clang')
7
- end
@@ -1,23 +0,0 @@
1
- require 'aruba'
2
- require 'aruba/cucumber'
3
- require 'aruba/processes/in_process'
4
-
5
- require 'simplecov'
6
- SimpleCov.start do
7
- add_filter '/features/'
8
- add_filter '/spec/'
9
- add_filter '/vendor/'
10
- add_group 'Libraries', 'lib'
11
- end
12
- SimpleCov::MINIMUM_COVERAGE = 100
13
- SimpleCov.minimum_coverage SimpleCov::MINIMUM_COVERAGE
14
-
15
- bin_path = "#{File.expand_path('../../../bin', __FILE__)}"
16
- ENV['PATH'] = "#{bin_path}#{File::PATH_SEPARATOR}#{ENV['PATH']}"
17
-
18
- require 'warder'
19
-
20
- Aruba.configure do |config|
21
- config.command_launcher = :in_process
22
- config.main_class = Warder::CLI
23
- end
@@ -1,29 +0,0 @@
1
- Feature: check coffeescript style guide
2
- In order to check coffeescript style guide
3
- As a coffeescript developer
4
- I want to run warder with --coffee-lint option
5
-
6
- Scenario: run warder with enabled coffee lint option
7
- Given I have valid_coffee_lint file in directory
8
- When I run `warder --coffee-lint`
9
- Then warder detects coffee lint issues
10
- Then the exit status should be 0
11
-
12
- Scenario: run warder with enabled coffee lint option on invalid file
13
- Given I have invalid_coffee_lint file in directory
14
- When I run `warder --coffee-lint`
15
- Then warder detects coffee lint issues
16
- Then the exit status should be 1
17
-
18
- Scenario: run warder with enabled coffee lint option on valid file only
19
- Given I have valid_coffee_lint file in directory
20
- And I have invalid_coffee_lint file in directory
21
- When I run `warder --coffee-lint valid_coffee_lint.coffee`
22
- Then warder does nothing
23
- Then the exit status should be 0
24
-
25
- Scenario: run warder with disabled coffee lint option on invalid file
26
- Given I have invalid_coffee_lint file in directory
27
- When I run `warder --no-coffee-lint`
28
- Then warder does nothing
29
- Then the exit status should be 0
@@ -1,29 +0,0 @@
1
- Feature: check ruby style guide
2
- In order to check ruby style guide
3
- As a ruby developer
4
- I want to run warder with --style-guide option
5
-
6
- Scenario: run warder with enabled style guide option
7
- Given I have valid file in directory
8
- When I run `warder --style-guide`
9
- Then warder detects style guide issues
10
- Then the exit status should be 0
11
-
12
- Scenario: run warder with enabled style guide option on invalid file
13
- Given I have invalid_style_guide file in directory
14
- When I run `warder --style-guide`
15
- Then warder detects style guide issues
16
- Then the exit status should be 1
17
-
18
- Scenario: run warder with enabled style guide option on valid file only
19
- Given I have valid file in directory
20
- And I have invalid_style_guide file in directory
21
- When I run `warder --style-guide valid.rb`
22
- Then warder does nothing
23
- Then the exit status should be 0
24
-
25
- Scenario: run warder with disabled style guide option on invalid file
26
- Given I have invalid_style_guide file in directory
27
- When I run `warder --no-style-guide`
28
- Then warder does nothing
29
- Then the exit status should be 0
@@ -1,13 +0,0 @@
1
- def a
2
- b = 1 + 2 + 3 + 4 + 5
3
- c = 6 + 7 + 8 + 9 + 0
4
- d = 1 + 7 + 3 + 9 + 5
5
- e = 6 + 2 + 8 + 4 + 0
6
- f = 1 + 2 + 3 + 4 + 5
7
- g = 6 + 7 + 8 + 9 + 0
8
- h = 1 + 7 + 3 + 9 + 5
9
- i = 6 + 2 + 8 + 4 + 0
10
- j = b + c + d + e + f + g + h + i
11
- end
12
-
13
- puts a
@@ -1,40 +0,0 @@
1
- ##
2
- # I am a dog.
3
-
4
- class Dog
5
- def x
6
- return 1
7
- end
8
-
9
- def w
10
- return 2 + q
11
- end
12
-
13
- private
14
-
15
- def q
16
- return 3
17
- end
18
- end
19
-
20
- ##
21
- # I
22
- # am
23
- # a
24
- # cat.
25
-
26
- class Cat
27
- def y
28
- return 1
29
- end
30
-
31
- def z
32
- return 2 + s
33
- end
34
-
35
- private
36
-
37
- def s
38
- return 3
39
- end
40
- end
@@ -1,4 +0,0 @@
1
- def failed?(str)
2
- match = str.match(/\d+/)
3
- match && match[1].to_i != 0
4
- end
@@ -1,6 +0,0 @@
1
- class Greeting
2
- constructor: (greeting) ->
3
- @greeting = greeting || 'Hello'
4
-
5
- hello: (name) ->
6
- console.log "AAAAAARRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRGH #{@greeting} #{name}!"