-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci(PT13113): Add github workflow for code style (#16)
- Loading branch information
Dennis Garding
committed
Jul 13, 2023
1 parent
0a61f8b
commit 082c04d
Showing
9 changed files
with
152 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: Javascript | ||
|
||
on: | ||
pull_request: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
call-javascript-workflow: | ||
name: Analyse Javascript Code for SwagPaymentPaypal | ||
uses: shopware5/docker-images-testing/.github/workflows/javascript-analysis.yml@main | ||
with: | ||
plugin-name: SwagPaymentPaypal | ||
legacy-plugin: true | ||
legacy-plugin-target: Frontend |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: PHP | ||
|
||
on: | ||
pull_request: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
call-analyse-workflow: | ||
name: Analyse code for SwagPaymentPaypal | ||
uses: shopware5/docker-images-testing/.github/workflows/php-code-analysis.yml@main | ||
with: | ||
plugin-name: SwagPaymentPaypal | ||
legacy-plugin: true | ||
legacy-plugin-target: Frontend |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/.idea | ||
.php-cs-fixer.cache |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
.DEFAULT_GOAL := help | ||
|
||
filter := "default" | ||
dirname := $(notdir $(CURDIR)) | ||
envprefix := $(shell echo "$(dirname)" | tr A-Z a-z) | ||
envname := $(envprefix)test | ||
debug := "false" | ||
|
||
help: | ||
@grep -E '^[0-9a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' | ||
.PHONY: help | ||
|
||
install-plugin: .refresh-plugin-list ## Install and activate the plugin | ||
@echo "Install the plugin" | ||
php ./../../../../../../bin/console sw:plugin:install $(dirname) --activate | ||
php ./../../../../../../bin/console sw:cache:clear | ||
|
||
.refresh-plugin-list: | ||
@echo "Refresh the plugin list" | ||
php ./../../../../../../bin/console sw:plugin:refresh | ||
|
||
CS_FIXER_RUN= | ||
fix-cs: ## Run the code style fixer | ||
php ./../../../../../../vendor/bin/php-cs-fixer fix --config=./php-cs-fixer.php -v $(CS_FIXER_RUN) | ||
|
||
fix-cs-dry: CS_FIXER_RUN= --dry-run | ||
fix-cs-dry: fix-cs ## Run the code style fixer in dry mode | ||
|
||
check-js-code: check-eslint-backend ## Run esLint | ||
fix-js-code: fix-eslint-backend fix-eslint-e2e fix-eslint-jest-tests ## Fix js code | ||
|
||
ESLINT_FIX= | ||
check-eslint-backend: | ||
./../../../../../../themes/node_modules/eslint/bin/eslint.js --ignore-path .eslintignore -c ./../../../../../../themes/Backend/.eslintrc.js Views/backend $(ESLINT_FIX) | ||
|
||
fix-eslint-backend: ESLINT_FIX= --fix | ||
fix-eslint-backend: check-eslint-backend |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<?php | ||
/** | ||
* (c) shopware AG <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
use PhpCsFixer\Config; | ||
use PhpCsFixerCustomFixers\Fixer\NoUselessCommentFixer; | ||
use PhpCsFixerCustomFixers\Fixer\PhpdocParamTypeFixer; | ||
use PhpCsFixerCustomFixers\Fixer\SingleSpaceAfterStatementFixer; | ||
use PhpCsFixerCustomFixers\Fixer\SingleSpaceBeforeStatementFixer; | ||
use PhpCsFixerCustomFixers\Fixers; | ||
|
||
$finder = PhpCsFixer\Finder::create() | ||
->in(__DIR__); | ||
|
||
$header = <<<EOF | ||
(c) shopware AG <[email protected]> | ||
For the full copyright and license information, please view the LICENSE | ||
file that was distributed with this source code. | ||
EOF; | ||
|
||
return (new Config()) | ||
->registerCustomFixers(new Fixers()) | ||
->setRiskyAllowed(true) | ||
->setRules(array( | ||
'@PSR2' => true, | ||
'@Symfony' => true, | ||
'header_comment' => array('header' => $header, 'separate' => 'bottom', 'comment_type' => 'PHPDoc'), | ||
'no_useless_else' => true, | ||
'no_useless_return' => true, | ||
'ordered_class_elements' => true, | ||
'ordered_imports' => true, | ||
'phpdoc_order' => true, | ||
'phpdoc_summary' => false, | ||
'blank_line_after_opening_tag' => false, | ||
'concat_space' => array('spacing' => 'one'), | ||
'array_syntax' => array('syntax' => 'long'), | ||
'yoda_style' => array('equal' => false, 'identical' => false, 'less_and_greater' => false), | ||
'general_phpdoc_annotation_remove' => array( | ||
'annotations' => array('copyright', 'category'), | ||
), | ||
'phpdoc_var_annotation_correct_order' => true, | ||
'doctrine_annotation_indentation' => true, | ||
'doctrine_annotation_spaces' => true, | ||
'no_superfluous_phpdoc_tags' => true, | ||
'native_constant_invocation' => false, | ||
'php_unit_test_case_static_method_calls' => true, | ||
'operator_linebreak' => array('only_booleans' => true), | ||
'visibility_required' => false, | ||
NoUselessCommentFixer::name() => true, | ||
SingleSpaceAfterStatementFixer::name() => true, | ||
SingleSpaceBeforeStatementFixer::name() => true, | ||
PhpdocParamTypeFixer::name() => true, | ||
)) | ||
->setFinder($finder) | ||
; |