erb_lint 0.0.15 → 0.0.16

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c8bb5f9219e2d504a084421d56ba91c306804f49
4
- data.tar.gz: 2411ccd8f012fedba69d4ff4878308c27d95a2a8
3
+ metadata.gz: 3c37dac539b74d21e18c464572f2f23b1a97f51e
4
+ data.tar.gz: e6fa57adca117817ad3751c2c578376f2966797e
5
5
  SHA512:
6
- metadata.gz: 72f415558746d79920bc60abf8cf294a3e6d05bd562143ecef97a1b9f096ebbcb5d0797a1cd601fee72c20508711ae41d55eca91b1dd717d2faeb023cb4df04e
7
- data.tar.gz: 1e03d1221dcfa1c04379427f7fdccc7b9ac29c7b192ff7089a2fb3c3b437179fc6da214931665e43cf99fd0b8c5020257332be63d7a445a78587141ef9ae173e
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.ast.descendants(:erb).each do |erb_node|
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ERBLint
4
- VERSION = '0.0.15'
4
+ VERSION = '0.0.16'
5
5
  end
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.15
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-17 00:00:00.000000000 Z
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