rubomatic-html 1.1.0.pre.rc.4 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.adoc +25 -1
  3. data/config/default.yml +28 -0
  4. data/docs/cops/style/README.adoc +9 -0
  5. data/docs/cops/style/no_fields_for/README.adoc +28 -0
  6. data/docs/cops/style/no_form_for/README.adoc +28 -0
  7. data/docs/cops/style/no_form_tag/README.adoc +28 -0
  8. data/docs/cops/style/no_on_before_unload/README.adoc +29 -0
  9. data/docs/cops/style/no_on_click/README.adoc +29 -0
  10. data/docs/cops/style/no_on_drag/README.adoc +29 -0
  11. data/docs/cops/style/no_on_load/README.adoc +29 -0
  12. data/docs/cops/style/no_on_unload/README.adoc +29 -0
  13. data/docs/cops/style/no_on_wheel/README.adoc +29 -0
  14. data/exe/rubomatic-html +1 -1
  15. data/lib/rubomatic-html/cop/base.rb +58 -0
  16. data/lib/rubomatic-html/cop/cops.rb +19 -0
  17. data/lib/rubomatic-html/cop/layout/base.rb +17 -0
  18. data/lib/rubomatic-html/cop/layout/line_length.rb +28 -0
  19. data/lib/rubomatic-html/cop/layout/multiple_line_breaks.rb +42 -0
  20. data/lib/rubomatic-html/cop/layout/trailing_whitespace.rb +28 -0
  21. data/lib/rubomatic-html/cop/style/base.rb +17 -0
  22. data/lib/rubomatic-html/cop/style/no_fields_for.rb +28 -0
  23. data/lib/rubomatic-html/cop/style/no_form_for.rb +28 -0
  24. data/lib/rubomatic-html/cop/style/no_form_tag.rb +28 -0
  25. data/lib/rubomatic-html/cop/style/no_on_attribute.rb +31 -0
  26. data/lib/rubomatic-html/cop/style/no_on_before_unload.rb +27 -0
  27. data/lib/rubomatic-html/cop/style/no_on_click.rb +27 -0
  28. data/lib/rubomatic-html/cop/style/no_on_drag.rb +27 -0
  29. data/lib/rubomatic-html/cop/style/no_on_load.rb +27 -0
  30. data/lib/rubomatic-html/cop/style/no_on_unload.rb +27 -0
  31. data/lib/rubomatic-html/cop/style/no_on_wheel.rb +27 -0
  32. data/lib/rubomatic-html/cop/style/partial_instance_variable.rb +44 -0
  33. data/lib/rubomatic-html/generator/cop_readme_injector.rb +48 -0
  34. data/lib/rubomatic-html/generator/dept_readme_injector.rb +111 -0
  35. data/lib/rubomatic-html/generator.rb +330 -0
  36. data/lib/rubomatic-html/inject.rb +19 -0
  37. data/lib/rubomatic-html/runner.rb +129 -0
  38. data/lib/rubomatic-html/version.rb +5 -0
  39. data/lib/rubomatic-html.rb +11 -1
  40. metadata +49 -20
  41. data/lib/rubomatic/html/cop/base.rb +0 -42
  42. data/lib/rubomatic/html/cop/cops.rb +0 -9
  43. data/lib/rubomatic/html/cop/layout/base.rb +0 -19
  44. data/lib/rubomatic/html/cop/layout/line_length.rb +0 -26
  45. data/lib/rubomatic/html/cop/layout/multiple_line_breaks.rb +0 -40
  46. data/lib/rubomatic/html/cop/layout/trailing_whitespace.rb +0 -26
  47. data/lib/rubomatic/html/cop/style/base.rb +0 -19
  48. data/lib/rubomatic/html/cop/style/partial_instance_variable.rb +0 -28
  49. data/lib/rubomatic/html/version.rb +0 -7
  50. data/lib/rubomatic/html.rb +0 -115
