gazelle_styleguide 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.hound.yml +471 -0
- data/config/rubocop.yml +244 -88
- data/config/{checkstyle.properties → scss_lint.yml} +0 -0
- data/gazelle_styleguide.gemspec +2 -0
- data/lib/gazelle_styleguide/cli.rb +27 -5
- data/lib/gazelle_styleguide/version.rb +1 -1
- data/lib/gazelle_styleguide.rb +0 -8
- data/spec/gazelle_styleguide_spec.rb +0 -3
- metadata +35 -29
- data/lib/gazelle_styleguide/support/checkstyle-5.7-all.jar +0 -0
- data/lib/plugins/pre_commit/checks/checkstyle.rb +0 -36
- data/lib/plugins/pre_commit/checks/coffee_lint.rb +0 -25
- data/lib/plugins/pre_commit/checks/env.rb +0 -24
- data/lib/plugins/pre_commit/checks/json.rb +0 -30
- data/lib/plugins/pre_commit/checks/scss_lint.rb +0 -33
- data/lib/plugins/pre_commit/checks/yaml.rb +0 -30
metadata
CHANGED
@@ -1,20 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gazelle_styleguide
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.2
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Allen Madsen
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2014-
|
11
|
+
date: 2014-04-28 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: pre-commit
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
17
|
- - ! '>='
|
20
18
|
- !ruby/object:Gem::Version
|
@@ -22,7 +20,20 @@ dependencies:
|
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
|
23
|
+
requirements:
|
24
|
+
- - ! '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: pre-commit-checkstyle
|
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
|
26
37
|
requirements:
|
27
38
|
- - ! '>='
|
28
39
|
- !ruby/object:Gem::Version
|
@@ -30,7 +41,6 @@ dependencies:
|
|
30
41
|
- !ruby/object:Gem::Dependency
|
31
42
|
name: rubocop
|
32
43
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
44
|
requirements:
|
35
45
|
- - ! '>='
|
36
46
|
- !ruby/object:Gem::Version
|
@@ -38,7 +48,6 @@ dependencies:
|
|
38
48
|
type: :runtime
|
39
49
|
prerelease: false
|
40
50
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
51
|
requirements:
|
43
52
|
- - ! '>='
|
44
53
|
- !ruby/object:Gem::Version
|
@@ -46,7 +55,6 @@ dependencies:
|
|
46
55
|
- !ruby/object:Gem::Dependency
|
47
56
|
name: execjs
|
48
57
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
58
|
requirements:
|
51
59
|
- - ! '>='
|
52
60
|
- !ruby/object:Gem::Version
|
@@ -54,7 +62,6 @@ dependencies:
|
|
54
62
|
type: :runtime
|
55
63
|
prerelease: false
|
56
64
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
65
|
requirements:
|
59
66
|
- - ! '>='
|
60
67
|
- !ruby/object:Gem::Version
|
@@ -62,7 +69,6 @@ dependencies:
|
|
62
69
|
- !ruby/object:Gem::Dependency
|
63
70
|
name: grit
|
64
71
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
72
|
requirements:
|
67
73
|
- - ! '>='
|
68
74
|
- !ruby/object:Gem::Version
|
@@ -70,7 +76,20 @@ dependencies:
|
|
70
76
|
type: :runtime
|
71
77
|
prerelease: false
|
72
78
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
|
79
|
+
requirements:
|
80
|
+
- - ! '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: thor
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ! '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
74
93
|
requirements:
|
75
94
|
- - ! '>='
|
76
95
|
- !ruby/object:Gem::Version
|
@@ -78,7 +97,6 @@ dependencies:
|
|
78
97
|
- !ruby/object:Gem::Dependency
|
79
98
|
name: bundler
|
80
99
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
100
|
requirements:
|
83
101
|
- - ~>
|
84
102
|
- !ruby/object:Gem::Version
|
@@ -86,7 +104,6 @@ dependencies:
|
|
86
104
|
type: :development
|
87
105
|
prerelease: false
|
88
106
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
107
|
requirements:
|
91
108
|
- - ~>
|
92
109
|
- !ruby/object:Gem::Version
|
@@ -94,7 +111,6 @@ dependencies:
|
|
94
111
|
- !ruby/object:Gem::Dependency
|
95
112
|
name: rake
|
96
113
|
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
114
|
requirements:
|
99
115
|
- - ! '>='
|
100
116
|
- !ruby/object:Gem::Version
|
@@ -102,7 +118,6 @@ dependencies:
|
|
102
118
|
type: :development
|
103
119
|
prerelease: false
|
104
120
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
121
|
requirements:
|
107
122
|
- - ! '>='
|
108
123
|
- !ruby/object:Gem::Version
|
@@ -110,7 +125,6 @@ dependencies:
|
|
110
125
|
- !ruby/object:Gem::Dependency
|
111
126
|
name: rspec
|
112
127
|
requirement: !ruby/object:Gem::Requirement
|
113
|
-
none: false
|
114
128
|
requirements:
|
115
129
|
- - ! '>='
|
116
130
|
- !ruby/object:Gem::Version
|
@@ -118,7 +132,6 @@ dependencies:
|
|
118
132
|
type: :development
|
119
133
|
prerelease: false
|
120
134
|
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
none: false
|
122
135
|
requirements:
|
123
136
|
- - ! '>='
|
124
137
|
- !ruby/object:Gem::Version
|
@@ -132,6 +145,7 @@ extensions: []
|
|
132
145
|
extra_rdoc_files: []
|
133
146
|
files:
|
134
147
|
- .gitignore
|
148
|
+
- .hound.yml
|
135
149
|
- .rspec
|
136
150
|
- .travis.yml
|
137
151
|
- Gemfile
|
@@ -139,48 +153,40 @@ files:
|
|
139
153
|
- README.md
|
140
154
|
- Rakefile
|
141
155
|
- bin/gazelle_styleguide
|
142
|
-
- config/checkstyle.properties
|
143
156
|
- config/coffeelint.json
|
144
157
|
- config/jshintrc.json
|
145
158
|
- config/rubocop.yml
|
159
|
+
- config/scss_lint.yml
|
146
160
|
- config/sun_checks.xml
|
147
161
|
- gazelle_styleguide.gemspec
|
148
162
|
- lib/gazelle_styleguide.rb
|
149
163
|
- lib/gazelle_styleguide/cli.rb
|
150
|
-
- lib/gazelle_styleguide/support/checkstyle-5.7-all.jar
|
151
164
|
- lib/gazelle_styleguide/version.rb
|
152
|
-
- lib/plugins/pre_commit/checks/checkstyle.rb
|
153
|
-
- lib/plugins/pre_commit/checks/coffee_lint.rb
|
154
|
-
- lib/plugins/pre_commit/checks/env.rb
|
155
|
-
- lib/plugins/pre_commit/checks/json.rb
|
156
|
-
- lib/plugins/pre_commit/checks/scss_lint.rb
|
157
|
-
- lib/plugins/pre_commit/checks/yaml.rb
|
158
165
|
- spec/gazelle_styleguide_spec.rb
|
159
166
|
- spec/spec_helper.rb
|
160
167
|
homepage: https://github.com/secondrotation/gazelle_styleguide
|
161
168
|
licenses:
|
162
169
|
- MIT
|
170
|
+
metadata: {}
|
163
171
|
post_install_message:
|
164
172
|
rdoc_options: []
|
165
173
|
require_paths:
|
166
174
|
- lib
|
167
175
|
required_ruby_version: !ruby/object:Gem::Requirement
|
168
|
-
none: false
|
169
176
|
requirements:
|
170
177
|
- - ! '>='
|
171
178
|
- !ruby/object:Gem::Version
|
172
179
|
version: '0'
|
173
180
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
174
|
-
none: false
|
175
181
|
requirements:
|
176
182
|
- - ! '>='
|
177
183
|
- !ruby/object:Gem::Version
|
178
184
|
version: '0'
|
179
185
|
requirements: []
|
180
186
|
rubyforge_project:
|
181
|
-
rubygems_version:
|
187
|
+
rubygems_version: 2.2.2
|
182
188
|
signing_key:
|
183
|
-
specification_version:
|
189
|
+
specification_version: 4
|
184
190
|
summary: Gazelle's coding style guidelines and checks
|
185
191
|
test_files:
|
186
192
|
- spec/gazelle_styleguide_spec.rb
|
Binary file
|
@@ -1,36 +0,0 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
|
-
require 'open3'
|
3
|
-
require 'pre-commit/checks/plugin'
|
4
|
-
|
5
|
-
module PreCommit
|
6
|
-
module Checks
|
7
|
-
# Runs checkstyle against java files
|
8
|
-
class Checkstyle < Plugin
|
9
|
-
def call(staged_files)
|
10
|
-
staged_files = staged_files.grep(/\.java$/)
|
11
|
-
return if staged_files.empty?
|
12
|
-
|
13
|
-
args = (jar_flag + config_file_flag + checks_file_flag + staged_files).join(' ')
|
14
|
-
puts "java #{args}"
|
15
|
-
stdout, stderr, result = Open3.capture3("java #{args}")
|
16
|
-
stdout + stderr unless result.success?
|
17
|
-
end
|
18
|
-
|
19
|
-
def jar_flag
|
20
|
-
['-jar', File.expand_path('../../../../gazelle_styleguide/support/checkstyle-5.7-all.jar', __FILE__)]
|
21
|
-
end
|
22
|
-
|
23
|
-
def config_file_flag
|
24
|
-
ENV['CHECKSTYLE_CONFIG'] ? ['-p', ENV['CHECKSTYLE_CONFIG']] : []
|
25
|
-
end
|
26
|
-
|
27
|
-
def checks_file_flag
|
28
|
-
ENV['CHECKSTYLE_CHECKS'] ? ['-c', ENV['CHECKSTYLE_CHECKS']] : []
|
29
|
-
end
|
30
|
-
|
31
|
-
def self.description
|
32
|
-
'Runs coffeelint to detect errors'
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
|
-
require 'open3'
|
3
|
-
require 'pre-commit/checks/plugin'
|
4
|
-
|
5
|
-
module PreCommit
|
6
|
-
module Checks
|
7
|
-
# Runs coffeelint against coffeescript files
|
8
|
-
class CoffeeLint < Plugin
|
9
|
-
def call(staged_files)
|
10
|
-
staged_files = staged_files.grep(/\.coffee$/)
|
11
|
-
return if staged_files.empty?
|
12
|
-
|
13
|
-
config_flag = ENV['COFFEELINT_CONFIG'] ? "-f #{ENV['COFFEELINT_CONFIG']}" : ''
|
14
|
-
args = staged_files.join(' ')
|
15
|
-
|
16
|
-
stdout, stderr, result = Open3.capture3("coffeelint #{config_flag} #{args}")
|
17
|
-
stdout + stderr unless result.success?
|
18
|
-
end
|
19
|
-
|
20
|
-
def self.description
|
21
|
-
'Runs coffeelint to detect errors'
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
@@ -1,24 +0,0 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
|
-
require 'gazelle_styleguide'
|
3
|
-
require 'pre-commit/checks/plugin'
|
4
|
-
|
5
|
-
module PreCommit
|
6
|
-
module Checks
|
7
|
-
# Loads environment variables for configuration.
|
8
|
-
class Env < Plugin
|
9
|
-
def call(staged_files)
|
10
|
-
ENV['JSHINT_CONFIG'] = GazelleStyleguide.config_for('jshintrc.json')
|
11
|
-
ENV['COFFEELINT_CONFIG'] = GazelleStyleguide.config_for('coffeelint.json')
|
12
|
-
ENV['RUBOCOP_CONFIG'] = GazelleStyleguide.config_for('rubocop.yml')
|
13
|
-
ENV['CHECKSTYLE_CONFIG'] = GazelleStyleguide.config_for('checkstyle.properties')
|
14
|
-
ENV['CHECKSTYLE_CHECKS'] = GazelleStyleguide.config_for('sun_checks.xml')
|
15
|
-
|
16
|
-
nil
|
17
|
-
end
|
18
|
-
|
19
|
-
def self.description
|
20
|
-
'Load environment variables for linter configuration.'
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
|
-
require 'json'
|
3
|
-
require 'pre-commit/checks/plugin'
|
4
|
-
|
5
|
-
module PreCommit
|
6
|
-
module Checks
|
7
|
-
# Checks JSON to make sure it's parsable.
|
8
|
-
class Json < Plugin
|
9
|
-
def call(staged_files)
|
10
|
-
staged_files = staged_files.grep(/\.json$/)
|
11
|
-
return if staged_files.empty?
|
12
|
-
|
13
|
-
errors = staged_files.map {|file| load_file(file)}.compact
|
14
|
-
|
15
|
-
errors.join("\n") unless errors.empty?
|
16
|
-
end
|
17
|
-
|
18
|
-
def load_file(file)
|
19
|
-
File.open(file) {|io| JSON.load(io)}
|
20
|
-
nil
|
21
|
-
rescue StandardError => e
|
22
|
-
"#{e.message} parsing #{file}"
|
23
|
-
end
|
24
|
-
|
25
|
-
def self.description
|
26
|
-
'Runs json to detect errors.'
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
@@ -1,33 +0,0 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
|
-
require 'open3'
|
3
|
-
require 'pre-commit/checks/plugin'
|
4
|
-
|
5
|
-
module PreCommit
|
6
|
-
module Checks
|
7
|
-
# Lints SCSS files with scss-lint
|
8
|
-
class ScssLint < Plugin
|
9
|
-
def call(staged_files)
|
10
|
-
staged_files = staged_files.grep(/\.coffee$/)
|
11
|
-
return if staged_files.empty?
|
12
|
-
|
13
|
-
args = staged_files.join(' ')
|
14
|
-
command = "scss-lint #{config_flag} #{args}"
|
15
|
-
|
16
|
-
stdout, stderr, result = Open3.capture3(command)
|
17
|
-
stdout + stderr unless result.success?
|
18
|
-
end
|
19
|
-
|
20
|
-
def config_flag
|
21
|
-
if ENV['SCSSLINT_CONFIG']
|
22
|
-
"-c #{ENV['SCSSLINT_CONFIG']}"
|
23
|
-
else
|
24
|
-
''
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
def self.description
|
29
|
-
'Runs scss-lint to detect errors'
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
|
-
require 'yaml'
|
3
|
-
require 'pre-commit/checks/plugin'
|
4
|
-
|
5
|
-
module PreCommit
|
6
|
-
module Checks
|
7
|
-
# Checks YAML to make sure it's parsable.
|
8
|
-
class Yaml < Plugin
|
9
|
-
def call(staged_files)
|
10
|
-
staged_files = staged_files.grep(/\.(yml|yaml)$/)
|
11
|
-
return if staged_files.empty?
|
12
|
-
|
13
|
-
errors = staged_files.map {|file| load_file(file)}.compact
|
14
|
-
|
15
|
-
errors.join('\n') unless errors.empty?
|
16
|
-
end
|
17
|
-
|
18
|
-
def load_file(file)
|
19
|
-
YAML.load_file(file)
|
20
|
-
nil
|
21
|
-
rescue ArgumentError => e
|
22
|
-
"#{e.message} parsing #{file}"
|
23
|
-
end
|
24
|
-
|
25
|
-
def self.description
|
26
|
-
'Runs yaml to detect errors.'
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|