ccru 0.1.5 → 0.1.6
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/Gemfile.lock +1 -1
- data/lib/ccru/javascript_linter.rb +21 -0
- data/lib/ccru/javascript_linter_runner.rb +5 -2
- data/lib/ccru/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 612a8b433133e314689150b5b9970c8394931e21dd077953bcdd42cf79a706af
|
|
4
|
+
data.tar.gz: 81d099e9c75c25468bbf10fd326d12d0d331cc9bf12d0c6b50a269e1b606b0f7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: affae15adfeae4c7ba70bdd9500b384c41517c808d4637286ef145c05b5c347de21f650f45efd17a81eb9da1f1a3e0b614f85f425a7072c1c4d84a22ee876989
|
|
7
|
+
data.tar.gz: 0ce2fc9f7fe39b429dd945352214e75da045996b35a6da29b5abf0562451e1a4a14f8c938ff077ac679de19c40d6ece0dc3c020a55ee547cb795fb7c24b3a2b2
|
data/Gemfile.lock
CHANGED
|
@@ -173,6 +173,20 @@ module Ccru
|
|
|
173
173
|
@offenses
|
|
174
174
|
end
|
|
175
175
|
|
|
176
|
+
def lint_filtered(content, changed_lines)
|
|
177
|
+
@current_code = content.lines
|
|
178
|
+
|
|
179
|
+
changed_lines.each do |line_number|
|
|
180
|
+
line_content = content.lines[line_number - 1]
|
|
181
|
+
next unless line_content
|
|
182
|
+
|
|
183
|
+
check_js_conventions_for_line(line_content, line_number)
|
|
184
|
+
check_line_trailing_whitespace(line_content, line_number)
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
@offenses
|
|
188
|
+
end
|
|
189
|
+
|
|
176
190
|
def check_js_conventions(content)
|
|
177
191
|
@current_code = content.lines
|
|
178
192
|
|
|
@@ -187,6 +201,13 @@ module Ccru
|
|
|
187
201
|
end
|
|
188
202
|
end
|
|
189
203
|
|
|
204
|
+
def check_js_conventions_for_line(line_content, line_number)
|
|
205
|
+
return if line_content.strip.empty?
|
|
206
|
+
return if commment?(line_content, line_number)
|
|
207
|
+
|
|
208
|
+
check_line_conventions(line_content, line_number)
|
|
209
|
+
end
|
|
210
|
+
|
|
190
211
|
# rubocop:disable Metrics
|
|
191
212
|
def check_line_conventions(line_content, line_number)
|
|
192
213
|
ES6_VIOLATIONS.merge(CODE_QUALITY_RULES).each do |rule_name, rule|
|
|
@@ -25,8 +25,11 @@ module Ccru
|
|
|
25
25
|
return 0 unless content && meta[:lines].any?
|
|
26
26
|
|
|
27
27
|
linter = JavaScriptLinter.new
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
offenses = linter.lint_filtered(content, meta[:lines])
|
|
29
|
+
return 0 if offenses.empty?
|
|
30
|
+
|
|
31
|
+
print_offenses(path, offenses)
|
|
32
|
+
1
|
|
30
33
|
end
|
|
31
34
|
end
|
|
32
35
|
end
|
data/lib/ccru/version.rb
CHANGED