rubomatic-html 1.0.0.pre.rc.5 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5a3f0c368ce0db9d059b6df024179dea8b61f7baf728a851ee68230f7ef340ae
4
- data.tar.gz: 76e31d7b8857bf1a4faaafb16a4179f419d1b7c40e906e3a4e4f7a064c5d44b6
3
+ metadata.gz: 659fdbeda2f4fb7d3f3e8ac4469f7f153220833d5e12e26d40b801822edd58eb
4
+ data.tar.gz: a348502a063126f2f9d77caf7442e761f891ac650c011b318138f04e0806713d
5
5
  SHA512:
6
- metadata.gz: 12e642698b9709969a7e49f0f77f5550701d52dbbf4e9f31a0f744df286370a25505886757a6cfc4d03d864fbe4c83f37dec8a9ad62af571f03831dbc2466607
7
- data.tar.gz: b4c5c365711aa8bbd9bc9bc8a190ec28ef90f4d93c4e0315ff166da076b2a1b780b8506524862b092a371c8394fc0f605306aa955db13ebf290bfdff5e43ae96
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.5'
4
+ VERSION = '1.0.0-rc.6'
5
5
  end
@@ -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.5
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/