You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fixesrubocop#5490.
## Feature
This cop checks coding magic comment should be first line,
or next of shebang.
### Bad case
```ruby
# frozen_string_literal: true
# coding: ascii
```
### Good case
```ruby
# coding: ascii
# frozen_string_literal: true
```
This cop checks only the order of magic comments. This cop will not do
what other cops have confirmed. (e.g. Such as checking whether Ruby
version supports frozen string literal, etc.)
Also, this cop doesn't check whether shebang is at beginning of file.
if shebang is not at beginning of file, executable script will not
work as intended. IMO, to check if shebang is at beginning of file,
it may be better to make a cop for that.
Fixes#5490.
## Feature
This cop checks coding magic comment should be first line,
or next of shebang.
### Bad case
```ruby
# frozen_string_literal: true
# coding: ascii
```
### Good case
```ruby
# coding: ascii
# frozen_string_literal: true
```
This cop checks only the order of magic comments. This cop will not do
what other cops have confirmed. (e.g. Such as checking whether Ruby
version supports frozen string literal, etc.)
Also, this cop doesn't check whether shebang is at beginning of file.
if shebang is not at beginning of file, executable script will not
work as intended. IMO, to check if shebang is at beginning of file,
it may be better to make a cop for that.
coding pragma should be first line, or next of shebang.
example: https://github.com/plataformatec/devise/pull/4753/files
The text was updated successfully, but these errors were encountered: