diff --git a/Magento2/Sniffs/Less/ColonSpacingSniff.php b/Magento2/Sniffs/Less/ColonSpacingSniff.php index 6ada0fac..dd8fee7f 100644 --- a/Magento2/Sniffs/Less/ColonSpacingSniff.php +++ b/Magento2/Sniffs/Less/ColonSpacingSniff.php @@ -12,7 +12,7 @@ /** * Class ColonSpacingSniff * - * Ensure that single quotes are used + * Ensure that colon spacing is right * * @link https://devdocs.magento.com/guides/v2.4/coding-standards/code-standard-less.html#properties-colon-indents */ @@ -101,7 +101,7 @@ private function validateSpaces(File $phpcsFile, $stackPtr, array $tokens) if (false === strpos($content, $phpcsFile->eolChar)) { $length = strlen($content); if ($length !== 1) { - $error = 'Expected 1 space after colon in style definition; %s found'; + $error = sprintf('Expected 1 space after colon in style definition; %s found', $length); $phpcsFile->addError($error, $stackPtr, 'After'); } } else { diff --git a/Magento2/Tests/Less/ColonSpacingUnitTest.less b/Magento2/Tests/Less/ColonSpacingUnitTest.less new file mode 100644 index 00000000..d888af2e --- /dev/null +++ b/Magento2/Tests/Less/ColonSpacingUnitTest.less @@ -0,0 +1,26 @@ +// /** +// * Copyright © Magento, Inc. All rights reserved. +// * See COPYING.txt for license details. +// */ + + +div#foo { + blah:'abc'; +} + +.my #foo .blah { + some: 'stuff'; +} + +.blah { + foo :'xyz'; +} + +.foo { + bar: + 'xyz'; +} + +.right { + way: 'good' +} diff --git a/Magento2/Tests/Less/ColonSpacingUnitTest.php b/Magento2/Tests/Less/ColonSpacingUnitTest.php new file mode 100644 index 00000000..b50e47d0 --- /dev/null +++ b/Magento2/Tests/Less/ColonSpacingUnitTest.php @@ -0,0 +1,29 @@ + 1, + 12 => 1, + 16 => 2, + ]; + } + + /** + * @inheritdoc + */ + public function getWarningList() + { + return []; + } +}