Skip to content

Commit ad2cf7a

Browse files
committed
RuboCop: Enable Style/WordArray and Style/SymbolArray with EnforcedStyle: brackets
1 parent 4d8a46a commit ad2cf7a

File tree

5 files changed

+47
-45
lines changed

5 files changed

+47
-45
lines changed

.rubocop.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,12 @@ Style/StringLiteralsInInterpolation:
2929
EnforcedStyle: double_quotes
3030

3131
Style/WordArray:
32-
Enabled: false
32+
Enabled: true
33+
EnforcedStyle: brackets
3334

3435
Style/SymbolArray:
35-
Enabled: false
36+
Enabled: true
37+
EnforcedStyle: brackets
3638

3739
Style/BlockDelimiters:
3840
Enabled: false

Rakefile

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,17 @@ end
2222
begin
2323
require "rake/extensiontask"
2424

25-
PLATFORMS = %w[
26-
aarch64-linux-gnu
27-
aarch64-linux-musl
28-
arm-linux-gnu
29-
arm-linux-musl
30-
arm64-darwin
31-
x86_64-darwin
32-
x86_64-linux-gnu
33-
x86_64-linux-musl
34-
x86-linux-gnu
35-
x86-linux-musl
25+
PLATFORMS = [
26+
"aarch64-linux-gnu",
27+
"aarch64-linux-musl",
28+
"arm-linux-gnu",
29+
"arm-linux-musl",
30+
"arm64-darwin",
31+
"x86_64-darwin",
32+
"x86_64-linux-gnu",
33+
"x86_64-linux-musl",
34+
"x86-linux-gnu",
35+
"x86-linux-musl"
3636
].freeze
3737

3838
exttask = Rake::ExtensionTask.new do |ext|

ext/herb/extconf.rb

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -24,38 +24,38 @@
2424

2525
herb_src_files = Dir.glob("#{$srcdir}/../../src/**/*.c").map { |file| file.delete_prefix("../../../../ext/herb/") }.sort
2626

27-
prism_main_files = %w[
28-
diagnostic.c
29-
encoding.c
30-
node.c
31-
options.c
32-
pack.c
33-
prettyprint.c
34-
prism.c
35-
regexp.c
36-
serialize.c
37-
static_literals.c
38-
token_type.c
27+
prism_main_files = [
28+
"diagnostic.c",
29+
"encoding.c",
30+
"node.c",
31+
"options.c",
32+
"pack.c",
33+
"prettyprint.c",
34+
"prism.c",
35+
"regexp.c",
36+
"serialize.c",
37+
"static_literals.c",
38+
"token_type.c"
3939
]
4040

41-
prism_util_files = %w[
42-
pm_buffer.c
43-
pm_char.c
44-
pm_constant_pool.c
45-
pm_integer.c
46-
pm_list.c
47-
pm_memchr.c
48-
pm_newline_list.c
49-
pm_string.c
50-
pm_strncasecmp.c
51-
pm_strpbrk.c
41+
prism_util_files = [
42+
"pm_buffer.c",
43+
"pm_char.c",
44+
"pm_constant_pool.c",
45+
"pm_integer.c",
46+
"pm_list.c",
47+
"pm_memchr.c",
48+
"pm_newline_list.c",
49+
"pm_string.c",
50+
"pm_strncasecmp.c",
51+
"pm_strpbrk.c"
5252
]
5353

54-
core_src_files = %w[
55-
extension.c
56-
nodes.c
57-
error_helpers.c
58-
extension_helpers.c
54+
core_src_files = [
55+
"extension.c",
56+
"nodes.c",
57+
"error_helpers.c",
58+
"extension_helpers.c"
5959
]
6060

6161
$srcs = core_src_files + herb_src_files + prism_main_files + prism_util_files

lib/herb/engine/compiler.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def visit_html_element_node(node)
7171
visit_all(node.body)
7272
visit(node.close_tag)
7373

74-
pop_context if %w[script style].include?(tag_name)
74+
pop_context if ["script", "style"].include?(tag_name)
7575

7676
@element_stack.pop if tag_name
7777
end
@@ -91,7 +91,7 @@ def visit_html_conditional_element_node(node)
9191
visit_all(node.body)
9292
visit(node.close_conditional)
9393

94-
pop_context if %w[script style].include?(tag_name)
94+
pop_context if ["script", "style"].include?(tag_name)
9595

9696
@element_stack.pop if tag_name
9797
end

lib/herb/engine/validators/nesting_validator.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def validate_html_nesting(node)
3131
end
3232

3333
def validate_no_block_elements_in_paragraph(node)
34-
block_elements = %w[div section article header footer nav aside p h1 h2 h3 h4 h5 h6 ul ol dl table form]
34+
block_elements = ["div", "section", "article", "header", "footer", "nav", "aside", "p", "h1", "h2", "h3", "h4", "h5", "h6", "ul", "ol", "dl", "table", "form"]
3535

3636
node.body.each do |child|
3737
next unless child.is_a?(Herb::AST::HTMLElementNode)
@@ -58,7 +58,7 @@ def validate_no_nested_anchors(node)
5858
end
5959

6060
def validate_no_interactive_in_button(node)
61-
interactive_elements = %w[a button input select textarea]
61+
interactive_elements = ["a", "button", "input", "select", "textarea"]
6262

6363
node.body.each do |child|
6464
next unless child.is_a?(Herb::AST::HTMLElementNode)

0 commit comments

Comments
 (0)