rubycritic 4.3.2 → 4.5.1
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 +24 -1
- data/README.md +1 -1
- data/lib/rubycritic/analysers/helpers/flay.rb +1 -0
- data/lib/rubycritic/source_control_systems/git.rb +7 -2
- data/lib/rubycritic/source_control_systems/git/churn.rb +87 -0
- data/lib/rubycritic/version.rb +1 -1
- metadata +15 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8955de9da7554418f70f6eecbf32b6c7dfc42c67791b99865c8bcfd9162a65a6
|
4
|
+
data.tar.gz: 7e87d6f2bb1b95f898b6ce3c0237434dc8f4cacf4486b5d78367b8f6d2995bfc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fe01a2dbb0d5c96643bd9ace5c6b76d1b6353722cb88c9916fd03360740f36dbf09f5de5a7e1e17c2efc2e94696e88add01e403ec8caeb1b875c3161a776624f
|
7
|
+
data.tar.gz: 1e804c7bc111a534840930ad4ecf608b3d616fd491881af4bc9f85678b6106481b13320ec5718567c254ba251fa093e5903b20b2bb5f84678721c3284ad24a77
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,26 @@
|
|
1
|
-
# master [(unreleased)](https://github.com/whitesmith/rubycritic/compare/v4.
|
1
|
+
# master [(unreleased)](https://github.com/whitesmith/rubycritic/compare/v4.5.1...master)
|
2
|
+
|
3
|
+
# v4.5.1 / 2020-06-29 [(commits)](https://github.com/whitesmith/rubycritic/compare/v4.5.0...v4.5.1)
|
4
|
+
|
5
|
+
* [BUGFIX] Handle git --name-status Copied (C) operation (by [@rizalmuthi][])
|
6
|
+
|
7
|
+
# v4.5.0 / 2020-05-14 [(commits)](https://github.com/whitesmith/rubycritic/compare/v4.4.1...v4.5.0)
|
8
|
+
|
9
|
+
* [CHANGE] Relax `launchy` version dependency requirement
|
10
|
+
* [CHANGE] Drop support for ruby 2.3 (by [@joshrpowell][])
|
11
|
+
* [CHANGE] Update Reek dependency to '~> 6.0', '< 7.0' (by [@joshrpowell][])
|
12
|
+
|
13
|
+
# v4.4.1 / 2020-02-20 [(commits)](https://github.com/whitesmith/rubycritic/compare/v4.4.0...v4.4.1)
|
14
|
+
|
15
|
+
* [CHANGE] Rewrite how churn is calculated to make it faster
|
16
|
+
|
17
|
+
# v4.4.0 / 2020-02-15 [(commits)](https://github.com/whitesmith/rubycritic/compare/v4.3.3...v4.4.0)
|
18
|
+
|
19
|
+
* [FEATURE] Take into account the `.flayignore` file (by [@Flink][])
|
20
|
+
|
21
|
+
# v4.3.3 / 2020-01-31 [(commits)](https://github.com/whitesmith/rubycritic/compare/v4.3.2...v4.3.3)
|
22
|
+
|
23
|
+
* [BUGFIX] Relax constraint on `simplecov` gem (by [@etagwerker][])
|
2
24
|
|
3
25
|
# v4.3.2 / 2020-01-27 [(commits)](https://github.com/whitesmith/rubycritic/compare/v4.3.1...v4.3.2)
|
4
26
|
|
@@ -321,3 +343,4 @@
|
|
321
343
|
[@Adre]: https://github.com/Adre
|
322
344
|
[@GeoffTidey]: https://github.com/GeoffTidey
|
323
345
|
[@lloydwatkin]: https://github.com/lloydwatkin
|
346
|
+
[@Flink]: https://github.com/Flink
|
data/README.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'tty/which'
|
4
|
+
require 'rubycritic/source_control_systems/git/churn'
|
4
5
|
|
5
6
|
module RubyCritic
|
6
7
|
module SourceControlSystem
|
@@ -28,12 +29,16 @@ module RubyCritic
|
|
28
29
|
'Git'
|
29
30
|
end
|
30
31
|
|
32
|
+
def churn
|
33
|
+
@churn ||= Churn.new
|
34
|
+
end
|
35
|
+
|
31
36
|
def revisions_count(path)
|
32
|
-
|
37
|
+
churn.revisions_count(path)
|
33
38
|
end
|
34
39
|
|
35
40
|
def date_of_last_commit(path)
|
36
|
-
|
41
|
+
churn.date_of_last_commit(path)
|
37
42
|
end
|
38
43
|
|
39
44
|
def revision?
|
@@ -0,0 +1,87 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RubyCritic
|
4
|
+
module SourceControlSystem
|
5
|
+
class Git < Base
|
6
|
+
Stats = Struct.new(:count, :date)
|
7
|
+
|
8
|
+
class Renames
|
9
|
+
def initialize
|
10
|
+
@data = {}
|
11
|
+
end
|
12
|
+
|
13
|
+
def renamed(from, to)
|
14
|
+
current = current(to)
|
15
|
+
@data[from] = current
|
16
|
+
end
|
17
|
+
|
18
|
+
def current(name)
|
19
|
+
@data.fetch(name, name)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
class Churn
|
24
|
+
def initialize
|
25
|
+
@renames = Renames.new
|
26
|
+
@date = nil
|
27
|
+
@stats = {}
|
28
|
+
|
29
|
+
call
|
30
|
+
end
|
31
|
+
|
32
|
+
def revisions_count(path)
|
33
|
+
stats(path).count
|
34
|
+
end
|
35
|
+
|
36
|
+
def date_of_last_commit(path)
|
37
|
+
stats(path).date
|
38
|
+
end
|
39
|
+
|
40
|
+
private
|
41
|
+
|
42
|
+
def call
|
43
|
+
Git
|
44
|
+
.git("log --all --date=iso --follow --format='format:date:%x09%ad' --name-status .")
|
45
|
+
.split("\n")
|
46
|
+
.reject(&:empty?)
|
47
|
+
.each { |line| process_line(line) }
|
48
|
+
end
|
49
|
+
|
50
|
+
def process_line(line)
|
51
|
+
operation, *rest = line.split("\t")
|
52
|
+
|
53
|
+
case operation
|
54
|
+
when /^date:/
|
55
|
+
process_date(*rest)
|
56
|
+
when /^[RC]/
|
57
|
+
process_rename(*rest)
|
58
|
+
else
|
59
|
+
process_file(*rest)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def process_date(date)
|
64
|
+
@date = date
|
65
|
+
end
|
66
|
+
|
67
|
+
def process_rename(from, to)
|
68
|
+
@renames.renamed(from, to)
|
69
|
+
process_file(to)
|
70
|
+
end
|
71
|
+
|
72
|
+
def process_file(filename)
|
73
|
+
record_commit(@renames.current(filename), @date)
|
74
|
+
end
|
75
|
+
|
76
|
+
def record_commit(filename, date)
|
77
|
+
stats = @stats[filename] ||= Stats.new(0, date)
|
78
|
+
stats.count += 1
|
79
|
+
end
|
80
|
+
|
81
|
+
def stats(path)
|
82
|
+
@stats.fetch(path, Stats.new(0))
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
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.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Guilherme Simoes
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-06-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: flay
|
@@ -42,16 +42,16 @@ dependencies:
|
|
42
42
|
name: launchy
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 2.
|
47
|
+
version: 2.0.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 2.
|
54
|
+
version: 2.0.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: parser
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,20 +86,20 @@ dependencies:
|
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
89
|
+
version: '6.0'
|
90
90
|
- - "<"
|
91
91
|
- !ruby/object:Gem::Version
|
92
|
-
version: '
|
92
|
+
version: '7.0'
|
93
93
|
type: :runtime
|
94
94
|
prerelease: false
|
95
95
|
version_requirements: !ruby/object:Gem::Requirement
|
96
96
|
requirements:
|
97
97
|
- - "~>"
|
98
98
|
- !ruby/object:Gem::Version
|
99
|
-
version: '
|
99
|
+
version: '6.0'
|
100
100
|
- - "<"
|
101
101
|
- !ruby/object:Gem::Version
|
102
|
-
version: '
|
102
|
+
version: '7.0'
|
103
103
|
- !ruby/object:Gem::Dependency
|
104
104
|
name: ruby_parser
|
105
105
|
requirement: !ruby/object:Gem::Requirement
|
@@ -118,14 +118,14 @@ dependencies:
|
|
118
118
|
name: simplecov
|
119
119
|
requirement: !ruby/object:Gem::Requirement
|
120
120
|
requirements:
|
121
|
-
- - "
|
121
|
+
- - ">="
|
122
122
|
- !ruby/object:Gem::Version
|
123
123
|
version: 0.17.0
|
124
124
|
type: :runtime
|
125
125
|
prerelease: false
|
126
126
|
version_requirements: !ruby/object:Gem::Requirement
|
127
127
|
requirements:
|
128
|
-
- - "
|
128
|
+
- - ">="
|
129
129
|
- !ruby/object:Gem::Version
|
130
130
|
version: 0.17.0
|
131
131
|
- !ruby/object:Gem::Dependency
|
@@ -496,6 +496,7 @@ files:
|
|
496
496
|
- lib/rubycritic/source_control_systems/base.rb
|
497
497
|
- lib/rubycritic/source_control_systems/double.rb
|
498
498
|
- lib/rubycritic/source_control_systems/git.rb
|
499
|
+
- lib/rubycritic/source_control_systems/git/churn.rb
|
499
500
|
- lib/rubycritic/source_control_systems/mercurial.rb
|
500
501
|
- lib/rubycritic/source_control_systems/perforce.rb
|
501
502
|
- lib/rubycritic/source_locator.rb
|
@@ -512,14 +513,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
512
513
|
requirements:
|
513
514
|
- - ">="
|
514
515
|
- !ruby/object:Gem::Version
|
515
|
-
version: 2.
|
516
|
+
version: 2.4.0
|
516
517
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
517
518
|
requirements:
|
518
519
|
- - ">="
|
519
520
|
- !ruby/object:Gem::Version
|
520
521
|
version: '0'
|
521
522
|
requirements: []
|
522
|
-
rubygems_version: 3.0.
|
523
|
+
rubygems_version: 3.0.3
|
523
524
|
signing_key:
|
524
525
|
specification_version: 4
|
525
526
|
summary: RubyCritic is a Ruby code quality reporter
|