erb_lint 0.0.15 → 0.0.16
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/lib/erb_lint/linters/rubocop.rb +5 -1
- data/lib/erb_lint/linters/rubocop_text.rb +36 -0
- data/lib/erb_lint/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3c37dac539b74d21e18c464572f2f23b1a97f51e
|
4
|
+
data.tar.gz: e6fa57adca117817ad3751c2c578376f2966797e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b54a86052a95da2553de0466a0dc361b8809f78de6d937ad41a8296ea5d5a84bdb35d3058cdcc35e5f7855fb405a041801bc709d7b04a37571609c7bc3b06d31
|
7
|
+
data.tar.gz: 9622136f47124c7fc10db55b740b6cd1db734ecee94ecaffc2b6f03d1243de3cfb13401217e4f98377a48fcd3e20a1ecc1775ce949ccab15e2bdb1b117a36585
|
@@ -30,7 +30,7 @@ module ERBLint
|
|
30
30
|
|
31
31
|
def offenses(processed_source)
|
32
32
|
offenses = []
|
33
|
-
processed_source
|
33
|
+
descendant_nodes(processed_source).each do |erb_node|
|
34
34
|
offenses.push(*inspect_content(processed_source, erb_node))
|
35
35
|
end
|
36
36
|
offenses
|
@@ -51,6 +51,10 @@ module ERBLint
|
|
51
51
|
|
52
52
|
private
|
53
53
|
|
54
|
+
def descendant_nodes(processed_source)
|
55
|
+
processed_source.ast.descendants(:erb)
|
56
|
+
end
|
57
|
+
|
54
58
|
class OffenseWithCorrection < Offense
|
55
59
|
attr_reader :correction, :offset, :bound_range
|
56
60
|
def initialize(linter, source_range, message, correction:, offset:, bound_range:)
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ERBLint
|
4
|
+
module Linters
|
5
|
+
class RubocopText < Rubocop
|
6
|
+
include LinterRegistry
|
7
|
+
|
8
|
+
class ConfigSchema < LinterConfig
|
9
|
+
property :only, accepts: array_of?(String)
|
10
|
+
property :rubocop_config, accepts: Hash
|
11
|
+
end
|
12
|
+
|
13
|
+
self.config_schema = ConfigSchema
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def descendant_nodes(parser)
|
18
|
+
erb_nodes = []
|
19
|
+
|
20
|
+
parser.ast.descendants(:text).each do |text_node|
|
21
|
+
text_node.descendants(:erb).each do |erb_node|
|
22
|
+
erb_nodes << erb_node
|
23
|
+
end
|
24
|
+
end
|
25
|
+
erb_nodes
|
26
|
+
end
|
27
|
+
|
28
|
+
def team
|
29
|
+
selected_cops = RuboCop::Cop::Cop.all.select { |cop| cop.match?(@only_cops) }
|
30
|
+
cop_classes = RuboCop::Cop::Registry.new(selected_cops)
|
31
|
+
|
32
|
+
RuboCop::Cop::Team.new(cop_classes, @rubocop_config, extra_details: true, display_cop_names: true)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
data/lib/erb_lint/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: erb_lint
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Chan
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-01-
|
11
|
+
date: 2018-01-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: better_html
|
@@ -142,6 +142,7 @@ files:
|
|
142
142
|
- lib/erb_lint/linters/erb_safety.rb
|
143
143
|
- lib/erb_lint/linters/final_newline.rb
|
144
144
|
- lib/erb_lint/linters/rubocop.rb
|
145
|
+
- lib/erb_lint/linters/rubocop_text.rb
|
145
146
|
- lib/erb_lint/offense.rb
|
146
147
|
- lib/erb_lint/offset_corrector.rb
|
147
148
|
- lib/erb_lint/processed_source.rb
|