@@ -0,0 +1,330 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'generator/dept_readme_injector'
4
+ # require_relative 'generator/require_file_injector'
5
+
6
+ require_relative 'generator/cop_readme_injector'
7
+
8
+ module RubomaticHtml
9
+ class Generator
10
+ COP_DOC = <<~RUBY
11
+ # TODO: Write cop description and example of bad / good code. For every
12
+ # `SupportedStyle` and unique configuration, there needs to be examples.
13
+ # Examples must have valid Ruby syntax. Do not use upticks.
14
+ #
15
+ # @safety
16
+ # Delete this section if the cop is not unsafe (`Safe: false` or
17
+ # `SafeAutoCorrect: false`), or use it to explain how the cop is
18
+ # unsafe.
19
+ #
20
+ # @example EnforcedStyle: bar (default)
21
+ # # Description of the `bar` style.
22
+ #
23
+ # # bad
24
+ # bad_bar_method
25
+ #
26
+ # # bad
27
+ # bad_bar_method(args)
28
+ #
29
+ # # good
30
+ # good_bar_method
31
+ #
32
+ # # good
33
+ # good_bar_method(args)
34
+ #
35
+ # @example EnforcedStyle: foo
36
+ # # Description of the `foo` style.
37
+ #
38
+ # # bad
39
+ # bad_foo_method
40
+ #
41
+ # # bad
42
+ # bad_foo_method(args)
43
+ #
44
+ # # good
45
+ # good_foo_method
46
+ #
47
+ # # good
48
+ # good_foo_method(args)
49
+ #
50
+ RUBY
51
+ SOURCE_TEMPLATE = <<~RUBY
52
+ # frozen_string_literal: true
53
+
54
+ module RubomaticHtml
55
+ module Cop
56
+ module %{department}
57
+ class %{cop_name} < RubomaticHtml::Cop::%{department}::Base
58
+ class << self
59
+ # @see super
60
+ def abstract_cop?
61
+ false
62
+ end
63
+
64
+ # @see super
65
+ def name
66
+ [department, '%{cop_name}'].join('/')
67
+ end
68
+ end
69
+
70
+ # @see super
71
+ def run_for_line(line, index)
72
+ # TODO: Implement the cop in here.
73
+ end
74
+ end
75
+ end
76
+ end
77
+ end
78
+ RUBY
79
+ SPEC_TEMPLATE = <<~SPEC
80
+ # frozen_string_literal: true
81
+
82
+ RSpec.describe RubomaticHtml::Cop::%{department}::%{cop_name}, :config do
83
+ let(:config) { RubomaticHtml::Config.new }
84
+
85
+ # TODO: Write test code
86
+ #
87
+ # For example
88
+ it 'registers an offense when using `#bad_method`' do
89
+ expect_offense(<<~RHTML)
90
+ bad_method
91
+ ^^^^^^^^^^ Use `#good_method` instead of `#bad_method`.
92
+ RHTML
93
+ end
94
+
95
+ it 'does not register an offense when using `#good_method`' do
96
+ expect_no_offenses(<<~RHTML)
97
+ good_method
98
+ RHTML
99
+ end
100
+ end
101
+ SPEC
102
+ README_ADDED_MESSAGE = '[modify] A link for the %{dept_vs_cop} has been added into %{readme_file_path}.'
103
+
104
+ DEPT_README_TEMPLATE = <<~ADOC
105
+ = %{department}
106
+
107
+ Describe the department here
108
+
109
+ == Cops
110
+
111
+ ADOC
112
+ COP_README_TEMPLATE = <<~ADOC
113
+ = ``%{department}/%{cop_name}``
114
+
115
+ == Description
116
+
117
+ Add a description here
118
+
119
+ == Examples
120
+
121
+ [source,rhtml]
122
+ ----
123
+ <!-- Bad -->
124
+ <!-- Add a bad example here -->
125
+
126
+ <!-- Good -->
127
+ <!-- Add a good example here -->
128
+ ----
129
+
130
+ == Configurable Attributes
131
+
132
+ |===
133
+ |Name |Default value |Configurable values
134
+
135
+ |Max
136
+ |120
137
+ |Integer
138
+
139
+ |===
140
+
141
+ == References
142
+
143
+ https://github.com/BrandsInsurance/expert-chainsaw/issues
144
+ ADOC
145
+
146
+ # :nodoc:
147
+ def initialize(name, output: $stdout)
148
+ @base_gen = RuboCop::Cop::Generator.new(name, output: output)
149
+ end
150
+
151
+ # @see RuboCop::Cop::generator method
152
+ def write_source
153
+ write_unless_file_exists(source_path, generated_source)
154
+ end
155
+
156
+ # @see RuboCop::Cop::generator method
157
+ def write_spec
158
+ write_unless_file_exists(spec_path, generated_spec)
159
+ end
160
+
161
+ # @see RuboCop::Cop::generator method
162
+ def generated_source
163
+ generate(SOURCE_TEMPLATE)
164
+ end
165
+
166
+ # @see RuboCop::Cop::generator method
167
+ def generated_spec
168
+ generate(SPEC_TEMPLATE)
169
+ end
170
+
171
+ # @see RuboCop::Cop::generator method
172
+ def source_path
173
+ File.join(
174
+ 'lib',
175
+ 'rubomatic-html',
176
+ 'cop',
177
+ snake_case(badge.department.to_s),
178
+ "#{snake_case(badge.cop_name.to_s)}.rb"
179
+ )
180
+ end
181
+
182
+ # @see RuboCop::Cop::generator method
183
+ def spec_path
184
+ File.join(
185
+ 'spec',
186
+ 'rubomatic-html',
187
+ 'cop',
188
+ snake_case(badge.department.to_s),
189
+ "#{snake_case(badge.cop_name.to_s)}_spec.rb"
190
+ )
191
+ end
192
+
193
+ # @see RuboCop::Cop::generator method
194
+ def inject_require(root_file_path:)
195
+ RuboCop::Cop::Generator::RequireFileInjector.new(source_path: source_path, root_file_path: root_file_path).inject
196
+ end
197
+
198
+ # Calls methods in the base class
199
+ #
200
+ # @return [*]
201
+ #
202
+ def method_missing(...)
203
+ @base_gen.__send__(...)
204
+ end
205
+
206
+ # `self` responds to `method_name` if `@base_gen` does
207
+ #
208
+ def respond_to_missing?(method_name, include_private = false)
209
+ @base_gen.respond_to?(method_name, include_private)
210
+ end
211
+
212
+ # Creates the department readme if it doesn't exist
213
+ # Modified version of `wirte_source` from RuboCop::Cop::Generator
214
+ #
215
+ # @return [void]
216
+ #
217
+ def write_dept_readme
218
+ return if File.exist?(dept_docs_path)
219
+
220
+ write_unless_file_exists(dept_docs_path, generated_dept_docs)
221
+ end
222
+
223
+ # Creates the cop readme if it doesn't exist
224
+ # Modified version of `wirte_source` from RuboCop::Cop::Generator
225
+ #
226
+ # @return [void]
227
+ #
228
+ def write_cop_readme
229
+ write_unless_file_exists(docs_path, generated_cop_docs)
230
+ end
231
+
232
+ # Injects the, possibly new, department readme link into the base readme
233
+ # Modified version of `inject_config` from RuboCop::Cop::Generator
234
+ #
235
+ # @return [void]
236
+ #
237
+ def inject_dept_readme(readme_file_path: 'README.adoc')
238
+ # Add this dept to base readme if not already there
239
+ injector = DeptReadmeInjector.new(
240
+ readme_file_path: readme_file_path,
241
+ badge: badge,
242
+ department: department
243
+ )
244
+
245
+ injector.inject_string do
246
+ output.puts(format(README_ADDED_MESSAGE, readme_file_path: readme_file_path, dept_vs_cop: 'department'))
247
+ end
248
+ end
249
+
250
+ # Injects the new cop readme link into the department readme
251
+ # Modified version of `inject_config` from RuboCop::Cop::Generator
252
+ #
253
+ # @return [void]
254
+ #
255
+ def inject_cop_readme(readme_file_path: dept_docs_path)
256
+ # Add this cop to the dept readme
257
+ injector = CopReadmeInjector.new(
258
+ readme_file_path: readme_file_path,
259
+ badge: badge,
260
+ department: department
261
+ )
262
+
263
+ injector.inject_string do
264
+ output.puts(format(README_ADDED_MESSAGE, readme_file_path: readme_file_path, dept_vs_cop: 'cop'))
265
+ end
266
+ end
267
+
268
+ private
269
+
270
+ # @return [String]
271
+ def department
272
+ badge.department_name
273
+ end
274
+
275
+ # Modified version of `generated_source` from Rubocop::Cop::Generator
276
+ #
277
+ # @return [String]
278
+ #
279
+ def generated_dept_docs
280
+ generate_readme(DEPT_README_TEMPLATE)
281
+ end
282
+
283
+ # Modified version of `generated_source` from Rubocop::Cop::Generator
284
+ #
285
+ # @return [String]
286
+ #
287
+ def generated_cop_docs
288
+ generate_readme(COP_README_TEMPLATE)
289
+ end
290
+
291
+ # Modified version from Rubocop::Cop::Generator
292
+ #
293
+ # @return [String]
294
+ #
295
+ def generate_readme(template)
296
+ format(template, {
297
+ department: department,
298
+ cop_name: badge.cop_name,
299
+ cop_folder: snake_case(badge.cop_name.to_s)
300
+ })
301
+ end
302
+
303
+ # Path to <department>/README.adoc
304
+ #
305
+ # @return [String]
306
+ #
307
+ def dept_docs_path
308
+ File.join(
309
+ 'docs',
310
+ 'cops',
311
+ snake_case(department),
312
+ 'README.adoc'
313
+ )
314
+ end
315
+
316
+ # Path to <department>/<cop>/README.adoc
317
+ #
318
+ # @return [String]
319
+ #
320
+ def docs_path
321
+ File.join(
322
+ 'docs',
323
+ 'cops',
324
+ snake_case(department),
325
+ snake_case(badge.cop_name.to_s),
326
+ 'README.adoc'
327
+ )
328
+ end
329
+ end
330
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RubomaticHtml
4
+ module Inject
5
+ # This was a generated method from https://github.com/rubocop/rubocop-extension-generator
6
+ #
7
+ def self.defaults!
8
+ path = CONFIG_DEFAULT.to_s
9
+ hash = ConfigLoader.__send__(:load_yaml_configuration, path)
10
+ config = Config.new(hash, path).tap(&:make_excludes_absolute)
11
+
12
+ puts("configuration from #{path}") if ConfigLoader.debug?
13
+
14
+ config = ConfigLoader.merge_with_default(config, path)
15
+
16
+ ConfigLoader.instance_variable_set(:@default_configuration, config)
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,129 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rubocop'
4
+ require 'yaml'
5
+
6
+ module RubomaticHtml
7
+ PROJECT_ROOT = Pathname.new(__dir__).parent.parent.expand_path.freeze
8
+ CONFIG_DEFAULT = PROJECT_ROOT.join('config', 'default.yml').freeze
9
+ CONFIG = ::YAML.safe_load(CONFIG_DEFAULT.read).freeze
10
+
11
+ private_constant(:CONFIG_DEFAULT, :PROJECT_ROOT)
12
+
13
+ class Config < RuboCop::Config
14
+ end
15
+
16
+ class ConfigLoader < RuboCop::ConfigLoader
17
+ end
18
+
19
+ class Error < StandardError
20
+ end
21
+
22
+ class Runner
23
+ # @return [Array<String>]
24
+ attr_accessor :files_to_lint
25
+ # @return [Hash]
26
+ attr_accessor :config
27
+
28
+ # @param linted_files [Array<String>]
29
+ #
30
+ def initialize(linted_files)
31
+ files_to_lint = Array(linted_files)
32
+
33
+ if files_to_lint.empty?
34
+ files_to_lint = Dir[File.join('app', 'views', '**', '*')]
35
+ end
36
+
37
+ @files_to_lint = files_to_lint
38
+
39
+ custom_config = ::YAML.safe_load(Pathname.new('.rubomatic-html.yml').read).freeze
40
+ config = {}
41
+ base_transformations = { 'Enabled' => :enabled, 'Exclude' => :exclude }
42
+
43
+ CONFIG.each do |cop_name, cop_config|
44
+ the_cop = all_cops.find { |cop| cop.name == cop_name }
45
+ transformations = base_transformations.merge(the_cop&.allowed_config_transform || {})
46
+ config[cop_name] = {}
47
+
48
+ transformations.each do |allowed_node, ruby_node|
49
+ config[cop_name][ruby_node] = cop_config[allowed_node] if cop_config.has_key?(allowed_node)
50
+
51
+ next unless custom_config.fetch(cop_name, {}).has_key?(allowed_node)
52
+
53
+ config[cop_name][ruby_node] = custom_config.dig(cop_name, allowed_node)
54
+ end
55
+
56
+ config[cop_name][:exclude] = Array(config[cop_name][:exclude])
57
+ end
58
+
59
+ @config = config
60
+ end
61
+
62
+ # Runs all cops against all files
63
+ #
64
+ # @return [void]
65
+ #
66
+ def run
67
+ all_config = config.fetch('AllCops')
68
+
69
+ files_to_lint.each do |file|
70
+ next if all_config.fetch(:exclude).any? { |ignored| file.end_with?(ignored) }
71
+
72
+ ext = File.extname(file)
73
+
74
+ next if ext.match?(/haml/i)
75
+
76
+ check_it = ext.match?(/html/i)
77
+ check_it ||= ext.match?(/erb\z/i)
78
+
79
+ next unless check_it
80
+
81
+ run_file(file)
82
+ end
83
+ end
84
+
85
+ private
86
+
87
+ # List of all cops available
88
+ #
89
+ # @return [Array<*>]
90
+ #
91
+ def all_cops
92
+ @all_cops ||= RubomaticHtml::Cop.constants.flat_map do |mod_name|
93
+ RubomaticHtml::Cop.const_get(mod_name).constants.filter_map do |klass_name|
94
+ klass = RubomaticHtml::Cop.const_get(mod_name).const_get(klass_name)
95
+
96
+ next if klass.abstract_cop?
97
+
98
+ klass
99
+ end
100
+ end
101
+ end
102
+
103
+ # Runs all cops against a given file
104
+ #
105
+ # @param file [String]
106
+ #
107
+ # @return [void]
108
+ #
109
+ def run_file(file)
110
+ cops = all_cops.filter_map do |cop|
111
+ cop_config = config.fetch(cop.name, {})
112
+
113
+ next unless cop_config.dig(:enabled)
114
+
115
+ cop.new(file, cop_config)
116
+ end
117
+
118
+ return if cops.empty?
119
+
120
+ File.open(file).each_line(chomp: true).with_index(1) do |line, index|
121
+ cops.each do |cop|
122
+ next if config.dig(cop.class.name).fetch(:exclude, []).any? { |ignored| file.end_with?(ignored) }
123
+
124
+ cop.run_for_line(line, index)
125
+ end
126
+ end
127
+ end
128
+ end
129
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RubomaticHtml
4
+ VERSION = '1.1.0'
5
+ end
@@ -1,3 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'rubomatic/html'
3
+ require 'pathname'
4
+
5
+ require_relative 'rubomatic-html/generator'
6
+ require_relative 'rubomatic-html/runner'
7
+ require_relative 'rubomatic-html/version'
8
+
9
+ require_relative 'rubomatic-html/inject'
10
+
11
+ RubomaticHtml::Inject.defaults!
12
+
13
+ require_relative 'rubomatic-html/cop/cops'
metadata CHANGED
@@ -1,29 +1,35 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubomatic-html
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0.pre.rc.4
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brands Insurance
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-06-05 00:00:00.000000000 Z
11
+ date: 2023-08-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: rubomatic
14
+ name: rubocop-rubomatic
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 2.2.0
20
- type: :development
19
+ version: 1.0.0
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '2.0'
23
+ type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - "~>"
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: 1.0.0
30
+ - - "<"
25
31
  - !ruby/object:Gem::Version
26
- version: 2.2.0
32
+ version: '2.0'
27
33
  description:
28
34
  email:
29
35
  - documents@brandsinsurance.com
@@ -41,19 +47,42 @@ files:
41
47
  - docs/cops/layout/multiple_line_breaks/README.adoc
42
48
  - docs/cops/layout/trailing_whitespace/README.adoc
43
49
  - docs/cops/style/README.adoc
50
+ - docs/cops/style/no_fields_for/README.adoc
51
+ - docs/cops/style/no_form_for/README.adoc
52
+ - docs/cops/style/no_form_tag/README.adoc
53
+ - docs/cops/style/no_on_before_unload/README.adoc
54
+ - docs/cops/style/no_on_click/README.adoc
55
+ - docs/cops/style/no_on_drag/README.adoc
56
+ - docs/cops/style/no_on_load/README.adoc
57
+ - docs/cops/style/no_on_unload/README.adoc
58
+ - docs/cops/style/no_on_wheel/README.adoc
44
59
  - docs/cops/style/partial_instance_variable/README.adoc
45
60
  - exe/rubomatic-html
46
61
  - lib/rubomatic-html.rb
47
- - lib/rubomatic/html.rb
48
- - lib/rubomatic/html/cop/base.rb
49
- - lib/rubomatic/html/cop/cops.rb
50
- - lib/rubomatic/html/cop/layout/base.rb
51
- - lib/rubomatic/html/cop/layout/line_length.rb
52
- - lib/rubomatic/html/cop/layout/multiple_line_breaks.rb
53
- - lib/rubomatic/html/cop/layout/trailing_whitespace.rb
54
- - lib/rubomatic/html/cop/style/base.rb
55
- - lib/rubomatic/html/cop/style/partial_instance_variable.rb
56
- - lib/rubomatic/html/version.rb
62
+ - lib/rubomatic-html/cop/base.rb
63
+ - lib/rubomatic-html/cop/cops.rb
64
+ - lib/rubomatic-html/cop/layout/base.rb
65
+ - lib/rubomatic-html/cop/layout/line_length.rb
66
+ - lib/rubomatic-html/cop/layout/multiple_line_breaks.rb
67
+ - lib/rubomatic-html/cop/layout/trailing_whitespace.rb
68
+ - lib/rubomatic-html/cop/style/base.rb
69
+ - lib/rubomatic-html/cop/style/no_fields_for.rb
70
+ - lib/rubomatic-html/cop/style/no_form_for.rb
71
+ - lib/rubomatic-html/cop/style/no_form_tag.rb
72
+ - lib/rubomatic-html/cop/style/no_on_attribute.rb
73
+ - lib/rubomatic-html/cop/style/no_on_before_unload.rb
74
+ - lib/rubomatic-html/cop/style/no_on_click.rb
75
+ - lib/rubomatic-html/cop/style/no_on_drag.rb
76
+ - lib/rubomatic-html/cop/style/no_on_load.rb
77
+ - lib/rubomatic-html/cop/style/no_on_unload.rb
78
+ - lib/rubomatic-html/cop/style/no_on_wheel.rb
79
+ - lib/rubomatic-html/cop/style/partial_instance_variable.rb
80
+ - lib/rubomatic-html/generator.rb
81
+ - lib/rubomatic-html/generator/cop_readme_injector.rb
82
+ - lib/rubomatic-html/generator/dept_readme_injector.rb
83
+ - lib/rubomatic-html/inject.rb
84
+ - lib/rubomatic-html/runner.rb
85
+ - lib/rubomatic-html/version.rb
57
86
  homepage: https://github.com/BrandsInsurance/expert-chainsaw/
