Skip to content

Commit

Permalink
chore: Add phpstan, ecs and rector; Add GitHub CI workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnynotsolucky committed Mar 13, 2024
1 parent 1053323 commit 67cad6b
Show file tree
Hide file tree
Showing 7 changed files with 91 additions and 33 deletions.
25 changes: 25 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# EditorConfig is awesome: https://EditorConfig.org

# Top-most EditorConfig file
root = true

# All files
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 2

# PHP files
[*.php]
indent_size = 4

# Markdown files
[*.md]
trim_trailing_whitespace = false

# Indentation override for all HTML, CSS/SCSS, JS, and Vue files
[*.{html,css,scss,js,vue,twig}]
indent_style = tab
52 changes: 52 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: CI

on:
workflow_dispatch:
push:
branches:
- main
pull_request:

jobs:
ecs:
name: ECS Check
runs-on: ubuntu-latest
env:
DEFAULT_COMPOSER_FLAGS: "--no-interaction --no-ansi --no-progress"
steps:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
php-version: 8.1
- run: composer install --prefer-dist --no-progress
- name: Run ecs check
run: |
vendor/bin/ecs --memory-limit=1G --no-progress-bar
rector:
name: Rector dry-run
runs-on: ubuntu-latest
env:
DEFAULT_COMPOSER_FLAGS: "--no-interaction --no-ansi --no-progress"
steps:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
php-version: 8.1
- run: composer install --prefer-dist --no-progress
- name: Run rector --dry-run
run: |
vendor/bin/rector --memory-limit=1G --no-progress-bar --dry-run
phpstan:
name: PHPStan
runs-on: ubuntu-latest
env:
DEFAULT_COMPOSER_FLAGS: "--no-interaction --no-ansi --no-progress"
steps:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
php-version: 8.1
- run: composer install --prefer-dist --no-progress
- name: Run phpstan
run: |
vendor/bin/phpstan --memory-limit=1G
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ in Craft.
### Username/Password

ShipStation allows you to set a custom username and password combination for a
connected store. This combination should match the values stored in the
connected store. This combination should match the values stored in the
ShipStation Connnect settings view in your Craft control panel.

**Note:** These are *not* your ShipStation credentials, nor your Craft user
Expand Down
10 changes: 6 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
"craftcms/commerce": "^4.0"
},
"require-dev": {
"roave/security-advisories": "dev-latest",
"craftcms/phpstan": "dev-main",
"craftcms/ecs": "dev-main",
"craftcms/rector": "dev-main"
"fostercommerce/phpstan": "dev-main",
"fostercommerce/ecs": "dev-main",
"fostercommerce/rector": "dev-main",
"roave/security-advisories": "dev-latest"
},
"extra": {
"handle": "shipstationconnect",
Expand All @@ -43,6 +43,8 @@
"craftcms/plugin-installer": true
}
},
"prefer-stable": true,
"minimum-stability": "dev",
"scripts": {
"phpstan": "phpstan --memory-limit=1G",
"ecs-check": "ecs check --ansi --memory-limit=1G",
Expand Down
7 changes: 4 additions & 3 deletions ecs.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@

declare(strict_types=1);

use craft\ecs\SetList;
use fostercommerce\ecs\SetList;
use Symplify\EasyCodingStandard\Config\ECSConfig;

return static function(ECSConfig $ecsConfig): void {
$ecsConfig->parallel();
$ecsConfig->paths([
__DIR__ . '/src',
__FILE__,
]);

$ecsConfig->sets([SetList::CRAFT_CMS_4]);
$ecsConfig->sets([
SetList::CRAFT_CMS_4,
]);
};
3 changes: 1 addition & 2 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
includes:
- vendor/craftcms/phpstan/phpstan.neon
- vendor/fostercommerce/phpstan/phpstan.neon

parameters:
level: 0
paths:
- src
25 changes: 2 additions & 23 deletions rector.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<?php
declare(strict_types = 1);

use craft\rector\SetList as CraftSetList;
use Rector\Set\ValueObject\SetList;
use fostercommerce\rector\SetList;
use Rector\Config\RectorConfig;

return static function(RectorConfig $rectorConfig): void {
Expand All @@ -11,26 +10,6 @@
]);

$rectorConfig->sets([
SetList::PHP_80,
SetList::PHP_74,
SetList::PHP_73,
SetList::PHP_72,
SetList::PHP_71,
SetList::PHP_70,
SetList::PHP_56,
SetList::PHP_55,
SetList::PHP_54,
SetList::PHP_53,
SetList::PHP_52,
SetList::CODE_QUALITY,
SetList::CODING_STYLE,
SetList::DEAD_CODE,
SetList::STRICT_BOOLEANS,
SetList::NAMING,
SetList::TYPE_DECLARATION,
SetList::EARLY_RETURN,
SetList::INSTANCEOF,
CraftSetList::CRAFT_CMS_40,
CraftSetList::CRAFT_COMMERCE_40,
SetList::CRAFT_CMS_40_PHP_80,
]);
};

0 comments on commit 67cad6b

Please sign in to comment.