codescout-analyzer 0.0.2 → 0.0.3

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: 6a6d126d6eb7377c77080ca471e26bf039c4072e
4
- data.tar.gz: e5d3ddfd3749840cb5ed4b3b21dc5526e55bed82
3
+ metadata.gz: b5bbd279690398513403dcaf2e61d8daddb1f5c1
4
+ data.tar.gz: 6367488ffea5bb24d9a0e520bf351cb15e443f43
5
5
  SHA512:
6
- metadata.gz: beb441c0c9e402a9344483288e678878536f66e423cb71b5ba188d90ed0bf9f61c3d9b4163e8857b6e637c71b0be300d60a7ca5d5a2707085cbb990c3a3b3459
7
- data.tar.gz: 56f32c635fbb07bb38cb7f48e515e0a5e33385482febd7720c4afe66a463b99f1fdcec2a98720b11c458c77808ee57c488a33986f2070d8d4d7a17def2b6f081
6
+ metadata.gz: f5f14e83d2232dabeb25f7a1674bf7957d7400fcf2c2ddccd5406548c72e565c46491ee0595d07311d6a20c74002e7ee04443cdd81000a350f53282bff637ee0
7
+ data.tar.gz: dda279f1a4b9b7c76f28207d6f78d5df104bbf4338e18b8afa48544f7dac937eb718b187562228628fa5c95048c96daac0dd024f5661068f2620a4d9401f127c
data/README.md ADDED
@@ -0,0 +1,46 @@
1
+ # codescout-analyzer
2
+
3
+ Generate code analysis report using Flog, Flay, Brakeman and Rubocop
4
+
5
+ ## Overview
6
+
7
+ Codescout analyzer is an open-source library designed to produce a static code analysis report
8
+ for metrics like complexity, duplication, security and code guidelines. It heavily relies on popular projects:
9
+
10
+ - [Flog](https://github.com/seattlerb/flog) - code complexity
11
+ - [Flay](https://github.com/seattlerb/flay) - code duplication
12
+ - [Brakeman](https://github.com/presidentbeef/brakeman) - rails security
13
+ - [Rubocop](https://github.com/bbatsov/rubocop) - code formatting and styleguide
14
+ - [Churn](https://github.com/danmayer/churn) - code changes frequency
15
+
16
+ ## Installation
17
+
18
+ You can install library using Rubygems:
19
+
20
+ ```
21
+ gem install codescout-analyzer
22
+ ```
23
+
24
+ Or include it into Gemfile:
25
+
26
+ ```
27
+ gem "codescout-analyzer"
28
+ ```
29
+
30
+ ## Usage
31
+
32
+ To generante code metrics report simple run the following command:
33
+
34
+ ```
35
+ codescout /path/to/your/project
36
+ ```
37
+
38
+ ## Testing
39
+
40
+ TODO
41
+
42
+ ## License
43
+
44
+ The MIT License (MIT)
45
+
46
+ Copyright (c) 2014 Doejo LLC, <dan@doejo.com>
data/bin/codescout CHANGED
@@ -20,6 +20,7 @@ require "codescout/file_stats"
20
20
  require "codescout/churn_stats"
21
21
  require "codescout/brakeman_stats"
22
22
  require "codescout/rubocop_stats"
23
+ require "codescout/commit_stats"
23
24
 
24
25
  analyzer = Codescout::RepoAnalyzer.new(path)
25
26
  analyzer.analyze
@@ -17,6 +17,7 @@ Gem::Specification.new do |s|
17
17
  s.add_dependency "ruby2ruby", "2.1.1"
18
18
  s.add_dependency "brakeman", "2.6.2"
19
19
  s.add_dependency "rubocop", "0.25.0"
20
+ s.add_dependency "git", "1.2.8"
20
21
 
21
22
  s.files = `git ls-files`.split("\n")
22
23
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
@@ -0,0 +1,26 @@
1
+ require "git"
2
+ require "logger"
3
+ require "pp"
4
+
5
+ module Codescout
6
+ class CommitStats
7
+ def initialize(analyzer)
8
+ git = Git.open(".", log: Logger.new(STDERR))
9
+ commit = git.gcommit("HEAD")
10
+
11
+ @hash = {
12
+ commit: commit.sha,
13
+ author: commit.author.name,
14
+ author_email: commit.author.email,
15
+ committer: commit.committer.name,
16
+ committer_email: commit.committer.email,
17
+ branch: commit.name,
18
+ message: commit.message
19
+ }
20
+ end
21
+
22
+ def to_hash
23
+ @hash
24
+ end
25
+ end
26
+ end
@@ -18,6 +18,8 @@ module Codescout
18
18
  run_churn
19
19
  run_brakeman
20
20
  run_rubocop
21
+ run_commitstats
22
+ cleanup
21
23
  end
22
24
  end
23
25
 
@@ -28,7 +30,8 @@ module Codescout
28
30
  flay: @flay,
29
31
  churn: @churn,
30
32
  brakeman: @brakeman,
31
- rubocop: @rubocop
33
+ rubocop: @rubocop,
34
+ commit: @commit
32
35
  }
33
36
  end
34
37
 
@@ -78,6 +81,17 @@ module Codescout
78
81
  @rubocop = Codescout::RubocopStats.new(self).results
79
82
  end
80
83
 
84
+ def run_commitstats
85
+ STDERR.puts "Runnig commit stats"
86
+ @commit = Codescout::CommitStats.new(self).to_hash
87
+ end
88
+
89
+ def cleanup
90
+ %w(./rubocop.yml ./rubocop.json ./tmp/churn).each do |path|
91
+ FileUtils.rm_rf(path)
92
+ end
93
+ end
94
+
81
95
  def valid_file?(file)
82
96
  return false unless ALLOWED_FILES.include?(File.extname(file))
83
97
  return false if file =~ /^db|spec|features|test|examples|samples\//
@@ -1,3 +1,3 @@
1
1
  module Codescout
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: codescout-analyzer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Sosedoff
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-08 00:00:00.000000000 Z
11
+ date: 2014-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: flog
@@ -108,6 +108,20 @@ dependencies:
108
108
  - - '='
109
109
  - !ruby/object:Gem::Version
110
110
  version: 0.25.0
111
+ - !ruby/object:Gem::Dependency
112
+ name: git
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - '='
116
+ - !ruby/object:Gem::Version
117
+ version: 1.2.8
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - '='
123
+ - !ruby/object:Gem::Version
124
+ version: 1.2.8
111
125
  description: No description for now, maybe later
112
126
  email:
113
127
  - dan.sosedoff@gmail.com
@@ -118,12 +132,14 @@ extra_rdoc_files: []
118
132
  files:
119
133
  - ".gitignore"
120
134
  - Gemfile
135
+ - README.md
121
136
  - Rakefile
122
137
  - bin/codescout
123
138
  - codescout-analyzer.gemspec
124
139
  - config/rubocop.yml
125
140
  - lib/codescout/brakeman_stats.rb
126
141
  - lib/codescout/churn_stats.rb
142
+ - lib/codescout/commit_stats.rb
127
143
  - lib/codescout/file_stats.rb
128
144
  - lib/codescout/flay_stats.rb
129
145
  - lib/codescout/flog_stats.rb
@@ -156,3 +172,4 @@ signing_key:
156
172
  specification_version: 4
157
173
  summary: No description for now
158
174
  test_files: []
175
+ has_rdoc: