PHP_CodeSniffer
PHP_CodeSniffer copied to clipboard
Squiz.CSS.SemicolonSpacing.NotAtEnd false positive on classes with numbers
Describe the bug
ERROR | Style definitions must end with a semicolon (Squiz.CSS.SemicolonSpacing.NotAtEnd)
This is caused by any class containing a number
--bs-gray-100
or --bs-border-radius-2xl
Code sample
:root,
[data-bs-theme=dark] {
--bs-gray-100: #F8F9FA;
--bs-gray-200: #E9ECEF;
--bs-gray-300: #DEE2E6;
--bs-gray-400: #CED4DA;
--bs-gray-500: #ADB5BD;
--bs-gray-600: #6C757D;
--bs-gray-700: #495057;
--bs-gray-800: #343A40;
--bs-gray-900: #212529;
--bs-border-radius-xxl: 2rem;
--bs-border-radius-2xl: var(--bs-border-radius-xxl);
}
Custom ruleset
<?xml version="1.0"?>
<ruleset name="Testing Bug">
<rule ref="Squiz">
</ruleset>
To reproduce
Steps to reproduce the behavior:
- Create a css file called
test.css
with the code sample above... - Run
phpcs test.css ...
- See error message displayed
3 | ERROR | Style definitions must end with a semicolon (Squiz.CSS.SemicolonSpacing.NotAtEnd)
4 | ERROR | Style definitions must end with a semicolon (Squiz.CSS.SemicolonSpacing.NotAtEnd)
5 | ERROR | Style definitions must end with a semicolon (Squiz.CSS.SemicolonSpacing.NotAtEnd)
6 | ERROR | Style definitions must end with a semicolon (Squiz.CSS.SemicolonSpacing.NotAtEnd)
7 | ERROR | Style definitions must end with a semicolon (Squiz.CSS.SemicolonSpacing.NotAtEnd)
8 | ERROR | Style definitions must end with a semicolon (Squiz.CSS.SemicolonSpacing.NotAtEnd)
9 | ERROR | Style definitions must end with a semicolon (Squiz.CSS.SemicolonSpacing.NotAtEnd)
10 | ERROR | Style definitions must end with a semicolon (Squiz.CSS.SemicolonSpacing.NotAtEnd)
11 | ERROR | Style definitions must end with a semicolon (Squiz.CSS.SemicolonSpacing.NotAtEnd)
13 | ERROR | Style definitions must end with a semicolon (Squiz.CSS.SemicolonSpacing.NotAtEnd)
Expected behavior
A clear and concise description of what you expected to happen.
Versions (please complete the following information)
. | |
---|---|
Operating System | Docker php:8.3-fpm (official) |
PHP version | 8.3 |
PHP_CodeSniffer version | 3.10.1 |
Standard | Squiz |
Install type | composer (local) |
Additional context
Add any other context about the problem here.
Please confirm
- [X] I have searched the issue list and am not opening a duplicate issue.
- [X] I have read the Contribution Guidelines and this is not a support question.
- [X] I confirm that this bug is a bug in PHP_CodeSniffer and not in one of the external standards.
- [X] I have verified the issue still exists in the
master
branch of PHP_CodeSniffer.