rubomatic-html 1.0.0.pre.rc.5 → 1.0.0.pre.rc.7

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: 5a3f0c368ce0db9d059b6df024179dea8b61f7baf728a851ee68230f7ef340ae
4
- data.tar.gz: 76e31d7b8857bf1a4faaafb16a4179f419d1b7c40e906e3a4e4f7a064c5d44b6
3
+ metadata.gz: 92f8dc1b2822df41a944940b7920eee075b2106c5159ee6be1241d1e8bd441db
4
+ data.tar.gz: 15e06bd14aad357a607312bfed62aa3c68a77bee0bec5690048b3872b5d18974
5
5
  SHA512:
6
- metadata.gz: 12e642698b9709969a7e49f0f77f5550701d52dbbf4e9f31a0f744df286370a25505886757a6cfc4d03d864fbe4c83f37dec8a9ad62af571f03831dbc2466607
7
- data.tar.gz: b4c5c365711aa8bbd9bc9bc8a190ec28ef90f4d93c4e0315ff166da076b2a1b780b8506524862b092a371c8394fc0f605306aa955db13ebf290bfdff5e43ae96
6
+ metadata.gz: 905843f469af82880378503aedc2d028b612f81f00ad889f5b2228410eb64864ff3a65908a958ca0a595bc281dce11bc289e94bdb58bc5f93623d40e8da6e073
7
+ data.tar.gz: ecb82747e79df319c71d6c77311a041336f1ba9921732544b7c25853ad7dff0fb2d571d0f9a29c6609f6e769a0cd770d181da280a36125819aff6ea265e11a7d
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.5'
4
+ VERSION = '1.0.0-rc.7'
5
5
  end
@@ -92,14 +92,16 @@ 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
+ return if cops.empty?
101
+
100
102
  File.open(file).each_line(chomp: true).with_index(1) do |line, index|
101
103
  cops.each do |cop|
102
- next if config.dig(cop.to_s).fetch(:exclude, []).any? { |ignored| file.end_with?(ignored) }
104
+ next if config.dig(cop.class.name).fetch(:exclude, []).any? { |ignored| file.end_with?(ignored) }
103
105
 
104
106
  cop.run_for_line(line, index)
105
107
  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.5
4
+ version: 1.0.0.pre.rc.7
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/