Skip to content

Commit

Permalink
Merge 0f6054f into 9ab8281
Browse files Browse the repository at this point in the history
  • Loading branch information
MGatner committed Jul 12, 2022
2 parents 9ab8281 + 0f6054f commit 542ac79
Show file tree
Hide file tree
Showing 35 changed files with 503 additions and 237 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@ trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

[*.{yml,yaml}]
indent_size = 2
71 changes: 71 additions & 0 deletions .github/workflows/psalm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Psalm

on:
pull_request:
branches:
- develop
paths:
- '**.php'
- 'composer.*'
- 'psalm*'
- '.github/workflows/psalm.yml'
push:
branches:
- develop
paths:
- '**.php'
- 'composer.*'
- 'psalm*'
- '.github/workflows/psalm.yml'

jobs:
build:
name: Psalm Analysis
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[ci skip]')"

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.0'
tools: phpstan, phpunit
extensions: intl, json, mbstring, xml
coverage: none
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache composer dependencies
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-

- name: Create Psalm cache directory
run: mkdir -p build/psalm

- name: Cache Psalm results
uses: actions/cache@v3
with:
path: build/psalm
key: ${{ runner.os }}-psalm-${{ github.sha }}
restore-keys: ${{ runner.os }}-psalm-

- name: Install dependencies
run: |
if [ -f composer.lock ]; then
composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader
else
composer update --no-progress --no-interaction --prefer-dist --optimize-autoloader
fi
- name: Run Psalm analysis
run: vendor/bin/psalm
2 changes: 1 addition & 1 deletion .github/workflows/rector.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,5 @@ jobs:
- name: Analyze for refactoring
run: |
composer global require --dev rector/rector:^0.12.16
composer global require --dev rector/rector:^0.13.8
rector process --dry-run --no-progress-bar
138 changes: 71 additions & 67 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,69 +1,73 @@
{
"name": "myth/auth",
"type": "library",
"description": "Flexible authentication/authorization system for CodeIgniter 4.",
"keywords": [
"codeigniter",
"authentication",
"authorization"
],
"homepage": "https://github.com/lonnieezell/myth-auth",
"license": "MIT",
"authors": [
{
"name": "Lonnie Ezell",
"email": "lonnieje@gmail.com",
"homepage": "http://newmythmedia.com",
"role": "Developer"
}
],
"require": {
"php": "^7.4 || ^8.0"
},
"provide": {
"codeigniter4/authentication-implementation": "1.0"
},
"require-dev": {
"codeigniter4/codeigniter4-standard": "^1.0",
"codeigniter4/devkit": "^1.0",
"codeigniter4/framework": "^4.1",
"mockery/mockery": "^1.0"
},
"config": {
"allow-plugins": {
"phpstan/extension-installer": true
}
},
"autoload": {
"psr-4": {
"Myth\\Auth\\": "src"
},
"exclude-from-classmap": [
"**/Database/Migrations/**"
]
},
"autoload-dev": {
"psr-4": {
"Tests\\Support\\": "tests/_support"
}
},
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"analyze": "phpstan analyze",
"ci": [
"Composer\\Config::disableProcessTimeout",
"@deduplicate",
"@analyze",
"@test",
"@inspect",
"rector process",
"@style"
],
"deduplicate": "phpcpd app/ src/",
"inspect": "deptrac analyze --cache-file=build/deptrac.cache",
"mutate": "infection --threads=2 --skip-initial-tests --coverage=build/phpunit",
"style": "php-cs-fixer fix --verbose --ansi --using-cache=no",
"test": "phpunit"
}
"name": "myth/auth",
"description": "Flexible authentication/authorization system for CodeIgniter 4.",
"license": "MIT",
"type": "library",
"keywords": [
"codeigniter",
"authentication",
"authorization"
],
"authors": [
{
"name": "Lonnie Ezell",
"email": "lonnieje@gmail.com",
"homepage": "http://newmythmedia.com",
"role": "Developer"
}
],
"homepage": "https://github.com/lonnieezell/myth-auth",
"require": {
"php": "^7.4 || ^8.0"
},
"require-dev": {
"codeigniter4/codeigniter4-standard": "^1.0",
"codeigniter4/devkit": "^1.0",
"codeigniter4/framework": "^4.1",
"mockery/mockery": "^1.0"
},
"provide": {
"codeigniter4/authentication-implementation": "1.0"
},
"minimum-stability": "dev",
"prefer-stable": true,
"autoload": {
"psr-4": {
"Myth\\Auth\\": "src"
},
"exclude-from-classmap": [
"**/Database/Migrations/**"
]
},
"autoload-dev": {
"psr-4": {
"Tests\\Support\\": "tests/_support"
}
},
"config": {
"allow-plugins": {
"phpstan/extension-installer": true
}
},
"scripts": {
"analyze": [
"phpstan analyze",
"psalm",
"rector process --dry-run"
],
"ci": [
"Composer\\Config::disableProcessTimeout",
"@deduplicate",
"@analyze",
"@composer normalize --dry-run",
"@test",
"@inspect",
"@style"
],
"deduplicate": "phpcpd app/ src/",
"inspect": "deptrac analyze --cache-file=build/deptrac.cache",
"mutate": "infection --threads=2 --skip-initial-tests --coverage=build/phpunit",
"style": "php-cs-fixer fix --verbose --ansi --using-cache=no",
"test": "phpunit"
}
}
161 changes: 161 additions & 0 deletions deptrac.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
parameters:
paths:
- ./src/
- ./vendor/codeigniter4/framework/system/
exclude_files:
- '#.*test.*#i'
layers:
- name: Model
collectors:
- type: bool
must:
- type: className
regex: .*[A-Za-z]+Model$
must_not:
- type: directory
regex: vendor/.*
- name: Vendor Model
collectors:
- type: bool
must:
- type: className
regex: .*[A-Za-z]+Model$
- type: directory
regex: vendor/.*
- name: Controller
collectors:
- type: bool
must:
- type: className
regex: .*\/Controllers\/.*
must_not:
- type: directory
regex: vendor/.*
- name: Vendor Controller
collectors:
- type: bool
must:
- type: className
regex: .*\/Controllers\/.*
- type: directory
regex: vendor/.*
- name: Config
collectors:
- type: bool
must:
- type: directory
regex: src/Config/.*
must_not:
- type: className
regex: .*Services
- type: directory
regex: vendor/.*
- name: Vendor Config
collectors:
- type: bool
must:
- type: directory
regex: vendor/.*/Config/.*
must_not:
- type: className
regex: .*Services
- name: Entity
collectors:
- type: bool
must:
- type: directory
regex: src/Entities/.*
must_not:
- type: directory
regex: vendor/.*
- name: Vendor Entity
collectors:
- type: bool
must:
- type: directory
regex: vendor/.*/Entities/.*
- name: View
collectors:
- type: bool
must:
- type: directory
regex: src/Views/.*
must_not:
- type: directory
regex: vendor/.*
- name: Vendor View
collectors:
- type: bool
must:
- type: directory
regex: vendor/.*/Views/.*
- name: Service
collectors:
- type: className
regex: .*Services.*
ruleset:
Entity:
- Config
- Model
- Service
- Vendor Config
- Vendor Entity
- Vendor Model
Config:
- Service
- Vendor Config
Model:
- Config
- Entity
- Service
- Vendor Config
- Vendor Entity
- Vendor Model
Service:
- Config
- Vendor Config