58
87
  licenses:
59
88
  - MIT
@@ -73,9 +102,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
73
102
  version: 3.0.1
74
103
  required_rubygems_version: !ruby/object:Gem::Requirement
75
104
  requirements:
76
- - - ">"
105
+ - - ">="
77
106
  - !ruby/object:Gem::Version
78
- version: 1.3.1
107
+ version: '0'
79
108
  requirements: []
80
109
  rubygems_version: 3.2.15
81
110
  signing_key:
@@ -1,42 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Rubomatic
4
- module Html
5
- module Cop
6
- class Base
7
- # @return [String]
8
- attr_accessor :file
9
-
10
- # Name for cop
11
- #
12
- # @return [String]
13
- #
14
- def self.name
15
- 'Base'
16
- end
17
-
18
- # :nodoc:
19
- def initialize(file)
20
- @file = file
21
- end
22
-
23
- private
24
-
25
- # Outputs filename:line_number locations of HTML files that trigger the cop
26
- #
27
- # @param _line [String] the line in the html
28
- # @param _index [Integer] the 1-index of the line
29
- #
30
- # @return [void]
31
- #
32
- def run_for_line(_line, _index)
33
- error_message = <<~TEXT
34
- Warning: Method `run_for_line` needs overridden! Some cops may not display failing messages.
35
- TEXT
36
-
37
- puts("\e[33m#{error_message}\e[0m")
38
- end
39
- end
40
- end
41
- end
42
- end
@@ -1,9 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative 'base'
4
- require_relative 'layout/base'
5
- require_relative 'layout/line_length'
6
- require_relative 'layout/multiple_line_breaks'
7
- require_relative 'layout/trailing_whitespace'
8
- require_relative 'style/base'
9
- require_relative 'style/partial_instance_variable'
@@ -1,19 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Rubomatic
4
- module Html
5
- module Cop
6
- module Layout
7
- class Base < Rubomatic::Html::Cop::Base
8
- # Department for cop
9
- #
10
- # @return [String]
11
- #
12
- def self.department
13
- 'Layout'
14
- end
15
- end
16
- end
17
- end
18
- end
19
- end