copperizer 3.1.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 +7 -0
- data/.gitignore +36 -0
- data/Gemfile +11 -0
- data/Gemfile.lock +91 -0
- data/README.md +63 -0
- data/Rakefile +7 -0
- data/copperizer.gemspec +27 -0
- data/example.png +0 -0
- data/lib/checkstyle/file_reviewer.rb +126 -0
- data/lib/checkstyle/reviewer.rb +37 -0
- data/lib/copperizer.rb +11 -0
- data/lib/copperizer/version.rb +3 -0
- data/lib/generators/ruby_static_code_analysis/config_generator.rb +19 -0
- data/lib/generators/ruby_static_code_analysis/templates/rubocop.localch.yml +190 -0
- data/lib/generators/ruby_static_code_analysis/templates/rubocop.yml +4 -0
- data/lib/tasks/checkstyle.rake +13 -0
- metadata +117 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d35006a3b16af2bd681628f90a690c062ed50fa7
|
4
|
+
data.tar.gz: c846bbcda43c3e9283362cb1f91a0616d59b1ea4
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 24a4afad60afa535c4d1c9ad701346a9b0cbc220d931b7d29a2d529fca81733d71bb0bf57c61a2881216bfa2c702e9472555c66c6f8dfc00761adba236d6afcc
|
7
|
+
data.tar.gz: 916aa58d7bffaff2a2639629d268cfaf106b38dd2b33e0805f7c6a6d5527ae37b8a90e7f0b696c53c56c9a41f5bceb9002b2c8059a755c8482c32ec10f11f2c7
|
data/.gitignore
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
4
|
+
/coverage/
|
5
|
+
/InstalledFiles
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/spec/examples.txt
|
9
|
+
/test/tmp/
|
10
|
+
/test/version_tmp/
|
11
|
+
/tmp/
|
12
|
+
|
13
|
+
## Specific to RubyMotion:
|
14
|
+
.dat*
|
15
|
+
.repl_history
|
16
|
+
build/
|
17
|
+
|
18
|
+
## Documentation cache and generated files:
|
19
|
+
/.yardoc/
|
20
|
+
/_yardoc/
|
21
|
+
/doc/
|
22
|
+
/rdoc/
|
23
|
+
|
24
|
+
## Environment normalization:
|
25
|
+
/.bundle/
|
26
|
+
/vendor/bundle
|
27
|
+
/lib/bundler/man/
|
28
|
+
|
29
|
+
# for a library or gem, you might want to ignore these files since the code is
|
30
|
+
# intended to run in multiple environments; otherwise, check them in:
|
31
|
+
# Gemfile.lock
|
32
|
+
# .ruby-version
|
33
|
+
# .ruby-gemset
|
34
|
+
|
35
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
36
|
+
.rvmrc
|
data/Gemfile
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
source 'https://rubygems.org/'
|
2
|
+
|
3
|
+
# Declare your gem's dependencies in lhc.gemspec.
|
4
|
+
# Bundler will treat runtime dependencies like base dependencies, and
|
5
|
+
# development dependencies will be added by default to the :development group.
|
6
|
+
gemspec
|
7
|
+
|
8
|
+
# Declare any dependencies that are still in development here instead of in
|
9
|
+
# your gemspec. These might include edge Rails or gems from your path or
|
10
|
+
# Git. Remember to move these dependencies to your gemspec before releasing
|
11
|
+
# your gem to rubygems.org.
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
copperizer (3.1.0)
|
5
|
+
lhc
|
6
|
+
railties
|
7
|
+
rubocop (= 0.36)
|
8
|
+
rubocop-rspec
|
9
|
+
|
10
|
+
GEM
|
11
|
+
remote: https://rubygems.org/
|
12
|
+
specs:
|
13
|
+
actionpack (4.2.5.1)
|
14
|
+
actionview (= 4.2.5.1)
|
15
|
+
activesupport (= 4.2.5.1)
|
16
|
+
rack (~> 1.6)
|
17
|
+
rack-test (~> 0.6.2)
|
18
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
19
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
20
|
+
actionview (4.2.5.1)
|
21
|
+
activesupport (= 4.2.5.1)
|
22
|
+
builder (~> 3.1)
|
23
|
+
erubis (~> 2.7.0)
|
24
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
25
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
26
|
+
activesupport (4.2.5.1)
|
27
|
+
i18n (~> 0.7)
|
28
|
+
json (~> 1.7, >= 1.7.7)
|
29
|
+
minitest (~> 5.1)
|
30
|
+
thread_safe (~> 0.3, >= 0.3.4)
|
31
|
+
tzinfo (~> 1.1)
|
32
|
+
ast (2.2.0)
|
33
|
+
builder (3.2.2)
|
34
|
+
erubis (2.7.0)
|
35
|
+
ethon (0.8.1)
|
36
|
+
ffi (>= 1.3.0)
|
37
|
+
ffi (1.9.10)
|
38
|
+
i18n (0.7.0)
|
39
|
+
json (1.8.3)
|
40
|
+
lhc (3.4.0)
|
41
|
+
activesupport (~> 4.1)
|
42
|
+
typhoeus
|
43
|
+
loofah (2.0.3)
|
44
|
+
nokogiri (>= 1.5.9)
|
45
|
+
mini_portile2 (2.0.0)
|
46
|
+
minitest (5.8.4)
|
47
|
+
nokogiri (1.6.7.2)
|
48
|
+
mini_portile2 (~> 2.0.0.rc2)
|
49
|
+
parser (2.3.0.2)
|
50
|
+
ast (~> 2.2)
|
51
|
+
powerpack (0.1.1)
|
52
|
+
rack (1.6.4)
|
53
|
+
rack-test (0.6.3)
|
54
|
+
rack (>= 1.0)
|
55
|
+
rails-deprecated_sanitizer (1.0.3)
|
56
|
+
activesupport (>= 4.2.0.alpha)
|
57
|
+
rails-dom-testing (1.0.7)
|
58
|
+
activesupport (>= 4.2.0.beta, < 5.0)
|
59
|
+
nokogiri (~> 1.6.0)
|
60
|
+
rails-deprecated_sanitizer (>= 1.0.1)
|
61
|
+
rails-html-sanitizer (1.0.3)
|
62
|
+
loofah (~> 2.0)
|
63
|
+
railties (4.2.5.1)
|
64
|
+
actionpack (= 4.2.5.1)
|
65
|
+
activesupport (= 4.2.5.1)
|
66
|
+
rake (>= 0.8.7)
|
67
|
+
thor (>= 0.18.1, < 2.0)
|
68
|
+
rainbow (2.1.0)
|
69
|
+
rake (10.5.0)
|
70
|
+
rubocop (0.36.0)
|
71
|
+
parser (>= 2.3.0.0, < 3.0)
|
72
|
+
powerpack (~> 0.1)
|
73
|
+
rainbow (>= 1.99.1, < 3.0)
|
74
|
+
ruby-progressbar (~> 1.7)
|
75
|
+
rubocop-rspec (1.3.1)
|
76
|
+
ruby-progressbar (1.7.5)
|
77
|
+
thor (0.19.1)
|
78
|
+
thread_safe (0.3.5)
|
79
|
+
typhoeus (1.0.1)
|
80
|
+
ethon (>= 0.8.0)
|
81
|
+
tzinfo (1.2.2)
|
82
|
+
thread_safe (~> 0.1)
|
83
|
+
|
84
|
+
PLATFORMS
|
85
|
+
ruby
|
86
|
+
|
87
|
+
DEPENDENCIES
|
88
|
+
copperizer!
|
89
|
+
|
90
|
+
BUNDLED WITH
|
91
|
+
1.10.6
|
data/README.md
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
- Simplifies performing static code analysis for ruby
|
2
|
+
- Creates line-based violation reports on Github
|
3
|
+
|
4
|
+

