Skip to content
New issue

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

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

Already on GitHub? # to your account

Squiz.CSS.SemicolonSpacing.NotAtEnd false positive on classes with numbers #605

Closed
4 tasks done
abarker-gravity opened this issue Sep 5, 2024 · 1 comment
Closed
4 tasks done

Comments

@abarker-gravity
Copy link

abarker-gravity commented Sep 5, 2024

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:

  1. Create a css file called test.css with the code sample above...
  2. Run phpcs test.css ...
  3. 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

  • I have searched the issue list and am not opening a duplicate issue.
  • I have read the Contribution Guidelines and this is not a support question.
  • I confirm that this bug is a bug in PHP_CodeSniffer and not in one of the external standards.
  • I have verified the issue still exists in the master branch of PHP_CodeSniffer.
@jrfnl
Copy link
Member

jrfnl commented Sep 5, 2024

@abarker-gravity Thanks for reporting this. CSS support, including all CSS sniffs, is deprecated and will be removed in PHPCS 4.0, so this is unlikely to get fixed. There are other, CSS specific, code styling tools available nowadays. I recommend you use those.

If a small fix for this issue could/would be submitted, I might accept it, but extensive changes to support this in the CSS Tokenizer will not be accepted anymore.

@jrfnl jrfnl closed this as not planned Won't fix, can't repro, duplicate, stale Nov 2, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

2 participants