Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix match? that were not detected by RuboCop #174

Merged
merged 1 commit into from
Dec 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

### Unreleased

* Minor performance improvements

### Version v1.21.0

* Minor performance improvements
Expand Down
4 changes: 2 additions & 2 deletions lib/css_parser/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ def parse_block_into_rule_sets!(block, options = {}) # :nodoc:
current_media_query << token << ' '
end
end
elsif in_charset or token =~ /@charset/i
elsif in_charset or /@charset/i.match?(token)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just to mention, does not seem that the second condition is covered by tests

# iterate until we are out of the charset declaration
in_charset = !token.include?(';')
elsif !in_string && token.include?('}')
Expand All @@ -467,7 +467,7 @@ def parse_block_into_rule_sets!(block, options = {}) # :nodoc:
current_selectors << token

# mark this as the beginning of the selector unless we have already marked it
rule_start = start_offset if options[:capture_offsets] && rule_start.nil? && token =~ /^[^\s]+$/
rule_start = start_offset if options[:capture_offsets] && rule_start.nil? && /^[^\s]+$/.match?(token)
end
end

Expand Down
Loading