|
5
|
+
|
6
|
+
Setup
|
7
|
+
=====
|
8
|
+
|
9
|
+
1. Add the following to `Gemfile`:
|
10
|
+
```
|
11
|
+
gem 'copperizer'
|
12
|
+
```
|
13
|
+
|
14
|
+
2. Generate configuration files:
|
15
|
+
```
|
16
|
+
bundle exec rails generate copperizer:config
|
17
|
+
```
|
18
|
+
This will create two files:
|
19
|
+
- `.rubocop.localch.yml` - with master configuration
|
20
|
+
- `.rubocop.yml` - for your specific tweaks per project
|
21
|
+
|
22
|
+
Keep in mind that `.rubocop.localch.yml` will always be overwritten and should never be modified.
|
23
|
+
|
24
|
+
3. If needed, tweak the configuration in `.rubocop.yml`
|
25
|
+
|
26
|
+
4. You're good to go
|
27
|
+
|
28
|
+
Use Rubocop
|
29
|
+
=====
|
30
|
+
|
31
|
+
After configuration is generated you can run `rubocop`.
|
32
|
+
|
33
|
+
Useful options:
|
34
|
+
- `rubocop --format offenses`
|
35
|
+
|
36
|
+
This will generate a list of offenses sorted by number of occurrences - useful for tweaking configuration
|
37
|
+
|
38
|
+
- `rubocop --auto-gen-config`
|
39
|
+
|
40
|
+
Generates `.rubocop_todo.yml` with a configuration that disables all offended cops. This way you can enable & fix them step by step.
|
41
|
+
|
42
|
+
If you want to use this approach remember to add `rubocop_todo.yml` to `inherit_from` list in the configuration
|
43
|
+
|
44
|
+
- `rubocop --auto-correct`
|
45
|
+
|
46
|
+
Tries to automatically fix some of the offenses. Might be a good starting point for fixing code style. Use with caution as it's marked as experimental.
|
47
|
+
|
48
|
+
Run checkstyle
|
49
|
+
========
|
50
|
+
|
51
|
+
Simply run the following rake task:
|
52
|
+
|
53
|
+
```
|
54
|
+
GIT_REPOSITORY=https://github.com/local-ch/copperizer GITHUB_TOKEN=your_github_token rake checkstyle
|
55
|
+
```
|
56
|
+
|
57
|
+
Exit code determines if static code analysis was successful or if any violations was found.
|
58
|
+
|
59
|
+
The `GIT_REPOSITORY` takes the link to the Github repo.
|
60
|
+
|
61
|
+
You can define the `RESULT_PATH` (e.g. RESULT_PATH='tmp/checkstyle.json') to define where violation reports are stored.
|
62
|
+
|
63
|
+
The `GITHUB_TOKEN` is required to make line-based violation comments on Github.
|
data/Rakefile
ADDED
data/copperizer.gemspec
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
$:.push File.expand_path("../lib", __FILE__)
|
2
|
+
|
3
|
+
# Maintain your gem's version:
|
4
|
+
require "copperizer/version"
|
5
|
+
|
6
|
+
# Describe your gem and declare its dependencies:
|
7
|
+
Gem::Specification.new do |s|
|
8
|
+
s.name = 'copperizer'
|
9
|
+
s.version = Copperizer::VERSION
|
10
|
+
s.authors = 'https://github.com/local-ch/copperizer/graphs/contributors'
|
11
|
+
s.email = ['ws-operations@local.ch']
|
12
|
+
s.homepage = 'https://github.com/local-ch/copperizer'
|
13
|
+
s.description = "Simplifies performing static code analysis and creates line-based violation reports on Github."
|
14
|
+
s.summary = s.description
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
s.test_files = `git ls-files -- spec/*`.split("\n")
|
18
|
+
s.require_paths = ['lib']
|
19
|
+
|
20
|
+
s.requirements << 'Ruby >= 1.9.2'
|
21
|
+
s.required_ruby_version = '>= 1.9.2'
|
22
|
+
|
23
|
+
s.add_dependency 'rubocop', '= 0.36'
|
24
|
+
s.add_dependency 'rubocop-rspec'
|
25
|
+
s.add_dependency 'lhc'
|
26
|
+
s.add_dependency 'railties'
|
27
|
+
end
|
data/example.png
ADDED
Binary file
|
@@ -0,0 +1,126 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
3
|
+
module Checkstyle
|
4
|
+
class FileReviewer
|
5
|
+
|
6
|
+
HEADERS = { 'Authorization' => "token #{ENV['GITHUB_TOKEN']}" }
|
7
|
+
|
8
|
+
RUBOCOP_QUOTES = [
|
9
|
+
"> - Robo, excuse me, Robo. Any special message for all the kids watching at home?\n> - Stay out of trouble.",
|
10
|
+
'> Four... three... two... one... I am now authorized to use physical force!',
|
11
|
+
'> Thank you for your co-operation. Good night.',
|
12
|
+
'> Serve the public trust. Protect the innocent. Uphold the law.',
|
13
|
+
'> Your move, creep.',
|
14
|
+
'> Come quietly or there will be trouble.',
|
15
|
+
'> You are under arrest.',
|
16
|
+
"> Dead or alive, you're coming with me!",
|
17
|
+
'> Oooh, guns guns guns!',
|
18
|
+
'> Excuse me, I have to go. Somewhere there is a crime happening.'
|
19
|
+
]
|
20
|
+
|
21
|
+
attr_reader :file_path, :repository, :violations
|
22
|
+
|
23
|
+
def initialize(repository, file_path, violations)
|
24
|
+
@file_path = file_path
|
25
|
+
@violations = violations
|
26
|
+
@repository = repository
|
27
|
+
end
|
28
|
+
|
29
|
+
def review
|
30
|
+
log "Reviewing file #{file_path}"
|
31
|
+
|
32
|
+
violations.each { |violation| comment_violation(violation) }
|
33
|
+
end
|
34
|
+
|
35
|
+
private
|
36
|
+
|
37
|
+
def line_for_violation(patch, violation)
|
38
|
+
violating_line = violation['location']['line']
|
39
|
+
meta, *patch_lines = patch.split("\n")
|
40
|
+
|
41
|
+
start = meta.match(/\+(\d+)/)[1].to_i
|
42
|
+
patch_index = 0
|
43
|
+
|
44
|
+
patch_lines.each_with_index do |content, patch_position|
|
45
|
+
next if content.first == '-'
|
46
|
+
|
47
|
+
line_number = start + patch_index
|
48
|
+
return { number: line_number, patch_position: patch_position + 1, content: content } if line_number == violating_line
|
49
|
+
|
50
|
+
patch_index += 1
|
51
|
+
end
|
52
|
+
|
53
|
+
{}
|
54
|
+
end
|
55
|
+
|
56
|
+
def comment_violation(violation)
|
57
|
+
commit_sha = violating_commit_sha(violation)
|
58
|
+
commit = get("#{commit_url(commit_sha)}?v=3", cache: true).data
|
59
|
+
|
60
|
+
file_object = commit.files.find { |f| f.filename == file_path }
|
61
|
+
line = line_for_violation(file_object.patch, violation)
|
62
|
+
|
63
|
+
comment_on_line(file_object, line[:number], line[:patch_position], violation, commit)
|
64
|
+
end
|
65
|
+
|
66
|
+
# Gets SHA of the commit where line was last changed
|
67
|
+
def violating_commit_sha(violation)
|
68
|
+
line = violation['location']['line']
|
69
|
+
`git log --format="%H" -1 -L #{line},#{line}:#{file_path} | head -n 1`.strip
|
70
|
+
end
|
71
|
+
|
72
|
+
def commit_url(sha)
|
73
|
+
"https://api.github.com/repos/#{repository}/commits/#{sha}"
|
74
|
+
end
|
75
|
+
|
76
|
+
def already_commented?(file, line_number, violation, commit)
|
77
|
+
comments = get(commit.comments_url).data
|
78
|
+
comments.any? do |comment|
|
79
|
+
comment.body.scan(comment_signature(file, line_number, violation)).any?
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
def comment_on_line(file, line_number, patch_position, violation, commit)
|
84
|
+
if already_commented?(file, line_number, violation, commit)
|
85
|
+
log "\tI already commented on this"
|
86
|
+
return
|
87
|
+
end
|
88
|
+
|
89
|
+
body = {
|
90
|
+
body: line_comment(file, line_number, violation),
|
91
|
+
path: file.filename,
|
92
|
+
position: patch_position
|
93
|
+
}
|
94
|
+
LHC.post(commit.comments_url, headers: HEADERS, body: body.to_json)
|
95
|
+
log "\tfile change commented on Github"
|
96
|
+
rescue LHC::Error
|
97
|
+
log "\tencountered problems while trying to post comment file change on Github"
|
98
|
+
end
|
99
|
+
|
100
|
+
def comment_signature(file, line_number, violation)
|
101
|
+
"*#{file.filename}:#{line_number} #{violation['cop_name']}*"
|
102
|
+
end
|
103
|
+
|
104
|
+
def get(url, options = {})
|
105
|
+
LHC.get(url, options.reverse_merge(headers: HEADERS))
|
106
|
+
end
|
107
|
+
|
108
|
+
def line_comment(file, line_number, violation)
|
109
|
+
return line_comment_with_quote(file, line_number, violation) if rand > 0.6
|
110
|
+
|
111
|
+
plain_line_comment(file, line_number, violation)
|
112
|
+
end
|
113
|
+
|
114
|
+
def line_comment_with_quote(file, line_number, violation)
|
115
|
+
"#{plain_line_comment(file, line_number, violation)}\n\n#{RUBOCOP_QUOTES.sample}"
|
116
|
+
end
|
117
|
+
|
118
|
+
def plain_line_comment(file, line_number, violation)
|
119
|
+
"**[#{violation['severity']}]** #{violation['message']}\n#{comment_signature(file, line_number, violation)}"
|
120
|
+
end
|
121
|
+
|
122
|
+
def log(text)
|
123
|
+
puts "[CHECKSTYLE][Review file] #{text}"
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require_relative './file_reviewer.rb'
|
2
|
+
|
3
|
+
module Checkstyle
|
4
|
+
class Reviewer
|
5
|
+
|
6
|
+
attr_reader :repository, :report_file_path, :syntax_violation_report
|
7
|
+
|
8
|
+
def initialize(repository, report_file_path)
|
9
|
+
@report_file_path = report_file_path
|
10
|
+
@syntax_violation_report = JSON.parse(File.open(report_file_path).read).fetch('files', [])
|
11
|
+
@repository = repository
|
12
|
+
end
|
13
|
+
|
14
|
+
def review
|
15
|
+
log "Reviewing based on #{report_file_path}"
|
16
|
+
|
17
|
+
syntax_violation_report.each do |file_report|
|
18
|
+
next if file_report.fetch('offenses', []).empty?
|
19
|
+
|
20
|
+
review_file(file_report)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def review_file(file_report)
|
27
|
+
path = file_report.fetch('path', "")
|
28
|
+
violations = file_report.fetch('offenses', [])
|
29
|
+
|
30
|
+
FileReviewer.new(repository, path, violations).review
|
31
|
+
end
|
32
|
+
|
33
|
+
def log(text)
|
34
|
+
puts "[CHECKSTYLE][Review] #{text}"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
data/lib/copperizer.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
module Copperizer
|
2
|
+
class ConfigGenerator < Rails::Generators::Base
|
3
|
+
source_root File.expand_path('../templates', __FILE__)
|
4
|
+
|
5
|
+
desc <<DESC
|
6
|
+
Description:
|
7
|
+
Copies master configuration file to your project root directory as `rubocop.local.yml`.
|
8
|
+
Creates project specific settings in `rubocop.yml` that inherit from master congig.
|
9
|
+
DESC
|
10
|
+
|
11
|
+
def master_config
|
12
|
+
copy_file 'rubocop.localch.yml', '.rubocop.localch.yml', force: true
|
13
|
+
end
|
14
|
+
|
15
|
+
def project_config
|
16
|
+
copy_file 'rubocop.yml', '.rubocop.yml'
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,190 @@
|
|
1
|
+
# This is master rubocop configuration.
|
2
|
+
# DO NOT EDIT THIS FILE - it WILL be overwriten on every config update
|
3
|
+
AllCops:
|
4
|
+
TargetRubyVersion: 2.1
|
5
|
+
DisplayCopNames: true
|
6
|
+
DisplayStyleGuide: true
|
7
|
+
Include:
|
8
|
+
- '**/Rakefile'
|
9
|
+
- '**/config.ru'
|
10
|
+
- '**/Capfile'
|
11
|
+
Exclude:
|
12
|
+
- 'db/**/*'
|
13
|
+
- 'script/**/*'
|
14
|
+
- 'vendor/bundle/**/*'
|
15
|
+
- 'bin/**/*'
|
16
|
+
- 'config/unicorn.rb'
|
17
|
+
- 'config/compass.rb'
|
18
|
+
- 'Rakefile'
|
19
|
+
|
20
|
+
Rails:
|
21
|
+
Enabled: true
|
22
|
+
|
23
|
+
require:
|
24
|
+
- rubocop-rspec
|
25
|
+
|
26
|
+
Lint/HandleExceptions:
|
27
|
+
Exclude:
|
28
|
+
- spec/**/*
|
29
|
+
|
30
|
+
Metrics/LineLength:
|
31
|
+
Enabled: false
|
32
|
+
|
33
|
+
Metrics/AbcSize:
|
34
|
+
Enabled: false
|
35
|
+
|
36
|
+
Metrics/MethodLength:
|
37
|
+
Enabled: false
|
38
|
+
|
39
|
+
Metrics/CyclomaticComplexity:
|
40
|
+
Enabled: false
|
41
|
+
|
42
|
+
Metrics/PerceivedComplexity:
|
43
|
+
Enabled: false
|
44
|
+
|
45
|
+
Metrics/ClassLength:
|
46
|
+
Enabled: false
|
47
|
+
|
48
|
+
Metrics/ModuleLength:
|
49
|
+
Enabled: false
|
50
|
+
|
51
|
+
Metrics/ParameterLists:
|
52
|
+
Enabled: false
|
53
|
+
|
54
|
+
Metrics/BlockNesting:
|
55
|
+
Enabled: false
|
56
|
+
|
57
|
+
Performance/StringReplacement:
|
58
|
+
Enabled: false
|
59
|
+
|
60
|
+
Performance/TimesMap:
|
61
|
+
Enabled: false
|
62
|
+
|
63
|
+
Performance/RedundantBlockCall:
|
64
|
+
Enabled: false
|
65
|
+
|
66
|
+
Performance/RedundantMatch:
|
67
|
+
Enabled: false
|
68
|
+
|
69
|
+
Performance/RedundantMerge:
|
70
|
+
Enabled: false
|
71
|
+
|
72
|
+
Performance/Casecmp:
|
73
|
+
Enabled: false
|
74
|
+
|
75
|
+
Style/MultilineOperationIndentation:
|
76
|
+
EnforcedStyle: indented
|
77
|
+
|
78
|
+
Style/StringLiterals:
|
79
|
+
Enabled: false
|
80
|
+
|
81
|
+
Style/RegexpLiteral:
|
82
|
+
Exclude:
|
83
|
+
- spec/**/*
|
84
|
+
|
85
|
+
Style/DotPosition:
|
86
|
+
EnforcedStyle: leading
|
87
|
+
|
88
|
+
Style/AlignParameters:
|
89
|
+
Enabled: false
|
90
|
+
|
91
|
+
Style/NumericLiterals:
|
92
|
+
Enabled: false
|
93
|
+
|
94
|
+
Style/WordArray:
|
95
|
+
Enabled: false
|
96
|
+
|
97
|
+
Style/EmptyLinesAroundClassBody:
|
98
|
+
Enabled: false
|
99
|
+
|
100
|
+
Style/Next:
|
101
|
+
Enabled: false
|
102
|
+
|
103
|
+
Style/PercentLiteralDelimiters:
|
104
|
+
Enabled: false
|
105
|
+
|
106
|
+
Style/GlobalVars:
|
107
|
+
Enabled: false
|
108
|
+
|
109
|
+
Style/CommentAnnotation:
|
110
|
+
Enabled: false
|
111
|
+
|
112
|
+
Style/SymbolProc:
|
113
|
+
Enabled: false
|
114
|
+
|
115
|
+
Style/DoubleNegation:
|
116
|
+
Enabled: false
|
117
|
+
|
118
|
+
Style/FormatString:
|
119
|
+
Enabled: false
|
120
|
+
|
121
|
+
Style/AsciiComments:
|
122
|
+
Enabled: false
|
123
|
+
|
124
|
+
Style/BarePercentLiterals:
|
125
|
+
Enabled: false
|
126
|
+
|
127
|
+
Style/SingleLineBlockParams:
|
128
|
+
Enabled: false
|
129
|
+
|
130
|
+
Style/MultilineBlockChain:
|
131
|
+
Enabled: false
|
132
|
+
|
133
|
+
Style/UnneededCapitalW:
|
134
|
+
Enabled: false
|
135
|
+
|
136
|
+
Style/UnneededPercentQ:
|
137
|
+
Enabled: false
|
138
|
+
|
139
|
+
Style/BlockDelimiters:
|
140
|
+
Exclude:
|
141
|
+
- spec/**/*
|
142
|
+
|
143
|
+
Style/BracesAroundHashParameters:
|
144
|
+
EnforcedStyle: context_dependent
|
145
|
+
|
146
|
+
Style/IfUnlessModifier:
|
147
|
+
Enabled: false
|
148
|
+
|
149
|
+
Style/ClassAndModuleChildren:
|
150
|
+
Enabled: false
|
151
|
+
|
152
|
+
Style/Documentation:
|
153
|
+
Enabled: false
|
154
|
+
|
155
|
+
Style/GuardClause:
|
156
|
+
Enabled: false
|
157
|
+
|
158
|
+
Style/AccessorMethodName:
|
159
|
+
Exclude:
|
160
|
+
- spec/support/pages/**/*
|
161
|
+
|
162
|
+
Style/NegatedIf:
|
163
|
+
Enabled: false
|
164
|
+
|
165
|
+
Style/MutableConstant:
|
166
|
+
Enabled: false
|
167
|
+
|
168
|
+
Style/ConditionalAssignment:
|
169
|
+
Enabled: false
|
170
|
+
|
171
|
+
Style/IndentArray:
|
172
|
+
EnforcedStyle: consistent
|
173
|
+
|
174
|
+
Style/MultilineMethodCallIndentation:
|
175
|
+
EnforcedStyle: indented
|
176
|
+
|
177
|
+
RSpec/DescribeClass:
|
178
|
+
Exclude:
|
179
|
+
- spec/views/**/*
|
180
|
+
- spec/routing/**/*
|
181
|
+
- spec/requests/**/*
|
182
|
+
- spec/features/**/*
|
183
|
+
|
184
|
+
RSpec/FilePath:
|
185
|
+
Enabled: false
|
186
|
+
|
187
|
+
Rails/Output:
|
188
|
+
Exclude:
|
189
|
+
- 'config/application.rb'
|
190
|
+
- 'config/initializers/asset_manifest_warning.rb'
|
@@ -0,0 +1,13 @@
|
|
1
|
+
task :checkstyle do
|
2
|
+
puts "[CHECKSTYLE] start task"
|
3
|
+
begin
|
4
|
+
Checkstyle::Reviewer.new(
|
5
|
+
ENV['GIT_REPOSITORY'],
|
6
|
+
ENV['RESULT_PATH'] || 'tmp/checkstyle.json'
|
7
|
+
).review
|
8
|
+
rescue => e
|
9
|
+
puts "[CHECKSTYLE][ERROR] #{e}"
|
10
|
+
puts e.backtrace
|
11
|
+
exit 1
|
12
|
+
end
|
13
|
+
end
|
metadata
ADDED
@@ -0,0 +1,117 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: copperizer
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 3.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- https://github.com/local-ch/copperizer/graphs/contributors
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-02-09 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rubocop
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.36'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.36'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rubocop-rspec
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: lhc
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: railties
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: Simplifies performing static code analysis and creates line-based violation
|
70
|
+
reports on Github.
|
71
|
+
email:
|
72
|
+
- ws-operations@local.ch
|
73
|
+
executables: []
|
74
|
+
extensions: []
|
75
|
+
extra_rdoc_files: []
|
76
|
+
files:
|
77
|
+
- ".gitignore"
|
78
|
+
- Gemfile
|
79
|
+
- Gemfile.lock
|
80
|
+
- README.md
|
81
|
+
- Rakefile
|
82
|
+
- copperizer.gemspec
|
83
|
+
- example.png
|
84
|
+
- lib/checkstyle/file_reviewer.rb
|
85
|
+
- lib/checkstyle/reviewer.rb
|
86
|
+
- lib/copperizer.rb
|
87
|
+
- lib/copperizer/version.rb
|
88
|
+
- lib/generators/ruby_static_code_analysis/config_generator.rb
|
89
|
+
- lib/generators/ruby_static_code_analysis/templates/rubocop.localch.yml
|
90
|
+
- lib/generators/ruby_static_code_analysis/templates/rubocop.yml
|
91
|
+
- lib/tasks/checkstyle.rake
|
92
|
+
homepage: https://github.com/local-ch/copperizer
|
93
|
+
licenses: []
|
94
|
+
metadata: {}
|
95
|
+
post_install_message:
|
96
|
+
rdoc_options: []
|
97
|
+
require_paths:
|
98
|
+
- lib
|
99
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 1.9.2
|
104
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
105
|
+
requirements:
|
106
|
+
- - ">="
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: '0'
|
109
|
+
requirements:
|
110
|
+
- Ruby >= 1.9.2
|
111
|
+
rubyforge_project:
|
112
|
+
rubygems_version: 2.2.2
|
113
|
+
signing_key:
|
114
|
+
specification_version: 4
|
115
|
+
summary: Simplifies performing static code analysis and creates line-based violation
|
116
|
+
reports on Github.
|
117
|
+
test_files: []
|