rubycritic 2.3.0 → 2.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -1
- data/lib/rubycritic/analysers/attributes.rb +8 -1
- data/lib/rubycritic/analysers/churn.rb +9 -0
- data/lib/rubycritic/analysers/complexity.rb +8 -0
- data/lib/rubycritic/analysers/smells/flay.rb +8 -0
- data/lib/rubycritic/analysers/smells/flog.rb +8 -0
- data/lib/rubycritic/analysers/smells/reek.rb +8 -0
- data/lib/rubycritic/analysers_runner.rb +5 -1
- data/lib/rubycritic/colorize.rb +15 -0
- data/lib/rubycritic/core/analysed_module.rb +2 -2
- data/lib/rubycritic/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6be51e7c10ba7e448944cae72ebe4840393717b3
|
4
|
+
data.tar.gz: 147cdfabd7fbfe81e827333aa64d5ebe6cba8bb7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9becaa18090e8829c233fad1fd9f3750112b36ad29ce76b5c37edcb68343248657a2b96fb9eb60f4d7e40f0e4446a498b17c434f1a5a7aa78895fbfbea359d2b
|
7
|
+
data.tar.gz: d57006472be8f4f3834a5755525f578d5ab3152aa2e157df90fe7fce298f19ef55b098366b37184105c0f3a05deae3840eef8ee82c110726392fc4d37407db0b
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,10 @@
|
|
1
|
+
# 2.4.0 / 2015-12-26
|
2
|
+
|
3
|
+
* [FEATURE] Add progress bar functionality (by Nate Holland)
|
4
|
+
|
1
5
|
# 2.3.0 / 2015-11-30
|
2
6
|
|
3
|
-
* [FEATURE] Added global score calculation
|
7
|
+
* [FEATURE] Added global score calculation (by Ancor Gonzalez Sosa)
|
4
8
|
* [CHANGE] Bump Reek dependency to 3.7.1.
|
5
9
|
|
6
10
|
# 2.2.0 / 2015-11-20
|
@@ -1,10 +1,12 @@
|
|
1
1
|
require "rubycritic/analysers/helpers/methods_counter"
|
2
2
|
require "rubycritic/analysers/helpers/modules_locator"
|
3
|
+
require "rubycritic/colorize"
|
3
4
|
|
4
5
|
module Rubycritic
|
5
6
|
module Analyser
|
6
7
|
|
7
8
|
class Attributes
|
9
|
+
include Colorize
|
8
10
|
def initialize(analysed_modules)
|
9
11
|
@analysed_modules = analysed_modules
|
10
12
|
end
|
@@ -13,9 +15,14 @@ module Rubycritic
|
|
13
15
|
@analysed_modules.each do |analysed_module|
|
14
16
|
analysed_module.methods_count = MethodsCounter.new(analysed_module).count
|
15
17
|
analysed_module.name = ModulesLocator.new(analysed_module).first_name
|
18
|
+
print green "."
|
16
19
|
end
|
20
|
+
puts ""
|
17
21
|
end
|
18
|
-
end
|
19
22
|
|
23
|
+
def to_s
|
24
|
+
"attributes"
|
25
|
+
end
|
26
|
+
end
|
20
27
|
end
|
21
28
|
end
|
@@ -1,7 +1,10 @@
|
|
1
|
+
require "rubycritic/colorize"
|
2
|
+
|
1
3
|
module Rubycritic
|
2
4
|
module Analyser
|
3
5
|
|
4
6
|
class Churn
|
7
|
+
include Colorize
|
5
8
|
attr_writer :source_control_system
|
6
9
|
|
7
10
|
def initialize(analysed_modules)
|
@@ -13,7 +16,13 @@ module Rubycritic
|
|
13
16
|
@analysed_modules.each do |analysed_module|
|
14
17
|
analysed_module.churn = @source_control_system.revisions_count(analysed_module.path)
|
15
18
|
analysed_module.committed_at = @source_control_system.date_of_last_commit(analysed_module.path)
|
19
|
+
print green "."
|
16
20
|
end
|
21
|
+
puts ""
|
22
|
+
end
|
23
|
+
|
24
|
+
def to_s
|
25
|
+
"churn"
|
17
26
|
end
|
18
27
|
end
|
19
28
|
|
@@ -1,9 +1,11 @@
|
|
1
1
|
require "rubycritic/analysers/helpers/flog"
|
2
|
+
require "rubycritic/colorize"
|
2
3
|
|
3
4
|
module Rubycritic
|
4
5
|
module Analyser
|
5
6
|
|
6
7
|
class Complexity
|
8
|
+
include Colorize
|
7
9
|
def initialize(analysed_modules)
|
8
10
|
@flog = Flog.new
|
9
11
|
@analysed_modules = analysed_modules
|
@@ -14,7 +16,13 @@ module Rubycritic
|
|
14
16
|
@flog.reset
|
15
17
|
@flog.flog(analysed_module.path)
|
16
18
|
analysed_module.complexity = @flog.total_score.round
|
19
|
+
print green "."
|
17
20
|
end
|
21
|
+
puts ""
|
22
|
+
end
|
23
|
+
|
24
|
+
def to_s
|
25
|
+
"complexity"
|
18
26
|
end
|
19
27
|
end
|
20
28
|
|
@@ -1,10 +1,12 @@
|
|
1
1
|
require "rubycritic/analysers/helpers/flay"
|
2
2
|
require "rubycritic/core/smell"
|
3
|
+
require "rubycritic/colorize"
|
3
4
|
|
4
5
|
module Rubycritic
|
5
6
|
module Analyser
|
6
7
|
|
7
8
|
class FlaySmells
|
9
|
+
include Colorize
|
8
10
|
def initialize(analysed_modules)
|
9
11
|
@analysed_modules = paths_to_analysed_modules(analysed_modules)
|
10
12
|
@flay = Flay.new(@analysed_modules.keys)
|
@@ -20,7 +22,13 @@ module Rubycritic
|
|
20
22
|
nodes.each do |node|
|
21
23
|
@analysed_modules[node.file].duplication += node.mass
|
22
24
|
end
|
25
|
+
print green "."
|
23
26
|
end
|
27
|
+
puts ""
|
28
|
+
end
|
29
|
+
|
30
|
+
def to_s
|
31
|
+
"flay smells"
|
24
32
|
end
|
25
33
|
|
26
34
|
private
|
@@ -1,10 +1,12 @@
|
|
1
1
|
require "rubycritic/analysers/helpers/flog"
|
2
2
|
require "rubycritic/core/smell"
|
3
|
+
require "rubycritic/colorize"
|
3
4
|
|
4
5
|
module Rubycritic
|
5
6
|
module Analyser
|
6
7
|
|
7
8
|
class FlogSmells
|
9
|
+
include Colorize
|
8
10
|
HIGH_COMPLEXITY_SCORE_THRESHOLD = 25
|
9
11
|
VERY_HIGH_COMPLEXITY_SCORE_THRESHOLD = 60
|
10
12
|
|
@@ -16,7 +18,13 @@ module Rubycritic
|
|
16
18
|
def run
|
17
19
|
@analysed_modules.each do |analysed_module|
|
18
20
|
add_smells_to(analysed_module)
|
21
|
+
print green "."
|
19
22
|
end
|
23
|
+
puts ""
|
24
|
+
end
|
25
|
+
|
26
|
+
def to_s
|
27
|
+
"flog smells"
|
20
28
|
end
|
21
29
|
|
22
30
|
private
|
@@ -1,10 +1,12 @@
|
|
1
1
|
require "rubycritic/analysers/helpers/reek"
|
2
2
|
require "rubycritic/core/smell"
|
3
|
+
require "rubycritic/colorize"
|
3
4
|
|
4
5
|
module Rubycritic
|
5
6
|
module Analyser
|
6
7
|
|
7
8
|
class ReekSmells
|
9
|
+
include Colorize
|
8
10
|
def initialize(analysed_modules)
|
9
11
|
@analysed_modules = analysed_modules
|
10
12
|
end
|
@@ -12,7 +14,13 @@ module Rubycritic
|
|
12
14
|
def run
|
13
15
|
@analysed_modules.each do |analysed_module|
|
14
16
|
add_smells_to(analysed_module)
|
17
|
+
print green "."
|
15
18
|
end
|
19
|
+
puts ""
|
20
|
+
end
|
21
|
+
|
22
|
+
def to_s
|
23
|
+
"reek smells"
|
16
24
|
end
|
17
25
|
|
18
26
|
private
|
@@ -23,7 +23,11 @@ module Rubycritic
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def run
|
26
|
-
ANALYSERS.each
|
26
|
+
ANALYSERS.each do |analyser_class|
|
27
|
+
analyser_instance = analyser_class.new(analysed_modules)
|
28
|
+
puts "running #{analyser_instance}"
|
29
|
+
analyser_instance.run
|
30
|
+
end
|
27
31
|
analysed_modules
|
28
32
|
end
|
29
33
|
|
@@ -8,11 +8,11 @@ module Rubycritic
|
|
8
8
|
|
9
9
|
attribute :name
|
10
10
|
attribute :pathname
|
11
|
-
attribute :smells,
|
11
|
+
attribute :smells, Array, :default => []
|
12
12
|
attribute :churn
|
13
13
|
attribute :committed_at
|
14
14
|
attribute :complexity
|
15
|
-
attribute :duplication,
|
15
|
+
attribute :duplication, Integer, :default => 0
|
16
16
|
attribute :methods_count
|
17
17
|
|
18
18
|
def path
|
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: 2.
|
4
|
+
version: 2.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Guilherme Simoes
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-12-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: virtus
|
@@ -192,6 +192,7 @@ files:
|
|
192
192
|
- lib/rubycritic/analysers_runner.rb
|
193
193
|
- lib/rubycritic/cli/application.rb
|
194
194
|
- lib/rubycritic/cli/options.rb
|
195
|
+
- lib/rubycritic/colorize.rb
|
195
196
|
- lib/rubycritic/commands/ci.rb
|
196
197
|
- lib/rubycritic/commands/default.rb
|
197
198
|
- lib/rubycritic/commands/help.rb
|