Skip to content

Commit 1158904

Browse files
authored
style(cspell): Fix cspell spelling and enable cspell testing (#3418190)
1 parent b4972e7 commit 1158904

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+166
-182
lines changed

.cspell.json

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{
2+
// Version of the setting file. Always 0.2
3+
"version": "0.2",
4+
// language - current active spelling language
5+
"language": "en-US",
6+
"ignorePaths": [
7+
"composer.*",
8+
"tests",
9+
"vendor"
10+
],
11+
"dictionaries": [
12+
"dictionary",
13+
"drupal",
14+
"companies",
15+
"fonts",
16+
"html",
17+
"php",
18+
"softwareTerms"
19+
],
20+
// words - list of words to be always considered correct
21+
"words": [
22+
"addtogroup",
23+
"autoloader",
24+
"codesniffer",
25+
"ColourDefinitionSniff",
26+
"CURLOPT_SSL_VERIFYPEER",
27+
"datestamp",
28+
"defgroup",
29+
"drush",
30+
"endcode",
31+
"endlink",
32+
"heredocs",
33+
"Kernighan",
34+
"Komodo",
35+
"multibyte",
36+
"Netbeans",
37+
"phpcbf",
38+
"Ritchie",
39+
"ruleset",
40+
"sirbrillig",
41+
"squizlabs",
42+
"Squiz",
43+
"startOfLine",
44+
"Superglobal",
45+
"T_ASPERAND",
46+
"T_COLOUR",
47+
"T_CONSTANT_ENCAPSED_STRING",
48+
"T_DNUMBER",
49+
"T_LNUMBER",
50+
"T_NULLSAFE_OBJECT_OPERATOR",
51+
"tableselect",
52+
"ungreedy",
53+
"unserialized",
54+
"webform"
55+
],
56+
// flagWords - list of words to be always considered incorrect
57+
// This is useful for offensive words and common spelling errors.
58+
// For example "hte" should be "the"
59+
"flagWords": [
60+
"hte"
61+
]
62+
}

.gitattributes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
/.cspell.json export-ignore
12
/.gitattributes export-ignore
2-
/.travis.yml export-ignore
33
/README.md export-ignore
44
/phpcs.xml.dist export-ignore
55
/phpunit.xml.dist export-ignore

.github/workflows/testing.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@ jobs:
6262
if: ${{ matrix.extra-tests == '1' }}
6363
run: ./vendor/bin/phpstan analyse
6464

65+
- name: Run Cspell
66+
if: ${{ matrix.extra-tests == '1' }}
67+
uses: streetsidesoftware/cspell-action@v6
68+
with:
69+
incremental_files_only: false
70+
6571
- name: Checkout Drupal core
6672
if: ${{ matrix.extra-tests == '1' }}
6773
uses: actions/checkout@v3

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ phpcs.xml.dist file in your project like this:
7373

7474
```xml
7575
<?xml version="1.0" encoding="UTF-8"?>
76-
<ruleset name="myproject">
77-
<description>PHP CodeSniffer configuration for myproject development.</description>
76+
<ruleset name="example">
77+
<description>PHP CodeSniffer configuration for example development.</description>
7878
<!-- Check all files in the current directory and below. -->
7979
<file>.</file>
8080
<arg name="extensions" value="php,module,inc,install,test,profile,theme,css,info,txt,md,yml"/>
@@ -139,7 +139,7 @@ Then execute the coding standards checker on Coder itself:
139139

140140
Then execute static analysis:
141141

142-
./vendor/bin/phpstan analyse
142+
./vendor/bin/phpstan
143143

144144

145145
## Contributing
@@ -154,6 +154,8 @@ Thank you!
154154

155155
## Maintainers
156156

157+
[//]: # cspell:ignore Pieter Frenssen Welford
158+
157159
- Pieter Frenssen, https://www.drupal.org/u/pfrenssen
158160
- Michael Welford, https://www.drupal.org/u/mikejw
159161
- Klaus Purer, https://www.drupal.org/u/klausi

coder_sniffer/Drupal/Docs/Functions/FunctionCallArgumentSpacingStandard.xml

Lines changed: 0 additions & 19 deletions
This file was deleted.

coder_sniffer/Drupal/Docs/Functions/FunctionCallSignatureStandard.xml

Lines changed: 0 additions & 19 deletions
This file was deleted.

coder_sniffer/Drupal/Docs/Functions/ValidDefaultValueStandard.xml

Lines changed: 0 additions & 25 deletions
This file was deleted.

coder_sniffer/Drupal/Sniffs/CSS/ClassDefinitionNameSpacingSniff.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,8 @@ public function process(File $phpcsFile, $stackPtr)
9898
&& in_array($tokens[($i - 1)]['code'], [T_WHITESPACE, T_COMMA]) === false
9999
) {
100100
$error = 'Selectors must be on a single line';
101-
$fix = $phpcsFile->addFixableError($error, $i, 'SeletorSingleLine');
101+
// cspell:ignore SeletorSingleLine
102+
$fix = $phpcsFile->addFixableError($error, $i, 'SeletorSingleLine');
102103
if ($fix === true) {
103104
$phpcsFile->fixer->replaceToken($i, str_replace($phpcsFile->eolChar, ' ', $tokens[$i]['content']));
104105
}

coder_sniffer/Drupal/Sniffs/CSS/ColourDefinitionSniff.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
/**
1616
* \Drupal\Sniffs\CSS\ColourDefinitionSniff.
1717
*
18-
* Ensure colours are defined in lower-case.
18+
* Ensure colors are defined in lower-case.
1919
*
2020
* @category PHP
2121
* @package PHP_CodeSniffer
@@ -56,14 +56,14 @@ public function register()
5656
public function process(File $phpcsFile, $stackPtr)
5757
{
5858
$tokens = $phpcsFile->getTokens();
59-
$colour = $tokens[$stackPtr]['content'];
59+
$color = $tokens[$stackPtr]['content'];
6060

61-
$expected = strtolower($colour);
62-
if ($colour !== $expected) {
63-
$error = 'CSS colours must be defined in lowercase; expected %s but found %s';
61+
$expected = strtolower($color);
62+
if ($color !== $expected) {
63+
$error = 'CSS colors must be defined in lowercase; expected %s but found %s';
6464
$data = [
6565
$expected,
66-
$colour,
66+
$color,
6767
];
6868
$fix = $phpcsFile->addFixableError($error, $stackPtr, 'NotLower', $data);
6969
if ($fix === true) {

coder_sniffer/Drupal/Sniffs/Classes/ClassDeclarationSniff.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,10 @@ public function process(File $phpcsFile, $stackPtr)
8282
}
8383

8484
$previous = $phpcsFile->findPrevious(T_WHITESPACE, ($openingBrace - 1), null, true);
85-
$decalrationLine = $tokens[$previous]['line'];
85+
$declarationLine = $tokens[$previous]['line'];
8686
$braceLine = $tokens[$openingBrace]['line'];
8787

88-
$lineDifference = ($braceLine - $decalrationLine);
88+
$lineDifference = ($braceLine - $declarationLine);
8989

9090
if ($lineDifference > 0) {
9191
$error = 'Opening brace should be on the same line as the declaration';

0 commit comments

Comments
 (0)