quality 17.2.0 → 18.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: 912b09b15ecd97352a9f9661be47a75b7e779f8d
4
- data.tar.gz: 3e3ac5f309c4b33dde65f8b5bf1d3840a256bdfe
3
+ metadata.gz: 13356954d2864a210c04f07acebd158ca6898072
4
+ data.tar.gz: 6e08804b23726babd514f31ee29b9db4bdcd4327
5
5
  SHA512:
6
- metadata.gz: 44aa11ce25807e7fd53939e8708b1d220a10ddcf7b4d0c9f6f5d114fe25106efaf357b279933a14028e53ce1d974fc7155f439f886728e88ca58692b71cee0a9
7
- data.tar.gz: 0aec4b8d60baa7015562bddd8d994d38fdc434708fda00f4c601fa557882f64ac8c58c56b097926c8c359a95c7e4acc825bdb21aaae458a3e7731ce2c7e8349d
6
+ metadata.gz: f66de80a8ded9313495c449909c2839277a1931547c75dc14db3e51629e193e036719c7fef0070a453f3ffedf7b14cb27d62b5ebb40fd70adfa352591c806941
7
+ data.tar.gz: 46956de8a0f4880b344d905d23c2b9e05f50ebc31e8e12a0cb060a116631b3ac5b0749e6056b6bdf617b833112acd4ee1942ade161c94a47ff00710ea2917147
@@ -14,34 +14,49 @@ module Quality
14
14
 
15
15
  def_delegators(:source_file_globber,
16
16
  :ruby_dirs_arr=, :ruby_dirs_arr,
17
- :source_dirs_arr=, :source_dirs_arr,
18
- :extra_source_files_arr=, :extra_source_files_arr,
19
- :exclude_files_arr=, :exclude_files_arr,
20
17
  :extra_ruby_files_arr=, :extra_ruby_files_arr,
21
18
  :ruby_file_extensions_arr=, :ruby_file_extensions_arr,
22
19
  :ruby_file_extensions_glob=, :ruby_file_extensions_glob,
20
+ :ruby_files_glob, :ruby_files_arr)
21
+
22
+ def_delegators(:source_file_globber,
23
+ :js_dirs_arr=, :js_dirs_arr,
24
+ :extra_js_files_arr=, :extra_js_files_arr,
25
+ :js_file_extensions_arr=, :js_file_extensions_arr,
26
+ :js_file_extensions_glob=, :js_file_extensions_glob,
27
+ :js_files_glob, :js_files_arr)
28
+
29
+ def_delegators(:source_file_globber,
30
+ :python_files_glob, :python_files_arr)
31
+
32
+ def_delegators(:source_file_globber,
33
+ :source_dirs_arr=, :source_dirs_arr,
34
+ :extra_source_files_arr=, :extra_source_files_arr,
35
+ :exclude_files_arr=, :exclude_files_arr,
23
36
  :source_file_extensions_arr=, :source_file_extensions_arr,
24
37
  :source_file_extensions_glob=, :source_file_extensions_glob,
25
38
  :source_and_doc_files_glob,
26
39
  :source_files_glob,
27
40
  :source_files_exclude_glob,
28
- :source_files_exclude_glob=,
29
- :ruby_files_glob,
30
- :ruby_files_arr)
41
+ :source_files_exclude_glob=)
31
42
 
32
- alias_method(:extra_files, :extra_source_files_arr)
33
- alias_method(:extra_files=, :extra_source_files_arr=)
34
43
  alias_method(:extra_ruby_files, :extra_ruby_files_arr)
35
44
  alias_method(:extra_ruby_files=, :extra_ruby_files_arr=)
36
45
  alias_method(:ruby_files, :ruby_files_arr)
46
+ alias_method(:python_files, :python_files_arr)
37
47
  alias_method(:ruby_dirs, :ruby_dirs_arr)
38
48
  alias_method(:ruby_dirs=, :ruby_dirs_arr=)
49
+ alias_method(:ruby_file_extensions, :ruby_file_extensions_glob)
50
+ alias_method(:ruby_file_extensions=, :ruby_file_extensions_glob=)
51
+
52
+ alias_method(:extra_files, :extra_source_files_arr)
53
+ alias_method(:extra_files=, :extra_source_files_arr=)
54
+ alias_method(:extra_source_files, :extra_source_files_arr)
55
+ alias_method(:extra_source_files=, :extra_source_files_arr=)
39
56
  alias_method(:source_dirs, :source_dirs_arr)
40
57
  alias_method(:source_dirs=, :source_dirs_arr=)
41
58
  alias_method(:exclude_files, :exclude_files_arr)
42
59
  alias_method(:exclude_files=, :exclude_files_arr=)
43
- alias_method(:ruby_file_extensions, :ruby_file_extensions_glob)
44
- alias_method(:ruby_file_extensions=, :ruby_file_extensions_glob=)
45
60
 
46
61
  # This was named and documented poorly early on
47
62
  alias_method(:source_file_extensions, :source_file_extensions_glob)
@@ -16,6 +16,7 @@ end
16
16
  require 'rake'
17
17
  require 'rake/tasklib'
18
18
  require 'rbconfig'
19
+ require_relative '../which'
19
20
  require_relative '../runner'
20
21
  require_relative '../quality_checker'
21
22
  require_relative '../config'
@@ -47,7 +48,8 @@ module Quality
47
48
  globber: Dir,
48
49
  gem_spec: Gem::Specification,
49
50
  quality_checker_class:
50
- Quality::QualityChecker)
51
+ Quality::QualityChecker,
52
+ which: Which.new)
51
53
  @dsl = dsl
52
54
  @cmd_runner = cmd_runner
53
55
  @globber = globber