# Ignore anything in the Vendor layers
Vendor Model:
- Config
- Service
- Vendor Config
- Vendor Controller
- Vendor Entity
- Vendor Model
- Vendor View
Vendor Controller:
- Service
- Vendor Config
- Vendor Controller
- Vendor Entity
- Vendor Model
- Vendor View
Vendor Config:
- Config
- Service
- Vendor Config
- Vendor Controller
- Vendor Entity
- Vendor Model
- Vendor View
Vendor Entity:
- Service
- Vendor Config
- Vendor Controller
- Vendor Entity
- Vendor Model
- Vendor View
Vendor View:
- Service
- Vendor Config
- Vendor Controller
- Vendor Entity
- Vendor Model
- Vendor View
skip_violations:
Myth\Auth\Config\Services:
- Myth\Auth\Authorization\GroupModel
- Myth\Auth\Authorization\PermissionModel
- Myth\Auth\Models\LoginModel
- Myth\Auth\Models\UserModel
2 changes: 0 additions & 2 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ parameters:
ignoreErrors:
- '#.+Mockery.+#'
- '#Call to an undefined method .+::shouldReceive\(\)#'
- '#Call to an undefined method CodeIgniter\\Database\\BaseBuilder::[A-Za-z]+\(\)#'
- '#Call to an undefined method CodeIgniter\\Model::[A-Za-z]+\(\)#'
- '#Call to an undefined static method Config\\Services::[A-Za-z]+\(\)#'
- '#Cannot access property [\$a-z_]+ on (array|object)#'
- '#Parameter \$user of method Myth\\Auth\\Authentication\\Passwords\\ValidatorInterface::check\(\) has typehint with deprecated class CodeIgniter\\Entity#'
Expand Down
Loading

0 comments on commit 542ac79

Please sign in to comment.