suspiciouss 0.1.2 → 0.1.3
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/lib/suspiciouss/linter.rb +4 -3
- data/lib/suspiciouss/suggestions/element.rb +11 -0
- data/lib/suspiciouss/version.rb +1 -1
- data/spec/linter_spec.rb +3 -0
- data/spec/spec_helper.rb +1 -1
- data/spec/suggestions/element_spec.rb +20 -0
- data/suspiciouss.gemspec +5 -5
- metadata +26 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2cec60795a5d43b153226bdbd7a07f145bf9e943
|
4
|
+
data.tar.gz: 04c7f1e38dd8befc36c7bd8df2e672f8e6452977
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d38bb88b4b85053b01bd940e2882fe7e6085600c399c1a32ab988fb415337d712a05cdc1de760da7fe50363e061f8b2baf477e7d8c5f7a2e2067c2c525803b81
|
7
|
+
data.tar.gz: 7f34108c06f126c456f267adb7a67426eb84e3690846ffcf1b5610e80a1736ddfce5961ad5ea2970c7431b782a3bda19a121b911c4922e3f55e9026089aea189
|
data/.gitignore
CHANGED
data/lib/suspiciouss/linter.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'suspiciouss/suggestions/camel_case'
|
2
|
+
require 'suspiciouss/suggestions/element'
|
2
3
|
require 'suspiciouss/suggestions/indentation'
|
3
4
|
require 'suspiciouss/suggestions/overqualifying'
|
4
5
|
require 'suspiciouss/suggestions/styling_ids'
|
@@ -58,13 +59,13 @@ module Suspiciouss
|
|
58
59
|
# Parses a line with each of the known suggestions and adds the result
|
59
60
|
# to the final output.
|
60
61
|
def parse(full_line)
|
61
|
-
|
62
|
+
line = strip_diff_syntax full_line
|
62
63
|
|
63
64
|
return unless full_line =~ /^\+ /
|
64
65
|
|
65
66
|
known_suggestions.each do |suggestion|
|
66
|
-
if result = suggestion.parse(
|
67
|
-
@result[@filename] << "#{result}: #{
|
67
|
+
if result = suggestion.parse(line)
|
68
|
+
@result[@filename] << "#{result}: #{line}"
|
68
69
|
end
|
69
70
|
end
|
70
71
|
end
|
data/lib/suspiciouss/version.rb
CHANGED
data/spec/linter_spec.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
require 'fakefs/spec_helpers'
|
3
|
+
require 'yaml'
|
3
4
|
|
4
5
|
describe Suspiciouss::Linter do
|
5
6
|
|
@@ -35,6 +36,7 @@ describe Suspiciouss::Linter do
|
|
35
36
|
it 'is a list of Linters' do
|
36
37
|
expect(suggestions_to_use).to match_array(%w(
|
37
38
|
CamelCase
|
39
|
+
Element
|
38
40
|
Indentation
|
39
41
|
Overqualifying
|
40
42
|
StylingIds
|
@@ -77,6 +79,7 @@ describe Suspiciouss::Linter do
|
|
77
79
|
it 'excludes those suggestions' do
|
78
80
|
expect(suggestions_to_use).to match_array(%w(
|
79
81
|
CamelCase
|
82
|
+
Element
|
80
83
|
Overqualifying
|
81
84
|
StylingJsPrefix
|
82
85
|
Underscores
|
data/spec/spec_helper.rb
CHANGED
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Suspiciouss::Suggestions::Element do
|
4
|
+
|
5
|
+
describe '#parse' do
|
6
|
+
|
7
|
+
context 'invalid' do
|
8
|
+
let(:result) { 'Rightmost selector might be very common. Use a class instead' }
|
9
|
+
|
10
|
+
it { expect(subject.parse(' div {}')).to eq result }
|
11
|
+
it { expect(subject.parse(' .selector div {}')).to eq result }
|
12
|
+
end
|
13
|
+
|
14
|
+
context 'valid' do
|
15
|
+
let(:line) { 'div {}' }
|
16
|
+
|
17
|
+
it { expect(subject.parse(line)).to be_nil }
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/suspiciouss.gemspec
CHANGED
@@ -16,9 +16,9 @@ Gem::Specification.new do |gem|
|
|
16
16
|
gem.require_paths = ['lib']
|
17
17
|
|
18
18
|
gem.add_development_dependency 'rspec', '~> 2.12'
|
19
|
-
gem.add_development_dependency 'pry'
|
20
|
-
gem.add_development_dependency 'pry-
|
21
|
-
gem.add_development_dependency 'guard'
|
22
|
-
gem.add_development_dependency 'guard-rspec'
|
23
|
-
gem.add_development_dependency 'fakefs'
|
19
|
+
gem.add_development_dependency 'pry', '~> 0.9'
|
20
|
+
gem.add_development_dependency 'pry-byebug', '~> 1.3'
|
21
|
+
gem.add_development_dependency 'guard', '~> 2.5'
|
22
|
+
gem.add_development_dependency 'guard-rspec', '~> 3.0'
|
23
|
+
gem.add_development_dependency 'fakefs', '~> 0.5'
|
24
24
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: suspiciouss
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Cruz Horts
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-08-
|
11
|
+
date: 2014-08-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -28,72 +28,72 @@ dependencies:
|
|
28
28
|
name: pry
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
33
|
+
version: '0.9'
|
34
34
|
type: :development
|
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.9'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name: pry-
|
42
|
+
name: pry-byebug
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '1.3'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '1.3'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: guard
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '2.5'
|
62
62
|
type: :development
|
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: '
|
68
|
+
version: '2.5'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: guard-rspec
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '0'
|
75
|
+
version: '3.0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - "
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '0'
|
82
|
+
version: '3.0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: fakefs
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "
|
87
|
+
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
89
|
+
version: '0.5'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - "
|
94
|
+
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '0'
|
96
|
+
version: '0.5'
|
97
97
|
description:
|
98
98
|
email:
|
99
99
|
executables:
|
@@ -115,6 +115,7 @@ files:
|
|
115
115
|
- lib/suspiciouss/result/markdown.rb
|
116
116
|
- lib/suspiciouss/result/plain_text.rb
|
117
117
|
- lib/suspiciouss/suggestions/camel_case.rb
|
118
|
+
- lib/suspiciouss/suggestions/element.rb
|
118
119
|
- lib/suspiciouss/suggestions/indentation.rb
|
119
120
|
- lib/suspiciouss/suggestions/overqualifying.rb
|
120
121
|
- lib/suspiciouss/suggestions/styling_ids.rb
|
@@ -130,6 +131,7 @@ files:
|
|
130
131
|
- spec/result/plain_text_spec.rb
|
131
132
|
- spec/spec_helper.rb
|
132
133
|
- spec/suggestions/camel_case_spec.rb
|
134
|
+
- spec/suggestions/element_spec.rb
|
133
135
|
- spec/suggestions/indentation_spec.rb
|
134
136
|
- spec/suggestions/overqualifying_spec.rb
|
135
137
|
- spec/suggestions/styling_ids_spec.rb
|
@@ -170,6 +172,7 @@ test_files:
|
|
170
172
|
- spec/result/plain_text_spec.rb
|
171
173
|
- spec/spec_helper.rb
|
172
174
|
- spec/suggestions/camel_case_spec.rb
|
175
|
+
- spec/suggestions/element_spec.rb
|
173
176
|
- spec/suggestions/indentation_spec.rb
|
174
177
|
- spec/suggestions/overqualifying_spec.rb
|
175
178
|
- spec/suggestions/styling_ids_spec.rb
|