Fix AtRuleParser to correctly parse at-rule names without trailing braces #127
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
The
AtRuleParser.getAtRuleName()
method incorrectly included trailing{
characters in at-rule names when there was no space before the opening brace. This caused validation errors for valid CSS at-rules.Before:
After:
Solution
Updated the
getAtRuleName()
method to remove trailing{
characters using the existingremoveEndingString()
utility method. This ensures consistent parsing regardless of spacing before the opening brace.Changes:
src/CssLint/Tokenizer/Parser/AtRuleParser.php
to strip trailing{
from at-rule namesTesting
@font-face
rules@font-face
properties (font-display
,src
,unicode-range
) are correctly defined in referentialImpact
This fix resolves validation errors for properly formatted CSS at-rules, particularly
@font-face
declarations, improving the linter's accuracy and reducing false positives.Warning
Firewall rules blocked me from connecting to one or more addresses
I tried to connect to the following addresses, but was blocked by firewall rules:
https://api.github.com/repos/Masterminds/html5-php/zipball/f5ac2c0b0a2eefca70b2ce32a5809992227e75a6
/usr/bin/php8.3 -n -c /tmp/jokzpz /usr/bin/composer install --no-progress --ignore-platform-req=ext-pcov --no-interaction
(http block)https://api.github.com/repos/bovigo/vfsStream/zipball/fe695ec993e0a55c3abdda10a9364eb31c6f1bf0
/usr/bin/php8.3 -n -c /tmp/jokzpz /usr/bin/composer install --no-progress --ignore-platform-req=ext-pcov --no-interaction
(http block)https://api.github.com/repos/guzzle/guzzle/zipball/7b2f29fe81dc4da0ca0ea7d42107a0845946ea77
/usr/bin/php8.3 -n -c /tmp/jokzpz /usr/bin/composer install --no-progress --ignore-platform-req=ext-pcov --no-interaction
(http block)https://api.github.com/repos/guzzle/promises/zipball/7c69f28996b0a6920945dd20b3857e499d9ca96c
/usr/bin/php8.3 -n -c /tmp/jokzpz /usr/bin/composer install --no-progress --ignore-platform-req=ext-pcov --no-interaction
(http block)https://api.github.com/repos/guzzle/psr7/zipball/c2270caaabe631b3b44c85f99e5a04bbb8060d16
/usr/bin/php8.3 -n -c /tmp/jokzpz /usr/bin/composer install --no-progress --ignore-platform-req=ext-pcov --no-interaction
(http block)https://api.github.com/repos/krakjoe/pcov-clobber/zipball/4c30759e912e6e5d5bf833fb3d77b5bd51709f05
/usr/bin/php8.3 -n -c /tmp/jokzpz /usr/bin/composer install --no-progress --ignore-platform-req=ext-pcov --no-interaction
(http block)https://api.github.com/repos/nikic/PHP-Parser/zipball/715f4d25e225bc47b293a8b997fe6ce99bf987d2
/usr/bin/php8.3 -n -c /tmp/jokzpz /usr/bin/composer install --no-progress --ignore-platform-req=ext-pcov --no-interaction
(http block)https://api.github.com/repos/php-fig/http-client/zipball/bb5906edc1c324c9a05aa0873d40117941e5fa90
/usr/bin/php8.3 -n -c /tmp/jokzpz /usr/bin/composer install --no-progress --ignore-platform-req=ext-pcov --no-interaction
(http block)https://api.github.com/repos/php-fig/http-factory/zipball/2b4765fddfe3b508ac62f829e852b1501d3f6e8a
/usr/bin/php8.3 -n -c /tmp/SlkxPN /usr/bin/composer install --no-progress --ignore-platform-req=ext-pcov
(http block)/usr/bin/php8.3 -n -c /tmp/jokzpz /usr/bin/composer install --no-progress --ignore-platform-req=ext-pcov --no-interaction
(http block)https://api.github.com/repos/php-fig/http-message/zipball/402d35bcb92c70c026d1a6a9883f06b2ead23d71
/usr/bin/php8.3 -n -c /tmp/jokzpz /usr/bin/composer install --no-progress --ignore-platform-req=ext-pcov --no-interaction
(http block)https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822
/usr/bin/php8.3 -n -c /tmp/SlkxPN /usr/bin/composer install --no-progress --ignore-platform-req=ext-pcov
(http block)/usr/bin/php8.3 -n -c /tmp/jokzpz /usr/bin/composer install --no-progress --ignore-platform-req=ext-pcov --no-interaction
(http block)https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/5c9eeac41b290a3712d88851518825ad78f45c71
/usr/bin/php8.3 -n -c /tmp/jokzpz /usr/bin/composer install --no-progress --ignore-platform-req=ext-pcov --no-interaction
(http block)https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/b4f479ebdbf63ac605d183ece17d8d7fe49c15c7
/usr/bin/php8.3 -n -c /tmp/jokzpz /usr/bin/composer install --no-progress --ignore-platform-req=ext-pcov --no-interaction
(http block)https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1
/usr/bin/php8.3 -n -c /tmp/jokzpz /usr/bin/composer install --no-progress --ignore-platform-req=ext-pcov --no-interaction
(http block)https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/05d5692a7993ecccd56a03e40cd7e5b09b1d404e
/usr/bin/php8.3 -n -c /tmp/jokzpz /usr/bin/composer install --no-progress --ignore-platform-req=ext-pcov --no-interaction
(http block)https://api.github.com/repos/sebastianbergmann/type/zipball/75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7
/usr/bin/php8.3 -n -c /tmp/jokzpz /usr/bin/composer install --no-progress --ignore-platform-req=ext-pcov --no-interaction
(http block)https://api.github.com/repos/sebastianbergmann/version/zipball/c6c1022351a901512170118436c764e473f6de8c
/usr/bin/php8.3 -n -c /tmp/jokzpz /usr/bin/composer install --no-progress --ignore-platform-req=ext-pcov --no-interaction
(http block)https://api.github.com/repos/symfony/console/zipball/7d29659bc3c9d8e9a34e2c3414ef9e9e003e6cf3
/usr/bin/php8.3 -n -c /tmp/jokzpz /usr/bin/composer install --no-progress --ignore-platform-req=ext-pcov --no-interaction
(http block)https://api.github.com/repos/symfony/css-selector/zipball/cb23e97813c5837a041b73a6d63a9ddff0778f5e
/usr/bin/php8.3 -n -c /tmp/jokzpz /usr/bin/composer install --no-progress --ignore-platform-req=ext-pcov --no-interaction
(http block)https://api.github.com/repos/symfony/deprecation-contracts/zipball/63afe740e99a13ba87ec199bb07bbdee937a5b62
/usr/bin/php8.3 -n -c /tmp/jokzpz /usr/bin/composer install --no-progress --ignore-platform-req=ext-pcov --no-interaction
(http block)https://api.github.com/repos/symfony/dom-crawler/zipball/19073e3e0bb50cbc1cb286077069b3107085206f
/usr/bin/php8.3 -n -c /tmp/jokzpz /usr/bin/composer install --no-progress --ignore-platform-req=ext-pcov --no-interaction
(http block)https://api.github.com/repos/symfony/polyfill-ctype/zipball/a3cc8b044a6ea513310cbd48ef7333b384945638
/usr/bin/php8.3 -n -c /tmp/jokzpz /usr/bin/composer install --no-progress --ignore-platform-req=ext-pcov --no-interaction
(http block)https://api.github.com/repos/symfony/string/zipball/f3570b8c61ca887a9e2938e85cb6458515d2b125
/usr/bin/php8.3 -n -c /tmp/jokzpz /usr/bin/composer install --no-progress --ignore-platform-req=ext-pcov --no-interaction
(http block)www.w3.org
php scripts/css-referential-scraper
(dns block)If you need me to access, download, or install something from one of these locations, you can either:
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.