@@ -59,7 +61,8 @@ module Quality
59
61
  quality_checker_class,
60
62
  count_io: count_io,
61
63
  count_file: count_file,
62
- globber: globber)
64
+ globber: globber,
65
+ which: which)
63
66
  define
64
67
  end
65
68
 
@@ -1,14 +1,17 @@
1
1
  require 'active_support/inflector'
2
2
  require 'forwardable'
3
+ require_relative 'which'
3
4
  require_relative 'tools/cane'
4
5
  require_relative 'tools/flay'
5
6
  require_relative 'tools/flog'
6
7
  require_relative 'tools/reek'
7
8
  require_relative 'tools/rubocop'
8
9
  require_relative 'tools/bigfiles'
10
+ require_relative 'tools/pep8'
9
11
  require_relative 'tools/punchlist'
10
12
  require_relative 'tools/brakeman'
11
13
  require_relative 'tools/rails_best_practices'
14
+ require_relative 'tools/eslint'
12
15
 
13
16
  module Quality
14
17
  # Knows how to run different quality tools based on a configuration
@@ -20,9 +23,11 @@ module Quality
20
23
  include Tools::Reek
21
24
  include Tools::Rubocop
22
25
  include Tools::Bigfiles
26
+ include Tools::Pep8
23
27
  include Tools::Punchlist
24
28
  include Tools::Brakeman
25
29
  include Tools::RailsBestPractices
30
+ include Tools::Eslint
26
31
 
27
32
  extend ::Forwardable
28
33
 
@@ -31,13 +36,15 @@ module Quality
31
36
  quality_checker_class: Quality::QualityChecker,
32
37
  count_io: IO,
33
38
  count_file: File,
34
- globber: Dir)
39
+ globber: Dir,
40
+ which: Which.new)
35
41
  @config = config
36
42
  @gem_spec = gem_spec
37
43
  @quality_checker_class = quality_checker_class
38
44
  @count_io = count_io
39
45
  @count_file = count_file
40
46
  @globber = globber
47
+ @which = which
41
48
  end
42
49
 
43
50
  def run_quality
@@ -45,8 +52,9 @@ module Quality
45
52
  end
46
53
 
47
54
  def run_quality_with_tool(tool)
48
- installed = @gem_spec.find_all_by_name(tool).any?
49
55
  suppressed = @config.skip_tools.include? tool
56
+ installed = @gem_spec.find_all_by_name(tool).any? ||
57
+ !@which.which(tool).nil?
50
58
 
51
59
  if installed && !suppressed
52
60
  method("quality_#{tool}".to_sym).call
@@ -97,8 +105,9 @@ module Quality
97
105
  end
98
106
 
99
107
  def_delegators :@config, :ruby_files, :ruby_files_glob,
108
+ :python_files, :python_files_glob,
100
109
  :source_files_glob, :punchlist_regexp,
101
110
  :source_files_exclude_glob, :exclude_files,
102
- :source_and_doc_files_glob
111
+ :source_and_doc_files_glob, :js_files_arr
103
112
  end
104
113
  end
@@ -0,0 +1,24 @@
1
+ module Quality
2
+ module Tools
3
+ # Adds 'bigfiles' tool support to quality gem
4
+ module Eslint
5
+ private
6
+
7
+ def eslint_args
8
+ '-f unix ' + js_files_arr.join(' ')
9
+ end
10
+
11
+ def quality_eslint
12
+ ratchet_quality_cmd('eslint',
13
+ args: eslint_args,
14
+ gives_error_code_on_violations: true) do |line|
15
+ if line =~ /^.*:\d+:\d+: /
16
+ 1
17
+ else
18
+ 0
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,19 @@
1
+ module Quality
2
+ module Tools
3
+ # Adds 'pep8' tool support to quality gem
4
+ module Pep8
5
+ private
6
+
7
+ def pep8_args
8
+ python_files.join(' ')
9
+ end
10
+
11
+ def quality_pep8
12
+ ratchet_quality_cmd('pep8',
13
+ args: pep8_args) do |line|
14
+ line.split(':')[0].to_i
15
+ end
16
+ end
17
+ end
18
+ end
19
+ 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 = '17.2.0'
5
+ VERSION = '18.0.0'
6
6
  end
@@ -0,0 +1,14 @@
1
+ class Which
2
+ # http://stackoverflow.com/questions/2108727/
3
+ # which-in-ruby-checking-if-program-exists-in-path-from-ruby
4
+ def which(cmd)
5
+ exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
6
+ ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
7
+ exts.each { |ext|
8
+ exe = File.join(path, "#{cmd}#{ext}")
9
+ return exe if File.executable?(exe) && !File.directory?(exe)
10
+ }
11
+ end
12
+ return nil
13
+ end
14
+ end
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: 17.2.0
4
+ version: 18.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-11-29 00:00:00.000000000 Z
11
+ date: 2015-12-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -309,13 +309,16 @@ files:
309
309
  - lib/quality/tools/bigfiles.rb
310
310
  - lib/quality/tools/brakeman.rb
311
311
  - lib/quality/tools/cane.rb
312
+ - lib/quality/tools/eslint.rb
312
313
  - lib/quality/tools/flay.rb
313
314
  - lib/quality/tools/flog.rb
315
+ - lib/quality/tools/pep8.rb
314
316
  - lib/quality/tools/punchlist.rb
315
317
  - lib/quality/tools/rails_best_practices.rb
316
318
  - lib/quality/tools/reek.rb
317
319
  - lib/quality/tools/rubocop.rb
318
320
  - lib/quality/version.rb
321
+ - lib/quality/which.rb
319
322
  - quality.gemspec
320
323
  homepage: http://github.com/apiology/quality
321
324
  licenses: