quality 13.0.0 → 14.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e9f0c2e57cde483dbe36d747786158aeecc033bb
4
- data.tar.gz: aca2c88e639a3fc5136acba3e6157080c7cb41ee
3
+ metadata.gz: 1005c04aae87d441e5a4206c4c4e7771d0e0a354
4
+ data.tar.gz: ce749018195f340fb7e80b77bbb1b4ea807bc10e
5
5
  SHA512:
6
- metadata.gz: 780738abc2e816cbaf8cdd1e79e204296aeb0e8d63cbb14f760987616c4e7f742999ca77a47dd5ae2dc41af1cdf7159c424d376f7051a37702445cc12d75aa73
7
- data.tar.gz: 8e0ac78008dd7fc927621f537549981e52f2460b36739b6ae89444b3a07bc81e45df12f9cdc4fca797f342290ff41273613ad7272b0935cff4f09e2b98184e3d
6
+ metadata.gz: a2807707cd4a03836f3deadd69ba4fcb59bc48ef4bf092744a71385a8a0fe8f2958754a807002463927e737d7a06c93d361237408f4102f27d6dfcc42eb90a90
7
+ data.tar.gz: 79636bb7472afcc74b819a78ed829b1f7b010429c297b80c77f84bc2a70d9e14a8ce4399d998e1eaaf25a1ee4a69afa1091bd2d0bbf723109202257864d433db
@@ -2,7 +2,7 @@ require 'English'
2
2
 
3
3
  module Quality
4
4
  # Wrapper around IO.popen that allows exit status to be mocked in tests.
5
- class ProcessRunner
5
+ class Process
6
6
  def initialize(full_cmd,
7
7
  dependencies = {})
8
8
  @full_cmd = full_cmd
@@ -1,8 +1,7 @@
1
1
  require_relative 'command_output_processor'
2
- require_relative 'process_runner'
2
+ require_relative 'process'
3
3
  require_relative 'ruby_spawn'
4
4
 
5
- # XXX: Should add *.gemspec to glob
6
5
  module Quality
7
6
  # Runs a quality-checking, command, checks it agaist the existing
8
7
  # number of violations for that command, and decreases that number
@@ -14,7 +13,7 @@ module Quality
14
13
  command_output_processor_class:
15
14
  Quality::CommandOutputProcessor,
16
15
  count_dir: Dir,
17
- process_runner_class: ProcessRunner)
16
+ process_class: Process)
18
17
  @count_file = count_file
19
18
  @count_io = count_io
20
19
  @command_output_processor_class = command_output_processor_class
@@ -24,7 +23,7 @@ module Quality
24
23
  @verbose = verbose
25
24
  @count_dir.mkdir(output_dir) unless @count_file.exists?(output_dir)
26
25
  @filename = File.join(output_dir, "#{cmd}_high_water_mark")
27
- @process_runner_class = process_runner_class
26
+ @process_class = process_class
28
27
  end
29
28
 
30
29
  def execute(&count_violations_on_line)
@@ -44,7 +43,7 @@ module Quality
44
43
  end
45
44
 
46
45
  def run_command(processor, &count_violations_on_line)
47
- runner = @process_runner_class.new(full_cmd)
46
+ runner = @process_class.new(full_cmd)
48
47
 
49
48
  puts full_cmd if @verbose
50
49
  runner.run do |file|
@@ -54,11 +53,11 @@ module Quality
54
53
  end
55
54
 
56
55
  def check_exit_status(exit_status)
57
- return if @command_options[:gives_error_code_on_violations]
56
+ return if @command_options[:gives_error_code_on_violations] ||
57
+ @command_options[:gives_error_code_on_no_relevant_code]
58
58
 
59
59
  fail("Error detected running #{full_cmd}. " \
60
- "Exit status is #{exit_status}, " \
61
- "output is [#{out}]") if exit_status != 0
60
+ "Exit status is #{exit_status}") if exit_status != 0
62
61
  end
63
62
 
64
63
  def existing_violations
@@ -1,5 +1,18 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ # XXX: There's an underlying issue with bundler, and knowing my luck,
4
+ # probably RVM that is causing confusion on which version of rake is
5
+ # being pulled in in this situation. Similar issues from the past:
6
+ #
7
+ # http://stackoverflow.com/questions/6085610/
8
+ # ruby-on-rails-and-rake-problems-uninitialized-constant-rakedsl
9
+ module Rake
10
+ # Define this in advance so that confused requires succeed
11
+ module DSL
12
+ end
13
+ class Task
14
+ end
15
+ end
3
16
  require 'rake'
4
17
  require 'rake/tasklib'
5
18
  require 'rbconfig'
@@ -6,8 +6,7 @@ require_relative 'tools/reek'
6
6
  require_relative 'tools/rubocop'
7
7
  require_relative 'tools/bigfiles'
8
8
  require_relative 'tools/punchlist'
9
-
10
- # XXX: This name is too similar to process_runner
9
+ require_relative 'tools/brakeman'
11
10
 
12
11
  module Quality
13
12
  # Knows how to run different quality tools based on a configuration
@@ -20,6 +19,7 @@ module Quality
20
19
  include Tools::Rubocop
21
20
  include Tools::BigFiles
22
21
  include Tools::Punchlist
22
+ include Tools::Brakeman
23
23
 
24
24
  extend ::Forwardable
25
25
 
@@ -1,6 +1,6 @@
1
1
  module Quality
2
2
  module Tools
3
- # Adds 'rubocop' tool support to quality gem
3
+ # Adds 'bigfiles' tool support to quality gem
4
4
  module BigFiles
5
5
  private
6
6
 
@@ -0,0 +1,20 @@
1
+ module Quality
2
+ module Tools
3
+ # Adds 'rubocop' tool support to quality gem
4
+ module Brakeman
5
+ private
6
+
7
+ def quality_brakeman
8
+ ratchet_quality_cmd('brakeman',
9
+ args: '-q --summary -f csv 2>/dev/null',
10
+ gives_error_code_on_no_relevant_code: true) do |line|
11
+ if line =~ /Security Warnings,([0-9]*) \([0-9]*\)$/
12
+ $1.to_i
13
+ else
14
+ 0
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -2,5 +2,5 @@
2
2
  # reek, flog, flay and rubocop and makes sure your numbers don't get
3
3
  # any worse over time.
4
4
  module Quality
5
- VERSION = '13.0.0'
5
+ VERSION = '14.0.0'
6
6
  end
@@ -9,9 +9,11 @@ Gem::Specification.new do |s|
9
9
 
10
10
  s.authors = ['Vince Broz']
11
11
  # s.default_executable = %q{quality}
12
- s.description = "Quality is a tool that runs quality checks on Ruby
13
- code using rubocop, cane, reek, flog and flay, and makes sure
14
- your numbers don't get any worse over time."
12
+ s.description =
13
+ 'Quality is a tool that runs quality checks on your code using ' \
14
+ "community tools, and makes sure your numbers don't get any " \
15
+ "worse over time. Just add 'rake quality' as part of your " \
16
+ 'Continuous Integration'
15
17
  s.email = ['vince@broz.cc']
16
18
  # s.executables = ["quality"]
17
19
  # s.extra_rdoc_files = ["CHANGELOG", "License.txt"]
@@ -36,6 +38,7 @@ your numbers don't get any worse over time."
36
38
  s.add_runtime_dependency('rubocop')
37
39
  s.add_runtime_dependency('bigfiles')
38
40
  s.add_runtime_dependency('punchlist')
41
+ s.add_runtime_dependency('brakeman')
39
42
 
40
43
  # need above 3.2.2 to support Ruby 2.0 syntax
41
44
  #
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: quality
3
3
  version: !ruby/object:Gem::Version
4
- version: 13.0.0
4
+ version: 14.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vince Broz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-17 00:00:00.000000000 Z
11
+ date: 2015-09-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cane
@@ -114,6 +114,20 @@ dependencies:
114
114
  - - '>='
115
115
  - !ruby/object:Gem::Version
116
116
  version: '0'
117
+ - !ruby/object:Gem::Dependency
118
+ name: brakeman
119
+ requirement: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - '>='
122
+ - !ruby/object:Gem::Version
123
+ version: '0'
124
+ type: :runtime
125
+ prerelease: false
126
+ version_requirements: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - '>='
129
+ - !ruby/object:Gem::Version
130
+ version: '0'
117
131
  - !ruby/object:Gem::Dependency
118
132
  name: ruby_parser
119
133
  requirement: !ruby/object:Gem::Requirement
@@ -218,10 +232,9 @@ dependencies:
218
232
  - - ~>
219
233
  - !ruby/object:Gem::Version
220
234
  version: '5'
221
- description: |-
222
- Quality is a tool that runs quality checks on Ruby
223
- code using rubocop, cane, reek, flog and flay, and makes sure
224
- your numbers don't get any worse over time.
235
+ description: Quality is a tool that runs quality checks on your code using community
236
+ tools, and makes sure your numbers don't get any worse over time. Just add 'rake
237
+ quality' as part of your Continuous Integration
225
238
  email:
226
239
  - vince@broz.cc
227
240
  executables: []
@@ -232,13 +245,14 @@ files:
232
245
  - README.md
233
246
  - Rakefile
234
247
  - lib/quality/command_output_processor.rb
235
- - lib/quality/process_runner.rb
248
+ - lib/quality/process.rb
236
249
  - lib/quality/quality_checker.rb
237
250
  - lib/quality/rake/config.rb
238
251
  - lib/quality/rake/task.rb
239
252
  - lib/quality/ruby_spawn.rb
240
253
  - lib/quality/runner.rb
241
254
  - lib/quality/tools/bigfiles.rb
255
+ - lib/quality/tools/brakeman.rb
242
256
  - lib/quality/tools/cane.rb
243
257
  - lib/quality/tools/flay.rb
244
258
  - lib/quality/tools/flog.rb