rubomatic-html 1.0.0.pre.rc.4 → 1.0.0.pre.rc.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b78d08b1ad6b85d973c8df49faeb93bc5a246e395c5ae93498e27fe1a988d38d
4
- data.tar.gz: cae1edb510525c781a04b91b34a46c4013a4db9c15c52f6e31fe219091bf6ba7
3
+ metadata.gz: 659fdbeda2f4fb7d3f3e8ac4469f7f153220833d5e12e26d40b801822edd58eb
4
+ data.tar.gz: a348502a063126f2f9d77caf7442e761f891ac650c011b318138f04e0806713d
5
5
  SHA512:
6
- metadata.gz: 4a388b2a799fa632ff7279efef24a4302baa50bb67c1702645d8e6aac7d2c5d9e9af6376799fdbb98e75ddce9a6883acd59d0bbd184a534004935fc66a1b6827
7
- data.tar.gz: 77645cb65a9e93818ff5769ff29c76708b83e40425e7e27c5994358294e803ca3463a782d646e24e5578a01727bec17ac86d3ff1a57eeedfbd292adb6b265a53
6
+ metadata.gz: da569ab102315a9ec509fa8817ed5757cf0300cee5aaf7d37245d37660ee10e687e48a5613c339a719bc9e1b54a6d4c2ca9bdb410dd3d90e12baad4ed4b2afba
7
+ data.tar.gz: a7250fa32cf8719926c03c5fcff994e3398e55b7b9649ec7d4846ad6db4fcc5d37be3dbd47301f5fd62ac97b8b3ed91342809d073917b576185863976f9bdae7
data/exe/rubomatic-html CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  # frozen_string_literal: true
4
4
 
5
+ require 'bundler/setup'
5
6
  require 'optparse'
6
7
  require 'rubomatic-html'
7
8
 
@@ -3,6 +3,14 @@
3
3
  module RubomaticHtml
4
4
  module Cop
5
5
  class Base
6
+ # Name for cop
7
+ #
8
+ # @return [String]
9
+ #
10
+ def self.name
11
+ 'Base'
12
+ end
13
+
6
14
  # @return [String]
7
15
  attr_accessor :file
8
16
 
@@ -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'
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RubomaticHtml
4
+ module Cop
5
+ module Layout
6
+ class Base < RubomaticHtml::Cop::Base
7
+ # Department for cop
8
+ #
9
+ # @return [String]
10
+ #
11
+ def self.department
12
+ 'Layout'
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -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)
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RubomaticHtml
4
+ module Cop
5
+ module Style
6
+ class Base < RubomaticHtml::Cop::Base
7
+ # Department for cop
8
+ #
9
+ # @return [String]
10
+ #
11
+ def self.department
12
+ 'Style'
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -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)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RubomaticHtml
4
- VERSION = '1.0.0-rc.4'
4
+ VERSION = '1.0.0-rc.6'
5
5
  end
@@ -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.to_s, :enabled)
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.to_s).fetch(:exclude, []).any? { |ignored| file.end_with?(ignored) }
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
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/