quality 22.0.0 → 23.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +43 -51
- data/lib/quality/command_output_processor.rb +2 -2
- data/lib/quality/config.rb +26 -60
- data/lib/quality/directory_of_classes.rb +1 -0
- data/lib/quality/linguist_source_file_globber.rb +78 -0
- data/lib/quality/process.rb +1 -0
- data/lib/quality/quality_checker.rb +1 -0
- data/lib/quality/rake/task.rb +4 -4
- data/lib/quality/ruby_spawn.rb +2 -0
- data/lib/quality/runner.rb +14 -6
- data/lib/quality/tools/bigfiles.rb +4 -2
- data/lib/quality/tools/brakeman.rb +2 -0
- data/lib/quality/tools/bundle_audit.rb +2 -0
- data/lib/quality/tools/cane.rb +9 -1
- data/lib/quality/tools/eslint.rb +3 -1
- data/lib/quality/tools/flake8.rb +2 -0
- data/lib/quality/tools/flay.rb +2 -0
- data/lib/quality/tools/flog.rb +2 -0
- data/lib/quality/tools/jscs.rb +4 -2
- data/lib/quality/tools/pep8.rb +2 -0
- data/lib/quality/tools/punchlist.rb +3 -1
- data/lib/quality/tools/rails_best_practices.rb +2 -0
- data/lib/quality/tools/reek.rb +2 -0
- data/lib/quality/tools/rubocop.rb +2 -0
- data/lib/quality/version.rb +3 -1
- data/lib/quality/which.rb +2 -0
- data/quality.gemspec +4 -3
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bd52cb5919480dc82d9e95238fe80a35c122eb58
|
4
|
+
data.tar.gz: c5a666f18a628c1bd4b1e86ba1eeb7291c7bb603
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 69cfc8ff0644cf6312d1092035a4c2048dcc12d01d748761629a15f203119c0be4d4a1ad977755aed64d6adc0780a2918d16632fea61258f1b1d5722aaabf268
|
7
|
+
data.tar.gz: 8bf0350a853947282c525fc49cfdd76950a07e8bbc04d1f667baa804e3bf626a331e12da6526461db1dcb54e1ae32035b7b9ea9fb9446dbfcb78002a91ded8ce
|
data/README.md
CHANGED
@@ -6,32 +6,54 @@
|
|
6
6
|
|
7
7
|
##Overview
|
8
8
|
|
9
|
-
Quality is a tool that runs quality checks on
|
10
|
-
|
9
|
+
Quality is a tool that runs quality checks on code in git repos using
|
10
|
+
different analysis tools and makes sure your numbers don't get any
|
11
11
|
worse over time.
|
12
12
|
|
13
13
|
## Why
|
14
14
|
|
15
15
|
See [this post](http://blog.apiology.cc/2014/06/scalable-quality-part-1.html) or [these slides](https://docs.google.com/presentation/d/1Op4FH34-enm8luEIuAAVLkuAJ-sB4LKaMm57RJzvfeI/edit#slide) for more information on the problem the quality gem solves.
|
16
16
|
|
17
|
+
### Tools
|
18
|
+
|
19
|
+
Quality makes use of the following other tools, which do the actual checking:
|
20
|
+
|
21
|
+
* [bigfiles](https://github.com/apiology/bigfiles)
|
22
|
+
* [brakeman](http://brakemanscanner.org/)
|
23
|
+
* [bundler_audit](https://github.com/rubysec/bundler-audit)
|
24
|
+
* [cane](https://github.com/square/cane)
|
25
|
+
* [eslint](http://eslint.org/)
|
26
|
+
* [flake8](https://pypi.python.org/pypi/flake8)
|
27
|
+
* [flay](https://github.com/seattlerb/flay)
|
28
|
+
* [flog](https://github.com/seattlerb/flog)
|
29
|
+
* [jscs](http://jscs.info/)
|
30
|
+
* [pep8](https://pypi.python.org/pypi/pep8)
|
31
|
+
* [punchlist](https://github.com/apiology/punchlist)
|
32
|
+
* [rails_best_practices](https://github.com/railsbp/rails_best_practices)
|
33
|
+
* [reek](https://github.com/troessner/reek)
|
34
|
+
* [rubocop](https://github.com/bbatsov/rubocop)
|
35
|
+
|
17
36
|
## How to use - using Docker
|
18
37
|
|
19
38
|
These basic steps assume you have a working Docker installation.
|
20
39
|
|
21
40
|
```
|
22
|
-
docker run -v `pwd`:/usr/app apiology/quality
|
41
|
+
docker run -v `pwd`:/usr/app apiology/quality:latest
|
23
42
|
```
|
24
43
|
|
25
44
|
If you'd like to customize, you can link in your own Rakefile like this:
|
26
45
|
|
27
46
|
```
|
28
|
-
docker run -v `pwd`:/usr/app -v `pwd`/Rakefile.quality:/usr/quality/Rakefile apiology/quality
|
47
|
+
docker run -v `pwd`:/usr/app -v `pwd`/Rakefile.quality:/usr/quality/Rakefile apiology/quality:latest
|
29
48
|
```
|
30
49
|
|
50
|
+
The default 'latest' tag contains the Ruby tools in a relatively small image. You can also get additional tools (see `Dockerfile.jumbo` in this directory) by using the tag `jumbo-`(version) (e.g., jumbo-latest, jumbo-x.y.z, etc)
|
51
|
+
|
31
52
|
|
32
53
|
## How to use - as part of a Ruby-based Rakefile
|
33
54
|
|
34
55
|
```bash
|
56
|
+
$ brew install cmake # OS X
|
35
57
|
$ gem install quality
|
36
58
|
```
|
37
59
|
|
@@ -91,25 +113,17 @@ Quality::Rake::Task.new do |t|
|
|
91
113
|
# Defaults to false
|
92
114
|
t.verbose = false
|
93
115
|
|
94
|
-
#
|
116
|
+
# Relative path to output directory where *_high_water_mark
|
117
|
+
# files will be read/written
|
95
118
|
#
|
96
|
-
# Defaults to
|
97
|
-
|
98
|
-
t.ruby_dirs = %w(app lib test spec feature)
|
119
|
+
# Defaults to 'metrics'
|
120
|
+
t.output_dir = 'metrics'
|
99
121
|
|
100
|
-
#
|
101
|
-
#
|
122
|
+
# Pipe-separated regexp string describing what to look for in
|
123
|
+
# files as 'todo'-like 'punchlist' comments.
|
102
124
|
#
|
103
|
-
# Defaults to
|
104
|
-
t.
|
105
|
-
|
106
|
-
# Pick any extra files that are source files, but may not have
|
107
|
-
# extensions--defaults to %w(Rakefile Dockerfile)
|
108
|
-
t.extra_source_files = ['tools/check-script', 'Rakefile']
|
109
|
-
|
110
|
-
# Pick any extra files that are source files, but may not have
|
111
|
-
# extensions--defaults to %w(Rakefile)
|
112
|
-
t.extra_ruby_files = ['Rakefile']
|
125
|
+
# Defaults to 'XXX|TODO'
|
126
|
+
t.punchlist_regexp = 'XXX|TODO'
|
113
127
|
|
114
128
|
# Exclude the specified list of files--defaults to ['db/schema.rb']
|
115
129
|
t.exclude_files = ['lib/whatever/imported_file.rb',
|
@@ -121,28 +135,18 @@ Quality::Rake::Task.new do |t|
|
|
121
135
|
t.source_files_exclude_glob =
|
122
136
|
'{lib/whatever/imported_file.rb,lib/vendor/**/*.rb}'
|
123
137
|
|
124
|
-
# Extensions for Ruby language files--defaults to rb,rake
|
125
|
-
t.ruby_file_extensions_arr = %w(rb rake)
|
126
|
-
|
127
|
-
# Extensions for all source files--defaults to
|
128
|
-
# rb,rake,swift,cpp,c,java,py,clj,cljs,scala,js,yml,sh,json
|
129
|
-
t.source_file_extensions_arr =
|
130
|
-
%w(rb rake swift cpp c java py clj cljs scala js yml sh json)
|
131
|
-
|
132
|
-
# Relative path to output directory where *_high_water_mark
|
133
|
-
# files will be read/written
|
134
138
|
#
|
135
|
-
#
|
136
|
-
|
137
|
-
|
138
|
-
# Pipe-separated regexp string describing what to look for in
|
139
|
-
# files as 'todo'-like 'punchlist' comments.
|
139
|
+
# For configuration on classifying files as the correct language,
|
140
|
+
# see https://github.com/github/linguist
|
140
141
|
#
|
141
|
-
# Defaults to 'XXX|TODO'
|
142
|
-
t.punchlist_regexp = 'XXX|TODO'
|
143
142
|
end
|
144
143
|
```
|
145
144
|
|
145
|
+
## Vendored files
|
146
|
+
|
147
|
+
Quality uses GitHub's [linguist](https://github.com/github/linguist) gem to find and classify source files to analyze. In addition to the `exclude_files` and `source_files_exclude_glob` options in Quality, you can refer to Linguists's documentation on [overrides](https://github.com/github/linguist#overrides) to use the `gitattributes` file to mark files as vendored, at which point Quality will not try to analyze them.
|
148
|
+
|
149
|
+
|
146
150
|
## Code coverage
|
147
151
|
|
148
152
|
You can pull a similar trick with code coverage using SimpleCov in Ruby--put 'simplecov' in your Gemfile, and add the code below into your test_helper.rb or spec_helper.rb.
|
@@ -155,13 +159,13 @@ SimpleCov.refuse_coverage_drop
|
|
155
159
|
|
156
160
|
After your first run, check in your coverage/.last_run.json.
|
157
161
|
|
158
|
-
##
|
162
|
+
## Caveats
|
159
163
|
|
160
164
|
Quality uses [semantic versioning](http://semver.org/)--any incompatible changes (including new tools being added) will come out as major number updates.
|
161
165
|
|
162
166
|
## Supported Ruby Versions
|
163
167
|
|
164
|
-
Tested against Ruby >=2.
|
168
|
+
Tested against Ruby >=2.2--does not support Ruby 1.9.x or JRuby.
|
165
169
|
|
166
170
|
## Contributing
|
167
171
|
|
@@ -171,18 +175,6 @@ Tested against Ruby >=2.0--does not support Ruby 1.9.x.
|
|
171
175
|
|
172
176
|
Many thanks to all contributors, especially [@andyw8](https://github.com/andyw8), who has contributed some great improvements.
|
173
177
|
|
174
|
-
### Dependencies
|
175
|
-
|
176
|
-
Quality makes use of the following other gems, which do the actual checking:
|
177
|
-
|
178
|
-
* [reek](https://github.com/troessner/reek)
|
179
|
-
* [cane](https://github.com/square/cane)
|
180
|
-
* [flog](https://github.com/seattlerb/flog)
|
181
|
-
* [flay](https://github.com/seattlerb/flay)
|
182
|
-
* [rubocop](https://github.com/bbatsov/rubocop)
|
183
|
-
* [bigfiles](https://github.com/apiology/bigfiles)
|
184
|
-
* [punchlist](https://github.com/apiology/punchlist)
|
185
|
-
|
186
178
|
### Learn More
|
187
179
|
|
188
180
|
* Browse the code or install the latest development version from [https://github.com/apiology/quality/tree](https://github.com/apiology/quality/tree)
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module Quality
|
2
3
|
# Class processes output from a code quality command, tweaking it
|
3
4
|
# for editor output and counting the number of violations found
|
@@ -22,8 +23,7 @@ module Quality
|
|
22
23
|
def process_file(file, &count_violations_on_line)
|
23
24
|
out = ''
|
24
25
|
while (@current_line = file.gets)
|
25
|
-
out
|
26
|
-
process_line(&count_violations_on_line)
|
26
|
+
out += process_line(&count_violations_on_line)
|
27
27
|
end
|
28
28
|
out
|
29
29
|
end
|
data/lib/quality/config.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
# XXX: I should figure out how to use tagged releases in github. Example:
|
2
3
|
# https://github.com/xsc/lein-ancient/issues/29
|
3
4
|
# https://github.com/xsc/lein-ancient/releases
|
4
5
|
|
5
|
-
|
6
|
+
require_relative 'linguist_source_file_globber'
|
6
7
|
|
7
8
|
module Quality
|
8
9
|
# Configuration for running quality tool
|
@@ -10,84 +11,49 @@ module Quality
|
|
10
11
|
attr_accessor :skip_tools, :verbose, :quality_name, :ratchet_name,
|
11
12
|
:output_dir, :punchlist_regexp
|
12
13
|
|
13
|
-
|
14
|
-
|
15
|
-
def_delegators(:source_file_globber,
|
16
|
-
:ruby_dirs_arr=, :ruby_dirs_arr,
|
17
|
-
:extra_ruby_files_arr=, :extra_ruby_files_arr,
|
18
|
-
:ruby_file_extensions_arr=, :ruby_file_extensions_arr,
|
19
|
-
:ruby_file_extensions_glob=, :ruby_file_extensions_glob,
|
20
|
-
:ruby_files_glob, :ruby_files_arr)
|
14
|
+
attr_writer :source_files_exclude_glob, :exclude_files
|
21
15
|
|
22
|
-
|
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)
|
16
|
+
extend Forwardable
|
28
17
|
|
29
|
-
def_delegators(
|
30
|
-
:
|
31
|
-
:extra_python_files_arr=, :extra_python_files_arr,
|
32
|
-
:python_file_extensions_arr=, :python_file_extensions_arr,
|
33
|
-
:python_file_extensions_glob=, :python_file_extensions_glob,
|
34
|
-
:python_files_glob, :python_files_arr)
|
18
|
+
def_delegators(:@source_file_globber, :ruby_files, :python_files,
|
19
|
+
:js_files, :source_and_doc_files, :source_files)
|
35
20
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
:exclude_files_arr=, :exclude_files_arr,
|
40
|
-
:source_file_extensions_arr=, :source_file_extensions_arr,
|
41
|
-
:source_file_extensions_glob=, :source_file_extensions_glob,
|
42
|
-
:source_and_doc_files_glob,
|
43
|
-
:source_files_glob,
|
44
|
-
:source_files_exclude_glob,
|
45
|
-
:source_files_exclude_glob=)
|
21
|
+
def to_glob(files)
|
22
|
+
"{#{files.join(',')}}"
|
23
|
+
end
|
46
24
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
alias_method(:python_files, :python_files_arr)
|
51
|
-
alias_method(:ruby_dirs, :ruby_dirs_arr)
|
52
|
-
alias_method(:ruby_dirs=, :ruby_dirs_arr=)
|
53
|
-
alias_method(:ruby_file_extensions, :ruby_file_extensions_glob)
|
54
|
-
alias_method(:ruby_file_extensions=, :ruby_file_extensions_glob=)
|
25
|
+
def source_files_glob
|
26
|
+
to_glob(source_files)
|
27
|
+
end
|
55
28
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
alias_method(:extra_source_files=, :extra_source_files_arr=)
|
60
|
-
alias_method(:source_dirs, :source_dirs_arr)
|
61
|
-
alias_method(:source_dirs=, :source_dirs_arr=)
|
62
|
-
alias_method(:exclude_files, :exclude_files_arr)
|
63
|
-
alias_method(:exclude_files=, :exclude_files_arr=)
|
29
|
+
def source_and_doc_files_glob
|
30
|
+
to_glob(source_and_doc_files)
|
31
|
+
end
|
64
32
|
|
65
|
-
|
66
|
-
|
67
|
-
|
33
|
+
def exclude_files
|
34
|
+
@exclude_files || []
|
35
|
+
end
|
68
36
|
|
69
|
-
def
|
70
|
-
@
|
71
|
-
SourceFinder::SourceFileGlobber.new(globber: @globber)
|
37
|
+
def source_files_exclude_glob
|
38
|
+
@source_files_exclude_glob || to_glob(exclude_files)
|
72
39
|
end
|
73
40
|
|
74
41
|
def all_output_files
|
75
|
-
@
|
42
|
+
@dir.glob("#{output_dir}/*_high_water_mark")
|
76
43
|
end
|
77
44
|
|
78
45
|
def initialize(quality_name: 'quality',
|
79
46
|
ratchet_name: 'ratchet',
|
80
|
-
|
47
|
+
source_file_globber: Quality::LinguistSourceFileGlobber.new,
|
48
|
+
dir: Dir)
|
81
49
|
@quality_name = quality_name
|
82
50
|
@ratchet_name = ratchet_name
|
83
51
|
@skip_tools = []
|
84
52
|
@output_dir = 'metrics'
|
85
53
|
@verbose = false
|
86
|
-
@
|
87
|
-
|
88
|
-
|
89
|
-
',db/schema.rb' \
|
90
|
-
'}'
|
54
|
+
@source_file_globber = source_file_globber
|
55
|
+
@dir = dir
|
56
|
+
@source_files_exclude_glob = nil
|
91
57
|
end
|
92
58
|
end
|
93
59
|
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'rugged'
|
3
|
+
require 'linguist'
|
4
|
+
|
5
|
+
module Quality
|
6
|
+
# Uses the Linguist gem to find and classify source files.
|
7
|
+
#
|
8
|
+
# Note: Requires files to be commited within a git repo.
|
9
|
+
class LinguistSourceFileGlobber
|
10
|
+
def initialize(repo: Rugged::Repository.new('.'),
|
11
|
+
commit: repo.head,
|
12
|
+
project: Linguist::Repository.new(repo, commit.target_id),
|
13
|
+
file_blob: Linguist::FileBlob,
|
14
|
+
pwd: Dir.pwd)
|
15
|
+
@repo = repo
|
16
|
+
@commit = commit
|
17
|
+
@project = project
|
18
|
+
@breakdown_by_file = @project.breakdown_by_file
|
19
|
+
@file_blob = file_blob
|
20
|
+
@pwd = pwd
|
21
|
+
end
|
22
|
+
|
23
|
+
def all_files
|
24
|
+
@source_files ||= begin
|
25
|
+
files = []
|
26
|
+
tree = @commit.target.tree
|
27
|
+
tree.walk(:preorder) do |root, file|
|
28
|
+
files << "#{root}#{file[:name]}" if file[:type] == :blob
|
29
|
+
end
|
30
|
+
files
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def ruby_files
|
35
|
+
@breakdown_by_file['Ruby'] || []
|
36
|
+
end
|
37
|
+
|
38
|
+
def python_files
|
39
|
+
@breakdown_by_file['Python'] || []
|
40
|
+
end
|
41
|
+
|
42
|
+
def js_files
|
43
|
+
@breakdown_by_file['JavaScript'] || []
|
44
|
+
end
|
45
|
+
|
46
|
+
def real_files_matching
|
47
|
+
all_files.select do |filename|
|
48
|
+
blob = @file_blob.new(filename, @pwd)
|
49
|
+
if blob.generated? || blob.vendored?
|
50
|
+
false
|
51
|
+
else
|
52
|
+
yield blob, filename
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def source_files
|
58
|
+
@source_files ||= begin
|
59
|
+
real_files_matching do |blob|
|
60
|
+
!blob.language.nil?
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
def source_and_doc_files
|
66
|
+
@source_and_doc_files ||= begin
|
67
|
+
real_files_matching do |blob, _filename|
|
68
|
+
if blob.documentation? || !blob.language.nil?
|
69
|
+
true
|
70
|
+
else
|
71
|
+
# puts "Excluding #{filename} from source_and_doc_files"
|
72
|
+
false
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
data/lib/quality/process.rb
CHANGED
data/lib/quality/rake/task.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
2
3
|
|
3
4
|
# XXX: There's an underlying issue with bundler, and knowing my luck,
|
4
5
|
# probably RVM that is causing confusion on which version of rake is
|
@@ -45,15 +46,14 @@ module Quality
|
|
45
46
|
cmd_runner: Kernel,
|
46
47
|
count_file: File,
|
47
48
|
count_io: IO,
|
48
|
-
globber: Dir,
|
49
49
|
gem_spec: Gem::Specification,
|
50
50
|
quality_checker_class:
|
51
51
|
Quality::QualityChecker,
|
52
|
-
which: Which.new
|
52
|
+
which: Which.new,
|
53
|
+
config: Quality::Config.new)
|
53
54
|
@dsl = dsl
|
54
55
|
@cmd_runner = cmd_runner
|
55
|
-
@
|
56
|
-
@config = Quality::Config.new(globber: globber)
|
56
|
+
@config = config
|
57
57
|
yield @config if block_given?
|
58
58
|
@runner = Quality::Runner.new(@config,
|
59
59
|
gem_spec: gem_spec,
|
data/lib/quality/ruby_spawn.rb
CHANGED
data/lib/quality/runner.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'active_support/inflector'
|
2
4
|
require 'forwardable'
|
3
5
|
require_relative 'which'
|
@@ -70,7 +72,7 @@ module Quality
|
|
70
72
|
|
71
73
|
def count_existing_violations(filename)
|
72
74
|
existing_violations = @count_io.read(filename).to_i
|
73
|
-
raise("Problem with file #{filename}") if existing_violations
|
75
|
+
raise("Problem with file #{filename}") if existing_violations.negative?
|
74
76
|
existing_violations
|
75
77
|
end
|
76
78
|
|
@@ -98,10 +100,16 @@ module Quality
|
|
98
100
|
quality_checker.execute(&count_violations_on_line)
|
99
101
|
end
|
100
102
|
|
101
|
-
def_delegators :@config,
|
102
|
-
:
|
103
|
-
:
|
104
|
-
:
|
105
|
-
:
|
103
|
+
def_delegators :@config,
|
104
|
+
:ruby_files,
|
105
|
+
:python_files,
|
106
|
+
:source_files,
|
107
|
+
:source_files_glob,
|
108
|
+
:source_and_doc_files,
|
109
|
+
:source_and_doc_files_glob,
|
110
|
+
:exclude_files,
|
111
|
+
:source_files_exclude_glob,
|
112
|
+
:punchlist_regexp,
|
113
|
+
:js_files
|
106
114
|
end
|
107
115
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Quality
|
2
4
|
module Tools
|
3
5
|
# Adds 'bigfiles' tool support to quality gem
|
@@ -5,8 +7,8 @@ module Quality
|
|
5
7
|
private
|
6
8
|
|
7
9
|
def bigfiles_args
|
8
|
-
args = ['--glob', "'#{
|
9
|
-
|
10
|
+
args = ['--glob', "'#{source_and_doc_files_glob}'"]
|
11
|
+
unless source_files_exclude_glob == '{}'
|
10
12
|
args << ['--exclude-glob', "'#{source_files_exclude_glob}'"]
|
11
13
|
end
|
12
14
|
args.join(' ')
|
data/lib/quality/tools/cane.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Quality
|
2
4
|
module Tools
|
3
5
|
# Adds 'cane' tool support to quality gem
|
@@ -12,11 +14,17 @@ module Quality
|
|
12
14
|
]
|
13
15
|
end
|
14
16
|
|
17
|
+
def ruby_files_glob
|
18
|
+
"{#{ruby_files.join(',')}}"
|
19
|
+
end
|
20
|
+
|
15
21
|
def cane_args
|
16
22
|
args = [
|
17
23
|
"-f '#{ruby_files_glob}'",
|
18
24
|
]
|
19
|
-
|
25
|
+
unless exclude_files.nil? || exclude_files.empty?
|
26
|
+
args += cane_exclude_args
|
27
|
+
end
|
20
28
|
args.join(' ')
|
21
29
|
end
|
22
30
|
|
data/lib/quality/tools/eslint.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Quality
|
2
4
|
module Tools
|
3
5
|
# Adds 'bigfiles' tool support to quality gem
|
@@ -5,7 +7,7 @@ module Quality
|
|
5
7
|
private
|
6
8
|
|
7
9
|
def eslint_args
|
8
|
-
'-f unix ' +
|
10
|
+
'-f unix ' + js_files.join(' ')
|
9
11
|
end
|
10
12
|
|
11
13
|
def quality_eslint
|
data/lib/quality/tools/flake8.rb
CHANGED
data/lib/quality/tools/flay.rb
CHANGED
data/lib/quality/tools/flog.rb
CHANGED
data/lib/quality/tools/jscs.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Quality
|
2
4
|
module Tools
|
3
5
|
# Adds 'bigfiles' tool support to quality gem
|
@@ -5,11 +7,11 @@ module Quality
|
|
5
7
|
private
|
6
8
|
|
7
9
|
def jscs_args
|
8
|
-
'-r unix ' +
|
10
|
+
'-r unix ' + js_files.join(' ')
|
9
11
|
end
|
10
12
|
|
11
13
|
def jscs_check_configured
|
12
|
-
return 0 if
|
14
|
+
return 0 if js_files.empty?
|
13
15
|
|
14
16
|
puts 'No JSCS config found! To generate one, run ' \
|
15
17
|
'jscs --auto-configure representative_file.js'
|
data/lib/quality/tools/pep8.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Quality
|
2
4
|
module Tools
|
3
5
|
# Adds 'punchlist' tool support to quality gem
|
@@ -7,7 +9,7 @@ module Quality
|
|
7
9
|
def punchlist_args
|
8
10
|
glob = "--glob '#{source_and_doc_files_glob}'"
|
9
11
|
regexp = " --regexp '#{punchlist_regexp}'" if punchlist_regexp
|
10
|
-
unless exclude_files.empty?
|
12
|
+
unless exclude_files.nil? || exclude_files.empty?
|
11
13
|
exclude = " --exclude-glob '#{source_files_exclude_glob}'"
|
12
14
|
end
|
13
15
|
|
data/lib/quality/tools/reek.rb
CHANGED
data/lib/quality/version.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Quality is a tool that runs quality checks on Ruby code using cane,
|
2
4
|
# reek, flog, flay and rubocop and makes sure your numbers don't get
|
3
5
|
# any worse over time.
|
4
6
|
module Quality
|
5
|
-
VERSION = '
|
7
|
+
VERSION = '23.0.0'
|
6
8
|
end
|
data/lib/quality/which.rb
CHANGED
data/quality.gemspec
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
# ; -*-Ruby-*-
|
2
3
|
# -*- encoding: utf-8 -*-
|
3
4
|
$LOAD_PATH.push File.join(File.dirname(__FILE__), 'lib')
|
@@ -10,10 +11,10 @@ Gem::Specification.new do |s|
|
|
10
11
|
s.authors = ['Vince Broz']
|
11
12
|
# s.default_executable = %q{quality}
|
12
13
|
s.description =
|
13
|
-
|
14
|
+
"Quality is a tool that runs quality checks on your code using " \
|
14
15
|
"community tools, and makes sure your numbers don't get any " \
|
15
16
|
"worse over time. Just add 'rake quality' as part of your " \
|
16
|
-
|
17
|
+
"Continuous Integration"
|
17
18
|
s.email = ['vince@broz.cc']
|
18
19
|
# s.executables = ["quality"]
|
19
20
|
# s.extra_rdoc_files = ["CHANGELOG", "License.txt"]
|
@@ -30,7 +31,7 @@ Gem::Specification.new do |s|
|
|
30
31
|
s.summary = 'Code quality tools for Ruby'
|
31
32
|
|
32
33
|
s.add_runtime_dependency('activesupport')
|
33
|
-
s.add_runtime_dependency('
|
34
|
+
s.add_runtime_dependency('github-linguist')
|
34
35
|
s.add_runtime_dependency('cane', ['>= 2.6'])
|
35
36
|
s.add_runtime_dependency('reek', ['>= 1.3.4'])
|
36
37
|
s.add_runtime_dependency('flog', ['>= 4.1.1'])
|
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:
|
4
|
+
version: 23.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: 2016-
|
11
|
+
date: 2016-09-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -25,19 +25,19 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: github-linguist
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: '0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: cane
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -316,6 +316,7 @@ files:
|
|
316
316
|
- lib/quality/command_output_processor.rb
|
317
317
|
- lib/quality/config.rb
|
318
318
|
- lib/quality/directory_of_classes.rb
|
319
|
+
- lib/quality/linguist_source_file_globber.rb
|
319
320
|
- lib/quality/process.rb
|
320
321
|
- lib/quality/quality_checker.rb
|
321
322
|
- lib/quality/rake/task.rb
|