rubomatic-html 1.0.0.pre.rc.7 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.adoc +21 -5
- data/lib/rubomatic-html/cop/base.rb +11 -6
- data/lib/rubomatic-html/cop/layout/multiple_line_breaks.rb +3 -3
- data/lib/rubomatic-html/version.rb +1 -1
- data/lib/rubomatic-html.rb +6 -4
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3b7c76016bb1d33526a70bf322a25f55569c3d93a50bf3795bd7d4ded5c99fd7
|
4
|
+
data.tar.gz: c7e5015c673fab3d8c42cbafc3b3355a660c0786d1a5775a1797d838fd2f324d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 305f5ad46e7711590c445f3b60edfa27960cfd985012b9929901c94b5137af2d1a9e70c173439420302dd29f3b72a1f3dddce3f8c8cbdbe02117bfaf6a0ed6ea
|
7
|
+
data.tar.gz: dd716790e59ac5c9fdca784ddddeb3d9231b6022862cd7ebd02887a5636a3646cf137521d7b6e509fdb58ce9e236fb605c4ff4f9bbb9f29b6f43107fb006e976
|
data/README.adoc
CHANGED
@@ -35,13 +35,29 @@ Or
|
|
35
35
|
bundle exec rubomatic-html
|
36
36
|
----
|
37
37
|
|
38
|
-
To ignore specific files, create ``.
|
38
|
+
To ignore specific files, create ``.rubomatic-html.yml``
|
39
39
|
|
40
|
-
[source,
|
40
|
+
[source,yaml]
|
41
41
|
----
|
42
|
-
|
43
|
-
|
44
|
-
|
42
|
+
AllCops:
|
43
|
+
Enabled: true
|
44
|
+
Exclude:
|
45
|
+
- app/views/layouts/partials/_dropzone_preview_template.html.erb
|
46
|
+
- app/views/shared/_global_email.html.erb
|
47
|
+
- app/views/shared/_global_email_text.text.erb
|
48
|
+
|
49
|
+
Layout/LineLength:
|
50
|
+
Enabled: true
|
51
|
+
|
52
|
+
Layout/MultipleLineBreaks:
|
53
|
+
Enabled: true
|
54
|
+
|
55
|
+
Layout/TrailingWhitespace:
|
56
|
+
Enabled: true
|
57
|
+
|
58
|
+
Style/PartialInstanceVariable:
|
59
|
+
Enabled: true
|
60
|
+
|
45
61
|
----
|
46
62
|
|
47
63
|
== Departments
|
@@ -3,6 +3,9 @@
|
|
3
3
|
module RubomaticHtml
|
4
4
|
module Cop
|
5
5
|
class Base
|
6
|
+
# @return [String]
|
7
|
+
attr_accessor :file
|
8
|
+
|
6
9
|
# Name for cop
|
7
10
|
#
|
8
11
|
# @return [String]
|
@@ -11,9 +14,6 @@ module RubomaticHtml
|
|
11
14
|
'Base'
|
12
15
|
end
|
13
16
|
|
14
|
-
# @return [String]
|
15
|
-
attr_accessor :file
|
16
|
-
|
17
17
|
# :nodoc:
|
18
18
|
def initialize(file)
|
19
19
|
@file = file
|
@@ -23,12 +23,17 @@ module RubomaticHtml
|
|
23
23
|
|
24
24
|
# Outputs filename:line_number locations of HTML files that trigger the cop
|
25
25
|
#
|
26
|
-
# @param
|
27
|
-
# @param
|
26
|
+
# @param _line [String] the line in the html
|
27
|
+
# @param _index [Integer] the 1-index of the line
|
28
28
|
#
|
29
29
|
# @return [void]
|
30
30
|
#
|
31
|
-
def run_for_line(
|
31
|
+
def run_for_line(_line, _index)
|
32
|
+
error_message = <<~TEXT
|
33
|
+
Warning: Method `run_for_line` needs overridden! Some cops may not display failing messages.
|
34
|
+
TEXT
|
35
|
+
|
36
|
+
puts("\e[33m#{error_message}\e[0m")
|
32
37
|
end
|
33
38
|
end
|
34
39
|
end
|
@@ -4,6 +4,9 @@ module RubomaticHtml
|
|
4
4
|
module Cop
|
5
5
|
module Layout
|
6
6
|
class MultipleLineBreaks < RubomaticHtml::Cop::Layout::Base
|
7
|
+
# @return [Boolean] tracks multiple consecutive line breaks
|
8
|
+
attr_accessor :prev_break
|
9
|
+
|
7
10
|
# Name for the cop
|
8
11
|
#
|
9
12
|
# @return [String]
|
@@ -12,9 +15,6 @@ module RubomaticHtml
|
|
12
15
|
[department, 'MultipleLineBreaks'].join('/')
|
13
16
|
end
|
14
17
|
|
15
|
-
# @return [Boolean] tracks multiple consecutive line breaks
|
16
|
-
attr_accessor :prev_break
|
17
|
-
|
18
18
|
# :nodoc:
|
19
19
|
def initialize(file)
|
20
20
|
super
|
data/lib/rubomatic-html.rb
CHANGED
@@ -7,15 +7,15 @@ require 'yaml'
|
|
7
7
|
|
8
8
|
module RubomaticHtml
|
9
9
|
class Runner
|
10
|
+
PROJECT_ROOT = Pathname.new(__dir__).parent.expand_path.freeze
|
11
|
+
CONFIG_DEFAULT = PROJECT_ROOT.join('config', 'default.yml').freeze
|
12
|
+
CONFIG = ::YAML.safe_load(CONFIG_DEFAULT.read).freeze
|
13
|
+
|
10
14
|
# @return [Array<String>]
|
11
15
|
attr_accessor :files_to_lint
|
12
16
|
# @return [Hash]
|
13
17
|
attr_accessor :config
|
14
18
|
|
15
|
-
PROJECT_ROOT = Pathname.new(__dir__).parent.expand_path.freeze
|
16
|
-
CONFIG_DEFAULT = PROJECT_ROOT.join('config', 'default.yml').freeze
|
17
|
-
CONFIG = ::YAML.safe_load(CONFIG_DEFAULT.read).freeze
|
18
|
-
|
19
19
|
# @param linted_files [Array<String>]
|
20
20
|
#
|
21
21
|
def initialize(linted_files)
|
@@ -39,6 +39,7 @@ module RubomaticHtml
|
|
39
39
|
if custom_config.fetch(cop, {}).has_key?('Enabled')
|
40
40
|
config[cop][:enabled] = custom_config[cop]['Enabled']
|
41
41
|
end
|
42
|
+
|
42
43
|
if custom_config.fetch(cop, {}).has_key?('Exclude')
|
43
44
|
config[cop][:exclude] = Array(custom_config[cop]['Exclude'])
|
44
45
|
end
|
@@ -53,6 +54,7 @@ module RubomaticHtml
|
|
53
54
|
#
|
54
55
|
def run
|
55
56
|
all_config = config.fetch('AllCops')
|
57
|
+
|
56
58
|
files_to_lint.each do |file|
|
57
59
|
next if all_config.fetch(:exclude).any? { |ignored| file.end_with?(ignored) }
|
58
60
|
|
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
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brands Insurance
|
@@ -72,9 +72,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
72
72
|
version: 3.0.1
|
73
73
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
74
74
|
requirements:
|
75
|
-
- - "
|
75
|
+
- - ">="
|
76
76
|
- !ruby/object:Gem::Version
|
77
|
-
version:
|
77
|
+
version: '0'
|
78
78
|
requirements: []
|
79
79
|
rubygems_version: 3.2.15
|
80
80
|
signing_key:
|