maximus 0.1.5.1 → 0.1.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/CHANGELOG.md +72 -0
- data/LICENSE.txt +1 -1
- data/README.md +1 -61
- data/lib/maximus/cli.rb +23 -8
- data/lib/maximus/config.rb +37 -35
- data/lib/maximus/config/maximus.yml +11 -1
- data/lib/maximus/git_control.rb +90 -56
- data/lib/maximus/helper.rb +26 -29
- data/lib/maximus/lint.rb +96 -47
- data/lib/maximus/lints/brakeman.rb +25 -22
- data/lib/maximus/lints/jshint.rb +3 -2
- data/lib/maximus/lints/railsbp.rb +2 -2
- data/lib/maximus/lints/rubocop.rb +2 -1
- data/lib/maximus/lints/scsslint.rb +2 -2
- data/lib/maximus/reporter/git-lines.sh +0 -1
- data/lib/maximus/statistic.rb +0 -2
- data/lib/maximus/statistics/phantomas.rb +3 -3
- data/lib/maximus/statistics/stylestats.rb +37 -33
- data/lib/maximus/statistics/wraith.rb +25 -16
- data/lib/maximus/version.rb +1 -1
- data/maximus.gemspec +4 -3
- data/roadmap.md +3 -8
- data/spec/maximus/config_spec.rb +95 -16
- data/spec/maximus/git_control_spec.rb +5 -5
- data/spec/maximus/helper_spec.rb +39 -5
- data/spec/maximus/lint_spec.rb +18 -3
- data/spec/spec_helper.rb +3 -0
- data/spec/support/config_helper.rb +14 -0
- metadata +55 -38
@@ -85,28 +85,28 @@ describe Maximus::GitControl do
|
|
85
85
|
|
86
86
|
end
|
87
87
|
|
88
|
-
describe '#
|
88
|
+
describe '#define_psuedo_commit' do
|
89
89
|
|
90
90
|
context 'words are provided' do
|
91
91
|
|
92
92
|
context 'master is supplied' do
|
93
93
|
let(:config) { { commit: 'master' } }
|
94
94
|
it 'should return the master sha' do
|
95
|
-
expect( git.send(:
|
95
|
+
expect( git.send(:define_psuedo_commit) ).to eq `git -C #{Dir.pwd} rev-parse --branches=master HEAD`.strip!
|
96
96
|
end
|
97
97
|
end
|
98
98
|
|
99
99
|
context 'last is supplied' do
|
100
100
|
let(:config) { { commit: 'last' } }
|
101
101
|
it 'should return the previous_commit sha' do
|
102
|
-
expect( git.send(:
|
102
|
+
expect( git.send(:define_psuedo_commit) ).to eq `git -C #{Dir.pwd} rev-list --max-count=2 HEAD --reverse | head -n1`.strip!
|
103
103
|
end
|
104
104
|
end
|
105
105
|
|
106
106
|
context 'working is supplied' do
|
107
107
|
let(:config) { { commit: 'working' } }
|
108
108
|
it 'should return the word "working"' do
|
109
|
-
expect( git.send(:
|
109
|
+
expect( git.send(:define_psuedo_commit) ).to eq 'working'
|
110
110
|
end
|
111
111
|
end
|
112
112
|
|
@@ -115,7 +115,7 @@ describe Maximus::GitControl do
|
|
115
115
|
context 'a commit hash is provided' do
|
116
116
|
let(:config) { { commit: '22126a6ba227d81f770d13c302e6225f7463f7be' } }
|
117
117
|
it 'should return the provided hash' do
|
118
|
-
expect( git.send(:
|
118
|
+
expect( git.send(:define_psuedo_commit) ).to eq '22126a6ba227d81f770d13c302e6225f7463f7be'
|
119
119
|
end
|
120
120
|
end
|
121
121
|
|
data/spec/maximus/helper_spec.rb
CHANGED
@@ -14,8 +14,19 @@ describe Maximus::Helper do
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
+
context 'when Rails is defined' do
|
18
|
+
it 'should be true' do
|
19
|
+
stub_const('Rails', true)
|
20
|
+
expect(dummy_class.is_rails?).to be_truthy
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
17
24
|
end
|
18
25
|
|
26
|
+
# @todo - return to 68adbaa7b1e729c5d38a2dde6245e8c86704ad5f and figure out a
|
27
|
+
# way to test for middleman's existence. Can't stub it very well.
|
28
|
+
# Once this is determined, change up #discover_path too
|
29
|
+
|
19
30
|
describe '#root_dir', :isolated_environment do
|
20
31
|
|
21
32
|
context 'when project is not a Rails app' do
|
@@ -82,15 +93,38 @@ describe Maximus::Helper do
|
|
82
93
|
|
83
94
|
end
|
84
95
|
|
85
|
-
describe '#
|
96
|
+
describe '#discover_path' do
|
97
|
+
|
98
|
+
context 'when @path is set' do
|
99
|
+
it 'should return @path' do
|
100
|
+
dummy_class.instance_variable_set("@path", '/some/fake/path/to/files')
|
101
|
+
expect( dummy_class.discover_path(Dir.pwd) ).to eq '/some/fake/path/to/files'
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
context 'when Rails is defined' do
|
106
|
+
it 'should return a rails-y path' do
|
107
|
+
stub_const('Rails', true)
|
108
|
+
path = dummy_class.discover_path(Dir.pwd, 'stylesheets', 'scss')
|
109
|
+
expect( path ).to include('app/assets/stylesheets')
|
110
|
+
expect( dummy_class.discover_path(Dir.pwd, 'scss') ).to include('assets')
|
111
|
+
end
|
112
|
+
end
|
86
113
|
|
87
|
-
context 'when
|
88
|
-
|
114
|
+
context 'when neither Middleman or Rails are defined' do
|
115
|
+
it 'should return a path with just the root directory' do
|
116
|
+
path = dummy_class.discover_path(Dir.pwd)
|
117
|
+
expect( path ).to eq Dir.pwd
|
118
|
+
end
|
119
|
+
end
|
89
120
|
|
90
|
-
|
91
|
-
|
121
|
+
context 'when neither Middleman or Rails are defined and an extension is provided' do
|
122
|
+
it 'should return a generic glob path' do
|
123
|
+
path = dummy_class.discover_path(Dir.pwd, 'stylesheets', 'scss')
|
124
|
+
expect( path ).to include('**/*')
|
92
125
|
end
|
93
126
|
end
|
127
|
+
|
94
128
|
end
|
95
129
|
|
96
130
|
|
data/spec/maximus/lint_spec.rb
CHANGED
@@ -7,14 +7,17 @@ describe Maximus::Lint do
|
|
7
7
|
{"/Users/Tim/dummy/app/assets/stylesheets/application.css"=>[{"line"=>1, "column"=>1, "length"=>1, "severity"=>"warning", "reason"=>"Use `//` comments everywhere", "linter"=>"Comment"}], "/Users/Tim/dummy/app/assets/stylesheets/main.css.scss"=>[{"line"=>2, "column"=>3, "length"=>16, "severity"=>"warning", "reason"=>"Properties should be ordered margin, max-width", "linter"=>"PropertySortOrder"}]}
|
8
8
|
}
|
9
9
|
|
10
|
-
subject(:lint)
|
10
|
+
subject(:lint) do
|
11
|
+
described_class.new
|
12
|
+
end
|
13
|
+
|
14
|
+
describe '.refine', :isolated_environment do
|
11
15
|
|
12
|
-
describe '#refine', :isolated_environment do
|
13
16
|
context 'data is blank' do
|
14
17
|
let(:data) { }
|
15
18
|
it 'should provide a blank response' do
|
16
19
|
STDOUT.should_receive(:puts).with("#{''.color(:green)}: #{'[0]'.color(:yellow)}#{' [0]'.color(:red)}")
|
17
|
-
blank_response = { lint_warnings: [], lint_errors: [], lint_conventions: [], lint_refactors: [], raw_data: "{}" }
|
20
|
+
blank_response = { lint_warnings: [], lint_errors: [], lint_conventions: [], lint_refactors: [], lint_fatals: [], raw_data: "{}" }
|
18
21
|
expect( lint.refine(data) ).to eq blank_response
|
19
22
|
end
|
20
23
|
end
|
@@ -37,6 +40,7 @@ describe Maximus::Lint do
|
|
37
40
|
expect( lint.refine(data.to_json) ).to be_a(Hash)
|
38
41
|
end
|
39
42
|
end
|
43
|
+
|
40
44
|
end
|
41
45
|
|
42
46
|
describe '#evaluate_severities', :isolated_environment do
|
@@ -48,4 +52,15 @@ describe Maximus::Lint do
|
|
48
52
|
end
|
49
53
|
end
|
50
54
|
|
55
|
+
describe '#lines_added_to_range', :isolated_environment do
|
56
|
+
|
57
|
+
context 'when a functional hash is provided' do
|
58
|
+
let(:lines_added) { { changes: ['0..5', '11..14'] } }
|
59
|
+
|
60
|
+
it 'should return an array of numbers' do
|
61
|
+
expect( lint.send(:lines_added_to_range, lines_added) ).to eq( [ 0,1,2,3,4,5, 11,12,13,14] )
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
51
66
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -0,0 +1,14 @@
|
|
1
|
+
|
2
|
+
module ConfigHelper
|
3
|
+
|
4
|
+
def create_config(contents = '', location = '.maximus.yml')
|
5
|
+
File.write(location, contents)
|
6
|
+
config_contents = contents.blank? ? {} : { config_file: location }
|
7
|
+
described_class.new(config_contents)
|
8
|
+
end
|
9
|
+
|
10
|
+
def destroy_config(location = '.maximus.yml')
|
11
|
+
FileUtils.rm(location) if File.exist?(location)
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
metadata
CHANGED
@@ -1,43 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: maximus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Shedor
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-03-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: git
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 1.2.9
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 1.2.9
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: scss-lint
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
33
|
+
version: 0.34.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.
|
40
|
+
version: 0.34.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rainbow
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -56,140 +56,154 @@ dependencies:
|
|
56
56
|
name: rubocop
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - ~>
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '0.
|
61
|
+
version: '0.29'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - ~>
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '0.
|
68
|
+
version: '0.29'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rails_best_practices
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - ~>
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '1.15'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - ~>
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '1.15'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: brakeman
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - ~>
|
87
|
+
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: 3.0.1
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - ~>
|
94
|
+
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: 3.0.1
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: wraith
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- - ~>
|
101
|
+
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
103
|
+
version: 2.3.2
|
104
104
|
type: :runtime
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- - ~>
|
108
|
+
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version:
|
110
|
+
version: 2.3.2
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: activesupport
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- -
|
115
|
+
- - ">="
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: '0'
|
118
118
|
type: :runtime
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- -
|
122
|
+
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: thor
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- -
|
129
|
+
- - ">="
|
130
130
|
- !ruby/object:Gem::Version
|
131
131
|
version: '0'
|
132
132
|
type: :runtime
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- -
|
136
|
+
- - ">="
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: bundler
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
|
-
- - ~>
|
143
|
+
- - "~>"
|
144
144
|
- !ruby/object:Gem::Version
|
145
145
|
version: '1.6'
|
146
146
|
type: :development
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
|
-
- - ~>
|
150
|
+
- - "~>"
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '1.6'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: pry-byebug
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - "~>"
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '3.0'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - "~>"
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '3.0'
|
153
167
|
- !ruby/object:Gem::Dependency
|
154
168
|
name: yard
|
155
169
|
requirement: !ruby/object:Gem::Requirement
|
156
170
|
requirements:
|
157
|
-
- - ~>
|
171
|
+
- - "~>"
|
158
172
|
- !ruby/object:Gem::Version
|
159
173
|
version: '0.8'
|
160
174
|
type: :development
|
161
175
|
prerelease: false
|
162
176
|
version_requirements: !ruby/object:Gem::Requirement
|
163
177
|
requirements:
|
164
|
-
- - ~>
|
178
|
+
- - "~>"
|
165
179
|
- !ruby/object:Gem::Version
|
166
180
|
version: '0.8'
|
167
181
|
- !ruby/object:Gem::Dependency
|
168
182
|
name: rspec
|
169
183
|
requirement: !ruby/object:Gem::Requirement
|
170
184
|
requirements:
|
171
|
-
- - ~>
|
185
|
+
- - "~>"
|
172
186
|
- !ruby/object:Gem::Version
|
173
187
|
version: '3.0'
|
174
188
|
type: :development
|
175
189
|
prerelease: false
|
176
190
|
version_requirements: !ruby/object:Gem::Requirement
|
177
191
|
requirements:
|
178
|
-
- - ~>
|
192
|
+
- - "~>"
|
179
193
|
- !ruby/object:Gem::Version
|
180
194
|
version: '3.0'
|
181
195
|
- !ruby/object:Gem::Dependency
|
182
196
|
name: coveralls
|
183
197
|
requirement: !ruby/object:Gem::Requirement
|
184
198
|
requirements:
|
185
|
-
- - ~>
|
199
|
+
- - "~>"
|
186
200
|
- !ruby/object:Gem::Version
|
187
201
|
version: 0.7.8
|
188
202
|
type: :development
|
189
203
|
prerelease: false
|
190
204
|
version_requirements: !ruby/object:Gem::Requirement
|
191
205
|
requirements:
|
192
|
-
- - ~>
|
206
|
+
- - "~>"
|
193
207
|
- !ruby/object:Gem::Version
|
194
208
|
version: 0.7.8
|
195
209
|
description: The all-in-one linting solution
|
@@ -200,9 +214,10 @@ executables:
|
|
200
214
|
extensions: []
|
201
215
|
extra_rdoc_files: []
|
202
216
|
files:
|
203
|
-
- .gitignore
|
204
|
-
- .rspec
|
205
|
-
- .travis.yml
|
217
|
+
- ".gitignore"
|
218
|
+
- ".rspec"
|
219
|
+
- ".travis.yml"
|
220
|
+
- CHANGELOG.md
|
206
221
|
- Gemfile
|
207
222
|
- LICENSE.txt
|
208
223
|
- README.md
|
@@ -239,6 +254,7 @@ files:
|
|
239
254
|
- spec/maximus/helper_spec.rb
|
240
255
|
- spec/maximus/lint_spec.rb
|
241
256
|
- spec/spec_helper.rb
|
257
|
+
- spec/support/config_helper.rb
|
242
258
|
- spec/support/rubocop.yml
|
243
259
|
homepage: https://github.com/wearefine/maximus
|
244
260
|
licenses:
|
@@ -250,17 +266,17 @@ require_paths:
|
|
250
266
|
- lib
|
251
267
|
required_ruby_version: !ruby/object:Gem::Requirement
|
252
268
|
requirements:
|
253
|
-
- -
|
269
|
+
- - ">="
|
254
270
|
- !ruby/object:Gem::Version
|
255
271
|
version: '0'
|
256
272
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
257
273
|
requirements:
|
258
|
-
- -
|
274
|
+
- - ">="
|
259
275
|
- !ruby/object:Gem::Version
|
260
276
|
version: '0'
|
261
277
|
requirements: []
|
262
278
|
rubyforge_project:
|
263
|
-
rubygems_version: 2.
|
279
|
+
rubygems_version: 2.4.2
|
264
280
|
signing_key:
|
265
281
|
specification_version: 4
|
266
282
|
summary: Make your code spic and <span>
|
@@ -270,5 +286,6 @@ test_files:
|
|
270
286
|
- spec/maximus/helper_spec.rb
|
271
287
|
- spec/maximus/lint_spec.rb
|
272
288
|
- spec/spec_helper.rb
|
289
|
+
- spec/support/config_helper.rb
|
273
290
|
- spec/support/rubocop.yml
|
274
291
|
has_rdoc:
|