Skip to content

Commit

Permalink
Remove frozen string literals from arb templates
Browse files Browse the repository at this point in the history
It does not have effect there and outputs a warning when running tests
with `RUBYOPTS='-w' rake`

```
warning: 'frozen_string_literal' is ignored after any tokens
```

Behavior tested in `empty.arb` template

```
# frozen_string_literal: true
hello = 'hello'
hello.concat ' world'
```

Expected: fail
Actual: pass

Close #649
  • Loading branch information
tagliala committed Jan 4, 2025
1 parent eafd5fb commit eddb9ce
Show file tree
Hide file tree
Showing 9 changed files with 1 addition and 8 deletions.
1 change: 1 addition & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,7 @@ Style/FrozenStringLiteralComment:
Enabled: true
Exclude:
- bin/console
- '**/*.arb'

Style/HashSyntax:
Enabled: true
1 change: 0 additions & 1 deletion spec/rails/templates/arbre/_partial.arb
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
# frozen_string_literal: true
para "Hello from a partial"
1 change: 0 additions & 1 deletion spec/rails/templates/arbre/_partial_with_assignment.arb
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
# frozen_string_literal: true
para "Partial: #{my_instance_var}"
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# frozen_string_literal: true
h1 "Before Partial"
render "arbre/partial_with_assignment"
h2 "After Partial"
1 change: 0 additions & 1 deletion spec/rails/templates/arbre/page_with_assignment.arb
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
# frozen_string_literal: true
h1 my_instance_var
1 change: 0 additions & 1 deletion spec/rails/templates/arbre/page_with_erb_partial.arb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# frozen_string_literal: true
h1 "Before Partial"
render "erb/partial"
h2 "After Partial"
1 change: 0 additions & 1 deletion spec/rails/templates/arbre/page_with_partial.arb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# frozen_string_literal: true
h1 "Before Partial"
render "arbre/partial"
h2 "After Partial"
1 change: 0 additions & 1 deletion spec/rails/templates/arbre/page_with_render_with_block.arb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# frozen_string_literal: true
render_in_object = Class.new do
def render_in(_, &block)
block.call
Expand Down
1 change: 0 additions & 1 deletion spec/rails/templates/arbre/simple_page.arb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# frozen_string_literal: true
html do
head do
end
Expand Down

0 comments on commit eddb9ce

Please sign in to comment.