Via composer php-codesniffer + Drupal standard
621
Added ESLint and stylelint linters
docker build -f ./Dockerfile -t php-codesniffer:1.0.1 .
docker tag php-codesniffer:1.0.1 crashbar/php-codesniffer:1.0.1
docker push crashbar/php-codesniffer:1.0.1
MySource,
PEAR,
PSR1,
PSR2,
PSR12,
Squiz,
Zend,
Drupal,
DrupalPractice,
SlevomatCodingStandard
docker run:docker run -v "$(pwd)":/var/www --rm crashbar/php-codesniffer:latest sh -c 'phpcs -d memory_limit=512M --report=summary --standard=DrupalPractice web/*'
-d memory_limit=512M- can be changed to a larger value if you encounter memory errors due to a large volume of files being scanned.
-d memory_limit=-1- alternatively, you can disable the limit if many files need to be scanned.
docker-compose.yml:services:
sniffer:
image: crashbar/php-codesniffer:latest
command: phpcs --report=summary --standard=DrupalPractice web/*
container_name: php-sniffer
volumes:
- <PATH TO CODE / OR GIT>:/var/www
pipeline (e.g. Bitbucket):pipelines:
custom:
tests:
- step:
name: php-codesniffer
image: crashbar/php-codesniffer:latest
services:
- docker
script:
- apt-get update && apt-get install -y jq
- phpcs --report=summary --standard=DrupalPractice web/*
php-codesnifferPHP CODE SNIFFER REPORT SUMMARY
----------------------------------------------------------------------
FILE ERRORS WARNINGS
----------------------------------------------------------------------
...rc/EventSubscriber/OrderEntityCloneSubscriber.php 0 3
.../EventSubscriber/ProductEntityCloneSubscriber.php 0 1
...er_print/src/Controller/OrderActionController.php 0 1
..._print/src/Controller/OrderContractController.php 0 1
..._order_print/src/Form/OrderContractConfigForm.php 0 5
----------------------------------------------------------------------
A TOTAL OF 0 ERRORS AND 11 WARNINGS WERE FOUND IN 5 FILES
----------------------------------------------------------------------
Time: 0.91 secs; Memory: 52MB
(Drupal standard)docker run:docker run -e USER=$(id -u) -e GROUP=$(id -g) -v "$(pwd)":/var/www --rm php-codesniffer:1.0.2 sh -c 'chown -R $USER:$GROUP /var/linters/. && cp -raf /var/linters/. . && mv .eslintrc.json web/ && mv .stylelintrc.json web/ && npx eslint web/themes/custom/**/webpack.mix.js'
pipeline (e.g. Bitbucket):pipelines:
custom:
tests:
- step:
name: ESLint-docker
image: crashbar/php-codesniffer:latest
services:
- docker
script:
- cp -raf /var/linters/. . && mv .eslintrc.json web/ && mv .stylelintrc.json web/
- npx eslint web/themes/custom/**/webpack.mix.js
(Drupal standard)docker run:docker run -e USER=$(id -u) -e GROUP=$(id -g) -v ./:/var/www --rm php-codesniffer:1.0.2 sh -c 'chown -R $USER:$GROUP /var/linters/. && cp -raf /var/linters/. . && mv .eslintrc.json web/ && mv .stylelintrc.json web/ && npx stylelint web/themes/custom/**/assets/css/gsore.css'
pipeline (e.g. Bitbucket):pipelines:
custom:
tests:
- step:
name: stylelint-docker
image: crashbar/php-codesniffer:latest
services:
- docker
script:
- cp -raf /var/linters/. . && mv .eslintrc.json web/ && mv .stylelintrc.json web/
- npx stylelint web/themes/custom/**/assets/css/gsore.css
ESLint/webpack.mix.js
1:5 error 'mix' is never reassigned. Use 'const' instead prefer-const
1:19 error Replace `'laravel-mix')` with `"laravel-mix");` prettier/prettier
1:19 error Unable to resolve path to module 'laravel-mix' import/no-unresolved
2:35 error Replace `'browser-sync-webpack-plugin'` with `"browser-sync-webpack-plugin"` prettier/prettier
27:15 error Replace `processCssUrls:Ā·false` with `Ā·processCssUrls:Ā·falseĀ·` prettier/prettier
29:2 error Delete `ā` prettier/prettier
ā 18 problems (18 errors, 0 warnings)
15 errors and 0 warnings potentially fixable with the `--fix` option.
stylelint/gsore.css
109:3 ā Expected color to come before text-decoration
ā 3121 problems (3121 errors, 0 warnings)
1958 errors potentially fixable with the "--fix" option.
Content type
Image
Digest
sha256:a7b3835a2ā¦
Size
399.7 MB
Last updated
10 months ago
docker pull crashbar/php-codesniffer