rubomatic-html 1.0.0.pre.rc.4 → 1.0.0.pre.rc.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/exe/rubomatic-html +1 -0
- data/lib/rubomatic-html/cop/base.rb +8 -0
- data/lib/rubomatic-html/cop/cops.rb +2 -0
- data/lib/rubomatic-html/cop/layout/base.rb +17 -0
- data/lib/rubomatic-html/cop/layout/line_length.rb +9 -1
- data/lib/rubomatic-html/cop/layout/multiple_line_breaks.rb +9 -1
- data/lib/rubomatic-html/cop/layout/trailing_whitespace.rb +9 -1
- data/lib/rubomatic-html/cop/style/base.rb +17 -0
- data/lib/rubomatic-html/cop/style/partial_instance_variable.rb +9 -1
- data/lib/rubomatic-html/version.rb +1 -1
- data/lib/rubomatic-html.rb +6 -3
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 659fdbeda2f4fb7d3f3e8ac4469f7f153220833d5e12e26d40b801822edd58eb
|
4
|
+
data.tar.gz: a348502a063126f2f9d77caf7442e761f891ac650c011b318138f04e0806713d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: da569ab102315a9ec509fa8817ed5757cf0300cee5aaf7d37245d37660ee10e687e48a5613c339a719bc9e1b54a6d4c2ca9bdb410dd3d90e12baad4ed4b2afba
|
7
|
+
data.tar.gz: a7250fa32cf8719926c03c5fcff994e3398e55b7b9649ec7d4846ad6db4fcc5d37be3dbd47301f5fd62ac97b8b3ed91342809d073917b576185863976f9bdae7
|
data/exe/rubomatic-html
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative 'base'
|
4
|
+
require_relative 'layout/base'
|
4
5
|
require_relative 'layout/line_length'
|
5
6
|
require_relative 'layout/multiple_line_breaks'
|
6
7
|
require_relative 'layout/trailing_whitespace'
|
8
|
+
require_relative 'style/base'
|
7
9
|
require_relative 'style/partial_instance_variable'
|
@@ -3,7 +3,15 @@
|
|
3
3
|
module RubomaticHtml
|
4
4
|
module Cop
|
5
5
|
module Layout
|
6
|
-
class LineLength < RubomaticHtml::Cop::Base
|
6
|
+
class LineLength < RubomaticHtml::Cop::Layout::Base
|
7
|
+
# Name for the cop
|
8
|
+
#
|
9
|
+
# @return [String]
|
10
|
+
#
|
11
|
+
def self.name
|
12
|
+
[department, 'LineLength'].join('/')
|
13
|
+
end
|
14
|
+
|
7
15
|
# @see super
|
8
16
|
def run_for_line(line, index)
|
9
17
|
return if line.size <= 120
|
@@ -3,7 +3,15 @@
|
|
3
3
|
module RubomaticHtml
|
4
4
|
module Cop
|
5
5
|
module Layout
|
6
|
-
class MultipleLineBreaks < RubomaticHtml::Cop::Base
|
6
|
+
class MultipleLineBreaks < RubomaticHtml::Cop::Layout::Base
|
7
|
+
# Name for the cop
|
8
|
+
#
|
9
|
+
# @return [String]
|
10
|
+
#
|
11
|
+
def self.name
|
12
|
+
[department, 'MultipleLineBreaks'].join('/')
|
13
|
+
end
|
14
|
+
|
7
15
|
# @return [Boolean] tracks multiple consecutive line breaks
|
8
16
|
attr_accessor :prev_break
|
9
17
|
|
@@ -3,7 +3,15 @@
|
|
3
3
|
module RubomaticHtml
|
4
4
|
module Cop
|
5
5
|
module Layout
|
6
|
-
class TrailingWhitespace < RubomaticHtml::Cop::Base
|
6
|
+
class TrailingWhitespace < RubomaticHtml::Cop::Layout::Base
|
7
|
+
# Name for the cop
|
8
|
+
#
|
9
|
+
# @return [String]
|
10
|
+
#
|
11
|
+
def self.name
|
12
|
+
[department, 'TrailingWhitespace'].join('/')
|
13
|
+
end
|
14
|
+
|
7
15
|
# @see super
|
8
16
|
def run_for_line(line, index)
|
9
17
|
return unless line.match?(/\s\z/i)
|
@@ -3,7 +3,15 @@
|
|
3
3
|
module RubomaticHtml
|
4
4
|
module Cop
|
5
5
|
module Style
|
6
|
-
class PartialInstanceVariable < RubomaticHtml::Cop::Base
|
6
|
+
class PartialInstanceVariable < RubomaticHtml::Cop::Style::Base
|
7
|
+
# Name for the cop
|
8
|
+
#
|
9
|
+
# @return [String]
|
10
|
+
#
|
11
|
+
def self.name
|
12
|
+
[department, 'PartialInstanceVariable'].join('/')
|
13
|
+
end
|
14
|
+
|
7
15
|
# @see super
|
8
16
|
def run_for_line(line, index)
|
9
17
|
return unless File.basename(file).match?(/^_/i)
|
data/lib/rubomatic-html.rb
CHANGED
@@ -27,7 +27,7 @@ module RubomaticHtml
|
|
27
27
|
|
28
28
|
@files_to_lint = files_to_lint
|
29
29
|
|
30
|
-
custom_config = ::YAML.safe_load(Pathname.new('.rubomatic-html.yml')).freeze
|
30
|
+
custom_config = ::YAML.safe_load(Pathname.new('.rubomatic-html.yml').read).freeze
|
31
31
|
|
32
32
|
config = {}
|
33
33
|
|
@@ -92,14 +92,17 @@ module RubomaticHtml
|
|
92
92
|
#
|
93
93
|
def run_file(file)
|
94
94
|
cops = all_cops.filter_map do |cop|
|
95
|
-
next unless config.dig(cop.
|
95
|
+
next unless config.dig(cop.name, :enabled)
|
96
96
|
|
97
97
|
cop.new(file)
|
98
98
|
end
|
99
99
|
|
100
|
+
puts config
|
101
|
+
return if cops.empty?
|
102
|
+
|
100
103
|
File.open(file).each_line(chomp: true).with_index(1) do |line, index|
|
101
104
|
cops.each do |cop|
|
102
|
-
next if config.dig(cop.
|
105
|
+
next if config.dig(cop.class.name).fetch(:exclude, []).any? { |ignored| file.end_with?(ignored) }
|
103
106
|
|
104
107
|
cop.run_for_line(line, index)
|
105
108
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubomatic-html
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.pre.rc.
|
4
|
+
version: 1.0.0.pre.rc.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brands Insurance
|
@@ -46,9 +46,11 @@ files:
|
|
46
46
|
- lib/rubomatic-html.rb
|
47
47
|
- lib/rubomatic-html/cop/base.rb
|
48
48
|
- lib/rubomatic-html/cop/cops.rb
|
49
|
+
- lib/rubomatic-html/cop/layout/base.rb
|
49
50
|
- lib/rubomatic-html/cop/layout/line_length.rb
|
50
51
|
- lib/rubomatic-html/cop/layout/multiple_line_breaks.rb
|
51
52
|
- lib/rubomatic-html/cop/layout/trailing_whitespace.rb
|
53
|
+
- lib/rubomatic-html/cop/style/base.rb
|
52
54
|
- lib/rubomatic-html/cop/style/partial_instance_variable.rb
|
53
55
|
- lib/rubomatic-html/version.rb
|
54
56
|
homepage: https://github.com/BrandsInsurance/expert-chainsaw/
|