rubycritic 4.5.2 → 4.7.0
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/CHANGELOG.md +30 -1
- data/README.md +27 -7
- data/lib/rubycritic/analysers/coverage.rb +26 -24
- data/lib/rubycritic/cli/options/argv.rb +8 -1
- data/lib/rubycritic/commands/compare.rb +3 -2
- data/lib/rubycritic/configuration.rb +14 -5
- data/lib/rubycritic/generators/html/assets/{fonts → vendor/fonts}/FontAwesome.otf +0 -0
- data/lib/rubycritic/generators/html/assets/{fonts → vendor/fonts}/fontawesome-webfont.eot +0 -0
- data/lib/rubycritic/generators/html/assets/{fonts → vendor/fonts}/fontawesome-webfont.svg +0 -0
- data/lib/rubycritic/generators/html/assets/{fonts → vendor/fonts}/fontawesome-webfont.ttf +0 -0
- data/lib/rubycritic/generators/html/assets/{fonts → vendor/fonts}/fontawesome-webfont.woff +0 -0
- data/lib/rubycritic/generators/html/assets/{fonts → vendor/fonts}/fontawesome-webfont.woff2 +0 -0
- data/lib/rubycritic/generators/html/assets/{fonts → vendor/fonts}/glyphicons-halflings-regular.eot +0 -0
- data/lib/rubycritic/generators/html/assets/{fonts → vendor/fonts}/glyphicons-halflings-regular.svg +0 -0
- data/lib/rubycritic/generators/html/assets/{fonts → vendor/fonts}/glyphicons-halflings-regular.ttf +0 -0
- data/lib/rubycritic/generators/html/assets/{fonts → vendor/fonts}/glyphicons-halflings-regular.woff +0 -0
- data/lib/rubycritic/generators/html/assets/{fonts → vendor/fonts}/glyphicons-halflings-regular.woff2 +0 -0
- data/lib/rubycritic/generators/html/assets/{javascripts → vendor/javascripts}/bootstrap.min.js +0 -0
- data/lib/rubycritic/generators/html/assets/{javascripts → vendor/javascripts}/highcharts.src-4.0.1.js +0 -0
- data/lib/rubycritic/generators/html/assets/{javascripts → vendor/javascripts}/jquery.filtertable.min.js +0 -0
- data/lib/rubycritic/generators/html/assets/{javascripts → vendor/javascripts}/jquery.min.js +0 -0
- data/lib/rubycritic/generators/html/assets/{javascripts → vendor/javascripts}/jquery.scrollTo.min.js +0 -0
- data/lib/rubycritic/generators/html/assets/{javascripts → vendor/javascripts}/jquery.tablesorter.js +0 -0
- data/lib/rubycritic/generators/html/assets/{javascripts → vendor/javascripts}/jquery.tablesorter.min.js +0 -0
- data/lib/rubycritic/generators/html/assets/{javascripts → vendor/javascripts}/jquery.timeago.js +0 -0
- data/lib/rubycritic/generators/html/assets/{javascripts → vendor/javascripts}/prettify.js +0 -0
- data/lib/rubycritic/generators/html/assets/{stylesheets → vendor/stylesheets}/bootstrap.min.css +0 -0
- data/lib/rubycritic/generators/html/assets/{stylesheets → vendor/stylesheets}/font-awesome.min.css +0 -0
- data/lib/rubycritic/generators/html/assets/{stylesheets → vendor/stylesheets}/prettify.css +0 -0
- data/lib/rubycritic/generators/html/assets/{stylesheets → vendor/stylesheets}/prettify.custom_theme.css +0 -0
- data/lib/rubycritic/generators/html/templates/code_index.html.erb +3 -1
- data/lib/rubycritic/generators/html/templates/layouts/application.html.erb +14 -14
- data/lib/rubycritic/generators/html/view_helpers.rb +0 -12
- data/lib/rubycritic/rake_task.rb +22 -12
- data/lib/rubycritic/source_control_systems/base.rb +1 -1
- data/lib/rubycritic/source_control_systems/git/churn.rb +8 -2
- data/lib/rubycritic/source_control_systems/git.rb +1 -1
- data/lib/rubycritic/version.rb +1 -1
- metadata +50 -42
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9223069d4934bf55e41bd199b4610e9b230b4115d36196354d4aa93d87b8ea01
|
|
4
|
+
data.tar.gz: 7d1b324b4df74ac99bb1103c6f80678a90e872418eac4faa87dd2f687cdb87cc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 91abe36adad615bf645187214511346e8175f28f913462baaa31b0be4bdf1986fa01e3841ff71866fa80f5de9d2e10d0ed6cd53dded35c30b04d2ad1910a5d6f
|
|
7
|
+
data.tar.gz: 6764cabd0cac4338072f4eadde37819095a10c3c5d5fd78d76d75ffe0e68d12ee58afe0169c286f3ea32fad9e91df145a9396e42154cbd446e78f8ee64b579ad
|
data/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,27 @@
|
|
|
1
|
-
#
|
|
1
|
+
# main [(unreleased)](https://github.com/whitesmith/rubycritic/compare/v4.7.0...main)
|
|
2
|
+
|
|
3
|
+
# v4.7.0 / 2022-05-06 [(commits)](https://github.com/whitesmith/rubycritic/compare/v4.6.1...v4.7.0)
|
|
4
|
+
|
|
5
|
+
* [CHANGE] Run test suite with Ruby 3.1 (by [@etagwerker][])
|
|
6
|
+
* [FEATURE] Allow the Rake task generator to accept a description (by [@anicholson][])
|
|
7
|
+
* [CHANGE] Replace travis-ci with Github Actions for contributors (by [@RyanSnodgrass][])
|
|
8
|
+
* [CHANGE] Drop support for JRuby 9.1.x (by [@RyanSnodgrass][])
|
|
9
|
+
* [BUGFIX] Exit with 0 or 1 from Rake Task. Fixes #214 (by [@RyanSnodgrass][])
|
|
10
|
+
|
|
11
|
+
# v4.6.1 / 2021-01-28 [(commits)](https://github.com/whitesmith/rubycritic/compare/v4.6.0...v4.6.1)
|
|
12
|
+
|
|
13
|
+
* [CHANGE] CI: Drop rbx-3 from matrix, does not install (by [@olleolleolle][])
|
|
14
|
+
* [CHANGE] Add support for Ruby 3.0 (by [@etagwerker][])
|
|
15
|
+
* [BUGFIX] Fix images on readme (by [@borisrorsvort][])
|
|
16
|
+
|
|
17
|
+
# v4.6.0 / 2021-01-28 [(commits)](https://github.com/whitesmith/rubycritic/compare/v4.5.2...v4.6.0)
|
|
18
|
+
|
|
19
|
+
* [CHANGE] Fix rubocop offenses (by [@sl4vr][])
|
|
20
|
+
* [CHANGE] Make Github Linguist ignore vendored files (by [@sl4vr][])
|
|
21
|
+
* [BUGFIX] Fix directory structure of reports when comparing branches (by [@denny][])
|
|
22
|
+
* [BUGFIX] Restrict simplecov to versions before data format changed (by [@denny][])
|
|
23
|
+
|
|
24
|
+
* [BUGFIX] Handle missing comparison file in html template (by @lauratpa)
|
|
2
25
|
|
|
3
26
|
# v4.5.2 / 2020-08-20 [(commits)](https://github.com/whitesmith/rubycritic/compare/v4.5.1...v4.5.2)
|
|
4
27
|
|
|
@@ -8,6 +31,8 @@
|
|
|
8
31
|
|
|
9
32
|
* [BUGFIX] Handle git --name-status Copied (C) operation (by [@rizalmuthi][])
|
|
10
33
|
|
|
34
|
+
* [FEATURE] Add --churn-after (only supports git) to limit churn analysis to recent history (by [@jackcasey][])
|
|
35
|
+
|
|
11
36
|
# v4.5.0 / 2020-05-14 [(commits)](https://github.com/whitesmith/rubycritic/compare/v4.4.1...v4.5.0)
|
|
12
37
|
|
|
13
38
|
* [CHANGE] Relax `launchy` version dependency requirement
|
|
@@ -348,3 +373,7 @@
|
|
|
348
373
|
[@GeoffTidey]: https://github.com/GeoffTidey
|
|
349
374
|
[@lloydwatkin]: https://github.com/lloydwatkin
|
|
350
375
|
[@Flink]: https://github.com/Flink
|
|
376
|
+
[@jackcasey]: https://github.com/jackcasey
|
|
377
|
+
[@sl4vr]: https://github.com/sl4vr
|
|
378
|
+
[@denny]: https://github.com/denny
|
|
379
|
+
[@RyanSnodgrass]: https://github.com/RyanSnodgrass
|
data/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
[](https://travis-ci.org/whitesmith/rubycritic)
|
|
5
5
|
[](https://codeclimate.com/github/whitesmith/rubycritic)
|
|
6
6
|
|
|
7
|
-
<img src="https://github.com/whitesmith/rubycritic/raw/
|
|
7
|
+
<img src="https://github.com/whitesmith/rubycritic/raw/main/images/logo.png" alt="RubyCritic Icon" align="right">
|
|
8
8
|
|
|
9
9
|
RubyCritic is a gem that wraps around static analysis gems such as [Reek][1], [Flay][2] and [Flog][3] to provide a quality report of your Ruby code.
|
|
10
10
|
|
|
@@ -27,15 +27,15 @@ This gem provides features such as:
|
|
|
27
27
|
|
|
28
28
|
1. An overview of your project:
|
|
29
29
|
|
|
30
|
-

|
|
31
31
|
|
|
32
32
|
2. An index of the project files with their respective number of smells:
|
|
33
33
|
|
|
34
|
-

|
|
35
35
|
|
|
36
36
|
3. An index of the smells detected:
|
|
37
37
|
|
|
38
|
-

|
|
39
39
|
|
|
40
40
|
4. When analysing code like the following:
|
|
41
41
|
|
|
@@ -51,11 +51,11 @@ This gem provides features such as:
|
|
|
51
51
|
|
|
52
52
|
It basically turns something like this:
|
|
53
53
|
|
|
54
|
-

|
|
55
55
|
|
|
56
56
|
Into something like this:
|
|
57
57
|
|
|
58
|
-

|
|
59
59
|
|
|
60
60
|
5. It uses your source control system (only Git, Mercurial and Perforce
|
|
61
61
|
are currently supported) to compare your currently uncommitted
|
|
@@ -196,6 +196,9 @@ RubyCritic::RakeTask.new do |task|
|
|
|
196
196
|
|
|
197
197
|
# Defaults to false
|
|
198
198
|
task.verbose = true
|
|
199
|
+
|
|
200
|
+
# Fail the Rake task if RubyCritic doesn't pass. Defaults to true
|
|
201
|
+
task.fail_on_error = true
|
|
199
202
|
end
|
|
200
203
|
```
|
|
201
204
|
|
|
@@ -208,6 +211,22 @@ RubyCritic::RakeTask.new do |task|
|
|
|
208
211
|
end
|
|
209
212
|
```
|
|
210
213
|
|
|
214
|
+
If you wish to create multiple Rake tasks (e.g., for local & for ci-specific configuration), you can do so!
|
|
215
|
+
If you decide to do this, you should provide a clearer description for each task:
|
|
216
|
+
|
|
217
|
+
```ruby
|
|
218
|
+
# for local
|
|
219
|
+
RubyCritic::RakeTask.new("local", "Run RubyCritic (local configuration)" do |task|
|
|
220
|
+
# ...
|
|
221
|
+
end
|
|
222
|
+
|
|
223
|
+
# for CI
|
|
224
|
+
RubyCritic::RakeTask.new("ci", "Run RubyCritic (CI configuration)" do |task|
|
|
225
|
+
task.options = "--mode-ci"
|
|
226
|
+
# ...
|
|
227
|
+
end
|
|
228
|
+
```
|
|
229
|
+
|
|
211
230
|
## Formatters
|
|
212
231
|
|
|
213
232
|
See [formatters](docs/formatters.md)
|
|
@@ -220,6 +239,7 @@ RubyCritic is supporting Ruby versions:
|
|
|
220
239
|
* 2.5
|
|
221
240
|
* 2.6
|
|
222
241
|
* 2.7
|
|
242
|
+
* 3.0
|
|
223
243
|
|
|
224
244
|
## Improving RubyCritic
|
|
225
245
|
|
|
@@ -243,7 +263,7 @@ The current core team consists of:
|
|
|
243
263
|
|
|
244
264
|
## Credits
|
|
245
265
|
|
|
246
|
-

|
|
247
267
|
|
|
248
268
|
RubyCritic is maintained and funded by [Whitesmith][9]. Tweet your questions or suggestions to [@Whitesmithco][10].
|
|
249
269
|
|
|
@@ -9,6 +9,8 @@ module RubyCritic
|
|
|
9
9
|
class Coverage
|
|
10
10
|
include Colorize
|
|
11
11
|
|
|
12
|
+
RESULTSET_FILENAME = '.resultset.json'
|
|
13
|
+
|
|
12
14
|
def initialize(analysed_modules)
|
|
13
15
|
@analysed_modules = analysed_modules
|
|
14
16
|
@result = results.first
|
|
@@ -44,30 +46,28 @@ module RubyCritic
|
|
|
44
46
|
@result.source_files.detect { |file| file.filename == needle }
|
|
45
47
|
end
|
|
46
48
|
|
|
47
|
-
# The path to the
|
|
49
|
+
# The path to the cache file
|
|
48
50
|
def resultset_path
|
|
49
|
-
File.join(SimpleCov.coverage_path,
|
|
51
|
+
File.join(SimpleCov.coverage_path, RESULTSET_FILENAME)
|
|
50
52
|
end
|
|
51
53
|
|
|
52
54
|
def resultset_writelock
|
|
53
|
-
|
|
55
|
+
"#{resultset_path}.lock"
|
|
54
56
|
end
|
|
55
57
|
|
|
56
58
|
# Loads the cached resultset from JSON and returns it as a Hash,
|
|
57
59
|
# caching it for subsequent accesses.
|
|
58
60
|
def resultset
|
|
59
|
-
@resultset ||=
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
end
|
|
70
|
-
end
|
|
61
|
+
@resultset ||= parse_resultset(stored_data)
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def parse_resultset(data)
|
|
65
|
+
return {} unless data
|
|
66
|
+
|
|
67
|
+
JSON.parse(data) || {}
|
|
68
|
+
rescue JSON::ParserError => err
|
|
69
|
+
puts "Error: Loading #{RESULTSET_FILENAME}: #{err.message}"
|
|
70
|
+
{}
|
|
71
71
|
end
|
|
72
72
|
|
|
73
73
|
# Returns the contents of the resultset cache as a string or if the file is missing or empty nil
|
|
@@ -85,21 +85,23 @@ module RubyCritic
|
|
|
85
85
|
|
|
86
86
|
# Ensure only one process is reading or writing the resultset at any
|
|
87
87
|
# given time
|
|
88
|
-
def synchronize_resultset
|
|
88
|
+
def synchronize_resultset(&proc)
|
|
89
89
|
# make it reentrant
|
|
90
90
|
return yield if defined?(@resultset_locked) && @resultset_locked == true
|
|
91
91
|
|
|
92
92
|
return yield unless File.exist?(resultset_writelock)
|
|
93
93
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
94
|
+
with_lock(&proc)
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
def with_lock
|
|
98
|
+
@resultset_locked = true
|
|
99
|
+
File.open(resultset_writelock, 'w+') do |file|
|
|
100
|
+
file.flock(File::LOCK_EX)
|
|
101
|
+
yield
|
|
102
102
|
end
|
|
103
|
+
ensure
|
|
104
|
+
@resultset_locked = false
|
|
103
105
|
end
|
|
104
106
|
|
|
105
107
|
# Gets the resultset hash and re-creates all included instances
|
|
@@ -70,6 +70,12 @@ module RubyCritic
|
|
|
70
70
|
self.minimum_score = Float(min_score)
|
|
71
71
|
end
|
|
72
72
|
|
|
73
|
+
opts.on('--churn-after [DATE]', 'Only count churn from a certain date.',
|
|
74
|
+
'The date is passed through to version control (currently git only).',
|
|
75
|
+
'Example: 2017-01-01') do |churn_after|
|
|
76
|
+
self.churn_after = churn_after
|
|
77
|
+
end
|
|
78
|
+
|
|
73
79
|
opts.on('-m', '--mode-ci [BASE_BRANCH]',
|
|
74
80
|
'Use CI mode (faster, analyses diffs w.r.t base_branch (default: master))') do |branch|
|
|
75
81
|
self.base_branch = branch || 'master'
|
|
@@ -110,6 +116,7 @@ module RubyCritic
|
|
|
110
116
|
suppress_ratings: suppress_ratings,
|
|
111
117
|
help_text: parser.help,
|
|
112
118
|
minimum_score: minimum_score,
|
|
119
|
+
churn_after: churn_after,
|
|
113
120
|
no_browser: no_browser,
|
|
114
121
|
base_branch: base_branch,
|
|
115
122
|
feature_branch: feature_branch,
|
|
@@ -121,7 +128,7 @@ module RubyCritic
|
|
|
121
128
|
private
|
|
122
129
|
|
|
123
130
|
attr_accessor :mode, :root, :formats, :formatters, :deduplicate_symlinks,
|
|
124
|
-
:suppress_ratings, :minimum_score, :no_browser,
|
|
131
|
+
:suppress_ratings, :minimum_score, :churn_after, :no_browser,
|
|
125
132
|
:parser, :base_branch, :feature_branch, :threshold_score
|
|
126
133
|
def paths
|
|
127
134
|
@argv unless @argv.empty?
|
|
@@ -13,6 +13,7 @@ module RubyCritic
|
|
|
13
13
|
class Compare < Default
|
|
14
14
|
def initialize(options)
|
|
15
15
|
super
|
|
16
|
+
@original_config_root = Config.root
|
|
16
17
|
@build_number = 0
|
|
17
18
|
end
|
|
18
19
|
|
|
@@ -57,7 +58,7 @@ module RubyCritic
|
|
|
57
58
|
def analyse_modified_files
|
|
58
59
|
modified_files = Config.feature_branch_collection.where(SourceControlSystem::Git.modified_files)
|
|
59
60
|
analysed_modules = AnalysedModulesCollection.new(modified_files.map(&:path), modified_files)
|
|
60
|
-
Config.root =
|
|
61
|
+
Config.root = Config.compare_root_directory
|
|
61
62
|
report(analysed_modules)
|
|
62
63
|
end
|
|
63
64
|
|
|
@@ -85,7 +86,7 @@ module RubyCritic
|
|
|
85
86
|
end
|
|
86
87
|
|
|
87
88
|
def branch_directory(branch)
|
|
88
|
-
"#{
|
|
89
|
+
"#{@original_config_root}/compare/#{Config.send(branch)}"
|
|
89
90
|
end
|
|
90
91
|
|
|
91
92
|
# create a txt file with the branch score details
|
|
@@ -10,7 +10,7 @@ module RubyCritic
|
|
|
10
10
|
:feature_branch, :base_branch_score, :feature_branch_score,
|
|
11
11
|
:base_root_directory, :feature_root_directory,
|
|
12
12
|
:compare_root_directory, :threshold_score, :base_branch_collection,
|
|
13
|
-
:feature_branch_collection
|
|
13
|
+
:feature_branch_collection, :churn_after
|
|
14
14
|
|
|
15
15
|
def set(options)
|
|
16
16
|
self.mode = options[:mode] || :default
|
|
@@ -19,12 +19,17 @@ module RubyCritic
|
|
|
19
19
|
self.suppress_ratings = options[:suppress_ratings]
|
|
20
20
|
self.open_with = options[:open_with]
|
|
21
21
|
self.no_browser = options[:no_browser]
|
|
22
|
-
self.base_branch = options[:base_branch]
|
|
23
|
-
self.feature_branch = options[:feature_branch]
|
|
24
22
|
self.threshold_score = options[:threshold_score].to_i
|
|
23
|
+
setup_version_control(options)
|
|
25
24
|
setup_formats(options)
|
|
26
25
|
end
|
|
27
26
|
|
|
27
|
+
def setup_version_control(options)
|
|
28
|
+
self.base_branch = options[:base_branch]
|
|
29
|
+
self.feature_branch = options[:feature_branch]
|
|
30
|
+
self.churn_after = options[:churn_after]
|
|
31
|
+
end
|
|
32
|
+
|
|
28
33
|
def setup_formats(options)
|
|
29
34
|
formats = options[:formats].to_a
|
|
30
35
|
self.formats = formats.empty? ? [:html] : formats
|
|
@@ -59,11 +64,15 @@ module RubyCritic
|
|
|
59
64
|
end
|
|
60
65
|
|
|
61
66
|
def self.method_missing(method, *args, &block)
|
|
62
|
-
configuration.
|
|
67
|
+
if configuration.respond_to?(method)
|
|
68
|
+
configuration.public_send(method, *args, &block)
|
|
69
|
+
else
|
|
70
|
+
super
|
|
71
|
+
end
|
|
63
72
|
end
|
|
64
73
|
|
|
65
74
|
def self.respond_to_missing?(symbol, include_all = false)
|
|
66
|
-
configuration.
|
|
75
|
+
configuration.respond_to?(symbol) || super
|
|
67
76
|
end
|
|
68
77
|
end
|
|
69
78
|
end
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
data/lib/rubycritic/generators/html/assets/{fonts → vendor/fonts}/glyphicons-halflings-regular.eot
RENAMED
|
File without changes
|
data/lib/rubycritic/generators/html/assets/{fonts → vendor/fonts}/glyphicons-halflings-regular.svg
RENAMED
|
File without changes
|
data/lib/rubycritic/generators/html/assets/{fonts → vendor/fonts}/glyphicons-halflings-regular.ttf
RENAMED
|
File without changes
|
data/lib/rubycritic/generators/html/assets/{fonts → vendor/fonts}/glyphicons-halflings-regular.woff
RENAMED
|
File without changes
|
data/lib/rubycritic/generators/html/assets/{fonts → vendor/fonts}/glyphicons-halflings-regular.woff2
RENAMED
|
File without changes
|
data/lib/rubycritic/generators/html/assets/{javascripts → vendor/javascripts}/bootstrap.min.js
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
data/lib/rubycritic/generators/html/assets/{javascripts → vendor/javascripts}/jquery.scrollTo.min.js
RENAMED
|
File without changes
|
data/lib/rubycritic/generators/html/assets/{javascripts → vendor/javascripts}/jquery.tablesorter.js
RENAMED
|
File without changes
|
|
File without changes
|
data/lib/rubycritic/generators/html/assets/{javascripts → vendor/javascripts}/jquery.timeago.js
RENAMED
|
File without changes
|
|
File without changes
|
data/lib/rubycritic/generators/html/assets/{stylesheets → vendor/stylesheets}/bootstrap.min.css
RENAMED
|
File without changes
|
data/lib/rubycritic/generators/html/assets/{stylesheets → vendor/stylesheets}/font-awesome.min.css
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -25,7 +25,9 @@
|
|
|
25
25
|
<td class="center">
|
|
26
26
|
<% if Config.build_mode? %>
|
|
27
27
|
<% master_analysed_module = Config.base_branch_collection.find(analysed_module.pathname) %>
|
|
28
|
-
<% if master_analysed_module
|
|
28
|
+
<% if !master_analysed_module %>
|
|
29
|
+
<span class="empty-span glyphicon"></span>
|
|
30
|
+
<% elsif master_analysed_module.cost > analysed_module.cost %>
|
|
29
31
|
<span class="glyphicon glyphicon-arrow-up green-color"></span>
|
|
30
32
|
<% elsif master_analysed_module.cost < analysed_module.cost %>
|
|
31
33
|
<span class="glyphicon glyphicon-arrow-down red-color"></span>
|
|
@@ -8,16 +8,16 @@
|
|
|
8
8
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
9
9
|
|
|
10
10
|
<!-- StyleSheets -->
|
|
11
|
-
<link href="<%=
|
|
12
|
-
<link href="<%=
|
|
13
|
-
<link href="<%=
|
|
14
|
-
<link href="<%=
|
|
11
|
+
<link href="<%= asset_path("vendor/stylesheets/bootstrap.min.css") %>" media="screen, projection, print" rel="stylesheet" type="text/css">
|
|
12
|
+
<link href="<%= asset_path("vendor/stylesheets/font-awesome.min.css") %>" media="screen, projection, print" rel="stylesheet" type="text/css">
|
|
13
|
+
<link href="<%= asset_path("vendor/stylesheets/prettify.custom_theme.css") %>" media="screen, projection, print" rel="stylesheet" type="text/css">
|
|
14
|
+
<link href="<%= asset_path("stylesheets/application.css") %>" media="screen, projection, print" rel="stylesheet" type="text/css">
|
|
15
15
|
</head>
|
|
16
16
|
|
|
17
17
|
<body>
|
|
18
18
|
<header class="navbar navbar-default navbar-fixed-top">
|
|
19
19
|
<a href="#menu-toggle" class="btn btn-default hidden-lg visible-sm-* hidden-md visible-xs-* pull-left" id="menu-toggle"><i class="fa fa-bars" aria-hidden="true"></i></a>
|
|
20
|
-
<a href="<%= file_path('overview.html') %>"><img src="<%=
|
|
20
|
+
<a href="<%= file_path('overview.html') %>"><img src="<%= asset_path('images/logo.png') %>" alt="Ruby Critic Logo" title="Ruby Critic Logo" width="55"><span class="logo">RUBYCRITIC</span></a>
|
|
21
21
|
<% if Config.compare_branches_mode? %>
|
|
22
22
|
<ul class="nav navbar-nav navbar-right">
|
|
23
23
|
<a href="<%= @base_path %>"><span class="branch"><%= Config.base_branch %></span></a>
|
|
@@ -53,14 +53,14 @@
|
|
|
53
53
|
</div>
|
|
54
54
|
|
|
55
55
|
<!-- JavaScripts -->
|
|
56
|
-
<%=
|
|
57
|
-
<%=
|
|
58
|
-
<%=
|
|
59
|
-
<%=
|
|
60
|
-
<%=
|
|
61
|
-
<%=
|
|
62
|
-
<%=
|
|
63
|
-
<%=
|
|
64
|
-
<%=
|
|
56
|
+
<script src="<%= asset_path("vendor/javascripts/jquery.min.js") %>"></script>
|
|
57
|
+
<script src="<%= asset_path("vendor/javascripts/jquery.tablesorter.min.js") %>"></script>
|
|
58
|
+
<script src="<%= asset_path("vendor/javascripts/jquery.scrollTo.min.js") %>"></script>
|
|
59
|
+
<script src="<%= asset_path("vendor/javascripts/jquery.timeago.js") %>"></script>
|
|
60
|
+
<script src="<%= asset_path("vendor/javascripts/highcharts.src-4.0.1.js") %>"></script>
|
|
61
|
+
<script src="<%= asset_path("vendor/javascripts/prettify.js") %>"></script>
|
|
62
|
+
<script src="<%= asset_path("vendor/javascripts/bootstrap.min.js") %>"></script>
|
|
63
|
+
<script src="<%= asset_path("javascripts/application.js") %>"></script>
|
|
64
|
+
<script src="<%= asset_path("vendor/javascripts/jquery.filtertable.min.js") %>"></script>
|
|
65
65
|
</body>
|
|
66
66
|
</html>
|
|
@@ -6,22 +6,10 @@ module RubyCritic
|
|
|
6
6
|
"<time class='js-timeago' datetime='#{time}'>#{time}</time>"
|
|
7
7
|
end
|
|
8
8
|
|
|
9
|
-
def javascript_tag(file)
|
|
10
|
-
"<script src='" + asset_path("javascripts/#{file}.js").to_s + "'></script>"
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
def stylesheet_path(file)
|
|
14
|
-
asset_path("stylesheets/#{file}.css")
|
|
15
|
-
end
|
|
16
|
-
|
|
17
9
|
def asset_path(file)
|
|
18
10
|
relative_path("assets/#{file}")
|
|
19
11
|
end
|
|
20
12
|
|
|
21
|
-
def image_path(file)
|
|
22
|
-
asset_path("images/#{file}")
|
|
23
|
-
end
|
|
24
|
-
|
|
25
13
|
def file_path(file)
|
|
26
14
|
relative_path(file)
|
|
27
15
|
end
|
data/lib/rubycritic/rake_task.rb
CHANGED
|
@@ -36,11 +36,17 @@ module RubyCritic
|
|
|
36
36
|
# "-p / --path" since that is set separately. Defaults to ''.
|
|
37
37
|
attr_writer :options
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
# Whether or not to fail Rake task when RubyCritic does not pass.
|
|
40
|
+
# Defaults to true.
|
|
41
|
+
attr_writer :fail_on_error
|
|
42
|
+
|
|
43
|
+
def initialize(name = :rubycritic, description = 'Run RubyCritic')
|
|
44
|
+
@name = name
|
|
45
|
+
@description = description
|
|
46
|
+
@paths = FileList['.']
|
|
47
|
+
@options = ''
|
|
48
|
+
@verbose = false
|
|
49
|
+
@fail_on_error = true
|
|
44
50
|
|
|
45
51
|
yield self if block_given?
|
|
46
52
|
define_task
|
|
@@ -48,20 +54,24 @@ module RubyCritic
|
|
|
48
54
|
|
|
49
55
|
private
|
|
50
56
|
|
|
51
|
-
attr_reader :name, :paths, :verbose, :options
|
|
57
|
+
attr_reader :name, :description, :paths, :verbose, :options, :fail_on_error
|
|
52
58
|
|
|
53
59
|
def define_task
|
|
54
|
-
desc
|
|
60
|
+
desc description
|
|
55
61
|
task(name) { run_task }
|
|
56
62
|
end
|
|
57
63
|
|
|
58
64
|
def run_task
|
|
59
|
-
if verbose
|
|
60
|
-
puts "\n\n!!! Running `#{name}` rake command\n"
|
|
61
|
-
puts "!!! Inspecting #{paths} #{options.empty? ? '' : "with options #{options}"}\n\n"
|
|
62
|
-
end
|
|
65
|
+
print_starting_up_output if verbose
|
|
63
66
|
application = RubyCritic::Cli::Application.new(options_as_arguments + paths)
|
|
64
|
-
application.execute
|
|
67
|
+
return unless application.execute.nonzero? && fail_on_error
|
|
68
|
+
|
|
69
|
+
abort('RubyCritic did not pass - exiting!')
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
def print_starting_up_output
|
|
73
|
+
puts "\n\n!!! Running `#{name}` rake command\n"
|
|
74
|
+
puts "!!! Inspecting #{paths} #{options.empty? ? '' : "with options #{options}"}\n\n"
|
|
65
75
|
end
|
|
66
76
|
|
|
67
77
|
def options_as_arguments
|
|
@@ -21,10 +21,11 @@ module RubyCritic
|
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
class Churn
|
|
24
|
-
def initialize
|
|
24
|
+
def initialize(churn_after: nil)
|
|
25
25
|
@renames = Renames.new
|
|
26
26
|
@date = nil
|
|
27
27
|
@stats = {}
|
|
28
|
+
@churn_after = churn_after
|
|
28
29
|
|
|
29
30
|
call
|
|
30
31
|
end
|
|
@@ -41,12 +42,17 @@ module RubyCritic
|
|
|
41
42
|
|
|
42
43
|
def call
|
|
43
44
|
Git
|
|
44
|
-
.git(
|
|
45
|
+
.git(git_log_command)
|
|
45
46
|
.split("\n")
|
|
46
47
|
.reject(&:empty?)
|
|
47
48
|
.each { |line| process_line(line) }
|
|
48
49
|
end
|
|
49
50
|
|
|
51
|
+
def git_log_command
|
|
52
|
+
after_clause = @churn_after ? "--after='#{@churn_after}' " : ''
|
|
53
|
+
"log --all --date=iso --follow --format='format:date:%x09%ad' --name-status #{after_clause}."
|
|
54
|
+
end
|
|
55
|
+
|
|
50
56
|
def process_line(line)
|
|
51
57
|
operation, *rest = line.split("\t")
|
|
52
58
|
|
data/lib/rubycritic/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rubycritic
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 4.
|
|
4
|
+
version: 4.7.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Guilherme Simoes
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2022-05-06 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: flay
|
|
@@ -270,20 +270,20 @@ dependencies:
|
|
|
270
270
|
requirements:
|
|
271
271
|
- - "~>"
|
|
272
272
|
- !ruby/object:Gem::Version
|
|
273
|
-
version:
|
|
274
|
-
- - "
|
|
273
|
+
version: 1.3.2
|
|
274
|
+
- - "<"
|
|
275
275
|
- !ruby/object:Gem::Version
|
|
276
|
-
version: 0.
|
|
276
|
+
version: 2.0.0
|
|
277
277
|
type: :development
|
|
278
278
|
prerelease: false
|
|
279
279
|
version_requirements: !ruby/object:Gem::Requirement
|
|
280
280
|
requirements:
|
|
281
281
|
- - "~>"
|
|
282
282
|
- !ruby/object:Gem::Version
|
|
283
|
-
version:
|
|
284
|
-
- - "
|
|
283
|
+
version: 1.3.2
|
|
284
|
+
- - "<"
|
|
285
285
|
- !ruby/object:Gem::Version
|
|
286
|
-
version: 0.
|
|
286
|
+
version: 2.0.0
|
|
287
287
|
- !ruby/object:Gem::Dependency
|
|
288
288
|
name: mdl
|
|
289
289
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -302,9 +302,6 @@ dependencies:
|
|
|
302
302
|
name: minitest
|
|
303
303
|
requirement: !ruby/object:Gem::Requirement
|
|
304
304
|
requirements:
|
|
305
|
-
- - "~>"
|
|
306
|
-
- !ruby/object:Gem::Version
|
|
307
|
-
version: '5.3'
|
|
308
305
|
- - ">="
|
|
309
306
|
- !ruby/object:Gem::Version
|
|
310
307
|
version: 5.3.0
|
|
@@ -312,9 +309,6 @@ dependencies:
|
|
|
312
309
|
prerelease: false
|
|
313
310
|
version_requirements: !ruby/object:Gem::Requirement
|
|
314
311
|
requirements:
|
|
315
|
-
- - "~>"
|
|
316
|
-
- !ruby/object:Gem::Version
|
|
317
|
-
version: '5.3'
|
|
318
312
|
- - ">="
|
|
319
313
|
- !ruby/object:Gem::Version
|
|
320
314
|
version: 5.3.0
|
|
@@ -378,6 +372,20 @@ dependencies:
|
|
|
378
372
|
- - ">="
|
|
379
373
|
- !ruby/object:Gem::Version
|
|
380
374
|
version: 11.0.0
|
|
375
|
+
- !ruby/object:Gem::Dependency
|
|
376
|
+
name: rexml
|
|
377
|
+
requirement: !ruby/object:Gem::Requirement
|
|
378
|
+
requirements:
|
|
379
|
+
- - ">="
|
|
380
|
+
- !ruby/object:Gem::Version
|
|
381
|
+
version: 3.2.0
|
|
382
|
+
type: :development
|
|
383
|
+
prerelease: false
|
|
384
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
385
|
+
requirements:
|
|
386
|
+
- - ">="
|
|
387
|
+
- !ruby/object:Gem::Version
|
|
388
|
+
version: 3.2.0
|
|
381
389
|
- !ruby/object:Gem::Dependency
|
|
382
390
|
name: rubocop
|
|
383
391
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -448,35 +456,35 @@ files:
|
|
|
448
456
|
- lib/rubycritic/core/rating.rb
|
|
449
457
|
- lib/rubycritic/core/smell.rb
|
|
450
458
|
- lib/rubycritic/generators/console_report.rb
|
|
451
|
-
- lib/rubycritic/generators/html/assets/fonts/FontAwesome.otf
|
|
452
459
|
- lib/rubycritic/generators/html/assets/fonts/Roboto-Medium.ttf
|
|
453
460
|
- lib/rubycritic/generators/html/assets/fonts/Roboto-Regular.ttf
|
|
454
|
-
- lib/rubycritic/generators/html/assets/fonts/fontawesome-webfont.eot
|
|
455
|
-
- lib/rubycritic/generators/html/assets/fonts/fontawesome-webfont.svg
|
|
456
|
-
- lib/rubycritic/generators/html/assets/fonts/fontawesome-webfont.ttf
|
|
457
|
-
- lib/rubycritic/generators/html/assets/fonts/fontawesome-webfont.woff
|
|
458
|
-
- lib/rubycritic/generators/html/assets/fonts/fontawesome-webfont.woff2
|
|
459
|
-
- lib/rubycritic/generators/html/assets/fonts/glyphicons-halflings-regular.eot
|
|
460
|
-
- lib/rubycritic/generators/html/assets/fonts/glyphicons-halflings-regular.svg
|
|
461
|
-
- lib/rubycritic/generators/html/assets/fonts/glyphicons-halflings-regular.ttf
|
|
462
|
-
- lib/rubycritic/generators/html/assets/fonts/glyphicons-halflings-regular.woff
|
|
463
|
-
- lib/rubycritic/generators/html/assets/fonts/glyphicons-halflings-regular.woff2
|
|
464
461
|
- lib/rubycritic/generators/html/assets/images/logo.png
|
|
465
462
|
- lib/rubycritic/generators/html/assets/javascripts/application.js
|
|
466
|
-
- lib/rubycritic/generators/html/assets/javascripts/bootstrap.min.js
|
|
467
|
-
- lib/rubycritic/generators/html/assets/javascripts/highcharts.src-4.0.1.js
|
|
468
|
-
- lib/rubycritic/generators/html/assets/javascripts/jquery.filtertable.min.js
|
|
469
|
-
- lib/rubycritic/generators/html/assets/javascripts/jquery.min.js
|
|
470
|
-
- lib/rubycritic/generators/html/assets/javascripts/jquery.scrollTo.min.js
|
|
471
|
-
- lib/rubycritic/generators/html/assets/javascripts/jquery.tablesorter.js
|
|
472
|
-
- lib/rubycritic/generators/html/assets/javascripts/jquery.tablesorter.min.js
|
|
473
|
-
- lib/rubycritic/generators/html/assets/javascripts/jquery.timeago.js
|
|
474
|
-
- lib/rubycritic/generators/html/assets/javascripts/prettify.js
|
|
475
463
|
- lib/rubycritic/generators/html/assets/stylesheets/application.css
|
|
476
|
-
- lib/rubycritic/generators/html/assets/
|
|
477
|
-
- lib/rubycritic/generators/html/assets/
|
|
478
|
-
- lib/rubycritic/generators/html/assets/
|
|
479
|
-
- lib/rubycritic/generators/html/assets/
|
|
464
|
+
- lib/rubycritic/generators/html/assets/vendor/fonts/FontAwesome.otf
|
|
465
|
+
- lib/rubycritic/generators/html/assets/vendor/fonts/fontawesome-webfont.eot
|
|
466
|
+
- lib/rubycritic/generators/html/assets/vendor/fonts/fontawesome-webfont.svg
|
|
467
|
+
- lib/rubycritic/generators/html/assets/vendor/fonts/fontawesome-webfont.ttf
|
|
468
|
+
- lib/rubycritic/generators/html/assets/vendor/fonts/fontawesome-webfont.woff
|
|
469
|
+
- lib/rubycritic/generators/html/assets/vendor/fonts/fontawesome-webfont.woff2
|
|
470
|
+
- lib/rubycritic/generators/html/assets/vendor/fonts/glyphicons-halflings-regular.eot
|
|
471
|
+
- lib/rubycritic/generators/html/assets/vendor/fonts/glyphicons-halflings-regular.svg
|
|
472
|
+
- lib/rubycritic/generators/html/assets/vendor/fonts/glyphicons-halflings-regular.ttf
|
|
473
|
+
- lib/rubycritic/generators/html/assets/vendor/fonts/glyphicons-halflings-regular.woff
|
|
474
|
+
- lib/rubycritic/generators/html/assets/vendor/fonts/glyphicons-halflings-regular.woff2
|
|
475
|
+
- lib/rubycritic/generators/html/assets/vendor/javascripts/bootstrap.min.js
|
|
476
|
+
- lib/rubycritic/generators/html/assets/vendor/javascripts/highcharts.src-4.0.1.js
|
|
477
|
+
- lib/rubycritic/generators/html/assets/vendor/javascripts/jquery.filtertable.min.js
|
|
478
|
+
- lib/rubycritic/generators/html/assets/vendor/javascripts/jquery.min.js
|
|
479
|
+
- lib/rubycritic/generators/html/assets/vendor/javascripts/jquery.scrollTo.min.js
|
|
480
|
+
- lib/rubycritic/generators/html/assets/vendor/javascripts/jquery.tablesorter.js
|
|
481
|
+
- lib/rubycritic/generators/html/assets/vendor/javascripts/jquery.tablesorter.min.js
|
|
482
|
+
- lib/rubycritic/generators/html/assets/vendor/javascripts/jquery.timeago.js
|
|
483
|
+
- lib/rubycritic/generators/html/assets/vendor/javascripts/prettify.js
|
|
484
|
+
- lib/rubycritic/generators/html/assets/vendor/stylesheets/bootstrap.min.css
|
|
485
|
+
- lib/rubycritic/generators/html/assets/vendor/stylesheets/font-awesome.min.css
|
|
486
|
+
- lib/rubycritic/generators/html/assets/vendor/stylesheets/prettify.css
|
|
487
|
+
- lib/rubycritic/generators/html/assets/vendor/stylesheets/prettify.custom_theme.css
|
|
480
488
|
- lib/rubycritic/generators/html/base.rb
|
|
481
489
|
- lib/rubycritic/generators/html/code_file.rb
|
|
482
490
|
- lib/rubycritic/generators/html/code_index.rb
|
|
@@ -519,7 +527,7 @@ homepage: https://github.com/whitesmith/rubycritic
|
|
|
519
527
|
licenses:
|
|
520
528
|
- MIT
|
|
521
529
|
metadata: {}
|
|
522
|
-
post_install_message:
|
|
530
|
+
post_install_message:
|
|
523
531
|
rdoc_options: []
|
|
524
532
|
require_paths:
|
|
525
533
|
- lib
|
|
@@ -534,8 +542,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
534
542
|
- !ruby/object:Gem::Version
|
|
535
543
|
version: '0'
|
|
536
544
|
requirements: []
|
|
537
|
-
rubygems_version: 3.
|
|
538
|
-
signing_key:
|
|
545
|
+
rubygems_version: 3.2.15
|
|
546
|
+
signing_key:
|
|
539
547
|
specification_version: 4
|
|
540
548
|
summary: RubyCritic is a Ruby code quality reporter
|
|
541
549
|
test_files: []
|