codeguard 0.1.0 → 0.2.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/.rubocop.yml +7 -6
- data/HELP.md +23 -0
- data/README.md +1 -1
- data/codeguard.gemspec +1 -0
- data/config/.rubocop.yml +7 -6
- data/config/coffeelint.json +4 -1
- data/config/pre_commit.yml +9 -0
- data/lib/codeguard/cli.rb +2 -2
- data/lib/codeguard/git_message.rb +3 -1
- data/lib/codeguard/install.rb +0 -2
- data/lib/codeguard/pre_commit.rb +23 -0
- data/lib/codeguard/setup.rb +20 -0
- data/lib/codeguard/version.rb +1 -1
- data/lib/codeguard.rb +12 -14
- metadata +20 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1aec9a6eb30cc01b0856df8aa76668b859032359
|
|
4
|
+
data.tar.gz: ff80149e946c095d5171211d8f6546dd8bbfe8ac
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6cbea65fe897dea5e1cdb3f9f4c07b77ea07db912dca95088930fd7df158285eff35b3351323ff4526049557271fdb4508b6d68e11154a40bcec83d83045f9cc
|
|
7
|
+
data.tar.gz: a44fd969783e040a137a689d2172684d7bc06111d20313cec7b5c6c14fab31484d0e546548d9b60b3a7c28a8dc40c98b7620b240d89a3d31d0fc088624453260
|
data/.rubocop.yml
CHANGED
|
@@ -582,12 +582,12 @@ Style/SignalException:
|
|
|
582
582
|
|
|
583
583
|
Style/SingleLineBlockParams:
|
|
584
584
|
Methods:
|
|
585
|
-
- reduce:
|
|
586
|
-
-
|
|
587
|
-
-
|
|
588
|
-
- inject:
|
|
589
|
-
-
|
|
590
|
-
-
|
|
585
|
+
- reduce: # because reek hates single-letter variables
|
|
586
|
+
- acc
|
|
587
|
+
- el
|
|
588
|
+
- inject: # because reek hates single-letter variables
|
|
589
|
+
- acc
|
|
590
|
+
- el
|
|
591
591
|
|
|
592
592
|
Style/SingleLineMethods:
|
|
593
593
|
AllowIfMethodIsEmpty: true
|
|
@@ -630,6 +630,7 @@ Style/SpaceAroundOperators:
|
|
|
630
630
|
MultiSpaceAllowedForOperators:
|
|
631
631
|
- '='
|
|
632
632
|
- '=>'
|
|
633
|
+
- '|' # for codequest_pipes
|
|
633
634
|
|
|
634
635
|
Style/SpaceBeforeBlockBraces:
|
|
635
636
|
EnforcedStyle: space
|
data/HELP.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
Availables Commands
|
|
2
|
+
---
|
|
3
|
+
* `codeguard help` - show help message
|
|
4
|
+
* `codeguard install` - install config for current project
|
|
5
|
+
* `codeguard setup` - sets local configuration - this cmd should be run
|
|
6
|
+
in every local environment
|
|
7
|
+
* `codeguard diff` - check if the files were not modified
|
|
8
|
+
|
|
9
|
+
Installed Configuration
|
|
10
|
+
---
|
|
11
|
+
* coffeelint (http://www.coffeelint.org/)
|
|
12
|
+
* js_hint (https://github.com/damian/jshint)
|
|
13
|
+
* rubocop (https://github.com/bbatsov/rubocop)
|
|
14
|
+
* scss_lint (https://github.com/brigade/scss-lint)
|
|
15
|
+
* pre_commit (https://github.com/jish/pre-commit)
|
|
16
|
+
|
|
17
|
+
Local Setup
|
|
18
|
+
---
|
|
19
|
+
* `.gitmessage` file will be added as a template in .git/config
|
|
20
|
+
* `pre-commit install` will be run - which will register pre-commit hook
|
|
21
|
+
* `git config pre-commit.ruby` will be added for rvm users. If ruby
|
|
22
|
+
version/gemset is changed then you should run `codeguard install`
|
|
23
|
+
again.
|
data/README.md
CHANGED
data/codeguard.gemspec
CHANGED
|
@@ -23,6 +23,7 @@ Gem::Specification.new do |spec|
|
|
|
23
23
|
spec.add_runtime_dependency 'jshint'
|
|
24
24
|
spec.add_runtime_dependency 'scss_lint'
|
|
25
25
|
spec.add_runtime_dependency 'diffy'
|
|
26
|
+
spec.add_runtime_dependency 'pre-commit'
|
|
26
27
|
spec.add_development_dependency 'bundler', '>= 1.6.9'
|
|
27
28
|
spec.add_development_dependency 'rake', '~> 10.3'
|
|
28
29
|
end
|
data/config/.rubocop.yml
CHANGED
|
@@ -582,12 +582,12 @@ Style/SignalException:
|
|
|
582
582
|
|
|
583
583
|
Style/SingleLineBlockParams:
|
|
584
584
|
Methods:
|
|
585
|
-
- reduce:
|
|
586
|
-
-
|
|
587
|
-
-
|
|
588
|
-
- inject:
|
|
589
|
-
-
|
|
590
|
-
-
|
|
585
|
+
- reduce: # because reek hates single-letter variables
|
|
586
|
+
- acc
|
|
587
|
+
- el
|
|
588
|
+
- inject: # because reek hates single-letter variables
|
|
589
|
+
- acc
|
|
590
|
+
- el
|
|
591
591
|
|
|
592
592
|
Style/SingleLineMethods:
|
|
593
593
|
AllowIfMethodIsEmpty: true
|
|
@@ -630,6 +630,7 @@ Style/SpaceAroundOperators:
|
|
|
630
630
|
MultiSpaceAllowedForOperators:
|
|
631
631
|
- '='
|
|
632
632
|
- '=>'
|
|
633
|
+
- '|' # for codequest_pipes
|
|
633
634
|
|
|
634
635
|
Style/SpaceBeforeBlockBraces:
|
|
635
636
|
EnforcedStyle: space
|
data/config/coffeelint.json
CHANGED
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
"level": "ignore"
|
|
80
80
|
},
|
|
81
81
|
"no_interpolation_in_single_quotes": {
|
|
82
|
-
"level": "
|
|
82
|
+
"level": "warn"
|
|
83
83
|
},
|
|
84
84
|
"no_nested_string_interpolation": {
|
|
85
85
|
"level": "warn"
|
|
@@ -131,5 +131,8 @@
|
|
|
131
131
|
},
|
|
132
132
|
"transform_messes_up_line_numbers": {
|
|
133
133
|
"level": "warn"
|
|
134
|
+
},
|
|
135
|
+
"eol_last": {
|
|
136
|
+
"level": "warn"
|
|
134
137
|
}
|
|
135
138
|
}
|
data/lib/codeguard/cli.rb
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
module Codeguard
|
|
2
2
|
module CLI
|
|
3
|
-
AVAILABLE_OPTIONS = %w(install help diff)
|
|
3
|
+
AVAILABLE_OPTIONS = %w(install setup help diff)
|
|
4
4
|
|
|
5
5
|
module_function
|
|
6
6
|
|
|
7
7
|
def run(*args)
|
|
8
8
|
command = args.shift
|
|
9
9
|
unless AVAILABLE_OPTIONS.include?(command)
|
|
10
|
-
puts "Invalid option: #{command}"
|
|
10
|
+
puts "Invalid option: #{command}\n\n" if command
|
|
11
11
|
command = :help
|
|
12
12
|
end
|
|
13
13
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
require 'rainbow'
|
|
1
2
|
module Codeguard
|
|
2
3
|
module GitMessage
|
|
3
4
|
module_function
|
|
@@ -10,8 +11,9 @@ module Codeguard
|
|
|
10
11
|
Codeguard.config_path.join('.gitmessage')
|
|
11
12
|
end
|
|
12
13
|
|
|
13
|
-
def
|
|
14
|
+
def setup
|
|
14
15
|
`git config commit.template .gitmessage`
|
|
16
|
+
puts Rainbow('commit.template was added to git config').green
|
|
15
17
|
end
|
|
16
18
|
end # module GitMessage
|
|
17
19
|
end # module Codeguard
|
data/lib/codeguard/install.rb
CHANGED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
require 'rainbow'
|
|
2
|
+
module Codeguard
|
|
3
|
+
module PreCommit
|
|
4
|
+
module_function
|
|
5
|
+
|
|
6
|
+
def config_project_path
|
|
7
|
+
Pathname.new 'config/pre_commit.yml'
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def config_gem_path
|
|
11
|
+
Codeguard.config_path.join('pre_commit.yml')
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def setup
|
|
15
|
+
`pre-commit install`
|
|
16
|
+
puts Rainbow('pre-commit hooks were generated').green
|
|
17
|
+
|
|
18
|
+
return if `which rvm`.empty?
|
|
19
|
+
system('git config pre-commit.ruby "rvm `rvm current` do ruby"')
|
|
20
|
+
puts Rainbow('pre-commit.ruby was added to git config').green
|
|
21
|
+
end
|
|
22
|
+
end # module PreCommit
|
|
23
|
+
end # module Codeguard
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
require 'rainbow'
|
|
2
|
+
module Codeguard
|
|
3
|
+
class Setup
|
|
4
|
+
extend Forwardable
|
|
5
|
+
attr_accessor :lint
|
|
6
|
+
|
|
7
|
+
def self.perform(lint)
|
|
8
|
+
new(lint).tap(&:perform)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def initialize(lint)
|
|
12
|
+
@lint = lint
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def perform
|
|
16
|
+
lint.setup
|
|
17
|
+
puts Rainbow("Setup for #{lint} was finished.").green
|
|
18
|
+
end
|
|
19
|
+
end # class Setup
|
|
20
|
+
end # module Codeguard
|
data/lib/codeguard/version.rb
CHANGED
data/lib/codeguard.rb
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
require 'diffy'
|
|
2
2
|
require 'codeguard/install'
|
|
3
|
+
require 'codeguard/setup'
|
|
3
4
|
require 'codeguard/coffeelint'
|
|
4
5
|
require 'codeguard/js_hint'
|
|
5
6
|
require 'codeguard/rubocop'
|
|
6
7
|
require 'codeguard/scss_lint'
|
|
7
8
|
require 'codeguard/git_message'
|
|
8
9
|
require 'codeguard/diff'
|
|
10
|
+
require 'codeguard/pre_commit'
|
|
9
11
|
|
|
10
12
|
module Codeguard
|
|
11
|
-
LINTERS = [Coffeelint, GitMessage, JSHint, Rubocop, SCSSLint]
|
|
13
|
+
LINTERS = [Coffeelint, GitMessage, JSHint, PreCommit, Rubocop, SCSSLint]
|
|
14
|
+
# Lints that require setup in every local environment
|
|
15
|
+
LOCAL_LINTERS = [GitMessage, PreCommit]
|
|
12
16
|
|
|
13
17
|
module_function
|
|
14
18
|
|
|
@@ -18,6 +22,12 @@ module Codeguard
|
|
|
18
22
|
end
|
|
19
23
|
end
|
|
20
24
|
|
|
25
|
+
def setup
|
|
26
|
+
LOCAL_LINTERS.each do |lint|
|
|
27
|
+
Setup.perform(lint)
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
21
31
|
def diff
|
|
22
32
|
lints = LINTERS.map do |lint|
|
|
23
33
|
diff = Diff.perform(lint)
|
|
@@ -29,19 +39,7 @@ module Codeguard
|
|
|
29
39
|
end
|
|
30
40
|
|
|
31
41
|
def help
|
|
32
|
-
puts
|
|
33
|
-
codeguard help - show this message
|
|
34
|
-
codeguard install - install config for current project
|
|
35
|
-
codeguard diff - check if the files were not modified
|
|
36
|
-
|
|
37
|
-
The project will use configuration for:
|
|
38
|
-
- coffeelint (http://www.coffeelint.org/)
|
|
39
|
-
- js_hint (https://github.com/damian/jshint)
|
|
40
|
-
- rubocop (https://github.com/bbatsov/rubocop)
|
|
41
|
-
- scss_lint (https://github.com/brigade/scss-lint)
|
|
42
|
-
|
|
43
|
-
.gitmessage file will be added as a template in .git/config
|
|
44
|
-
)
|
|
42
|
+
puts IO.read(gem_root.join('HELP.md'))
|
|
45
43
|
end
|
|
46
44
|
|
|
47
45
|
def config_path
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: codeguard
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Marcin Wyszynski
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2015-11-
|
|
12
|
+
date: 2015-11-18 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: rubocop
|
|
@@ -67,6 +67,20 @@ dependencies:
|
|
|
67
67
|
- - ">="
|
|
68
68
|
- !ruby/object:Gem::Version
|
|
69
69
|
version: '0'
|
|
70
|
+
- !ruby/object:Gem::Dependency
|
|
71
|
+
name: pre-commit
|
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
|
73
|
+
requirements:
|
|
74
|
+
- - ">="
|
|
75
|
+
- !ruby/object:Gem::Version
|
|
76
|
+
version: '0'
|
|
77
|
+
type: :runtime
|
|
78
|
+
prerelease: false
|
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
80
|
+
requirements:
|
|
81
|
+
- - ">="
|
|
82
|
+
- !ruby/object:Gem::Version
|
|
83
|
+
version: '0'
|
|
70
84
|
- !ruby/object:Gem::Dependency
|
|
71
85
|
name: bundler
|
|
72
86
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -107,6 +121,7 @@ files:
|
|
|
107
121
|
- ".gitignore"
|
|
108
122
|
- ".rubocop.yml"
|
|
109
123
|
- Gemfile
|
|
124
|
+
- HELP.md
|
|
110
125
|
- LICENSE
|
|
111
126
|
- README.md
|
|
112
127
|
- Rakefile
|
|
@@ -117,6 +132,7 @@ files:
|
|
|
117
132
|
- config/.scss-lint.yml
|
|
118
133
|
- config/coffeelint.json
|
|
119
134
|
- config/jshint.yml
|
|
135
|
+
- config/pre_commit.yml
|
|
120
136
|
- eat-glitter.jpg
|
|
121
137
|
- lib/codeguard.rb
|
|
122
138
|
- lib/codeguard/cli.rb
|
|
@@ -125,8 +141,10 @@ files:
|
|
|
125
141
|
- lib/codeguard/git_message.rb
|
|
126
142
|
- lib/codeguard/install.rb
|
|
127
143
|
- lib/codeguard/js_hint.rb
|
|
144
|
+
- lib/codeguard/pre_commit.rb
|
|
128
145
|
- lib/codeguard/rubocop.rb
|
|
129
146
|
- lib/codeguard/scss_lint.rb
|
|
147
|
+
- lib/codeguard/setup.rb
|
|
130
148
|
- lib/codeguard/version.rb
|
|
131
149
|
homepage: https://github.com/codequest-eu/codeguard
|
|
132
150
|
licenses:
|