Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ jobs:
run: |
composer test:code
composer test:lint
# Skip cognitive complexity gate on prefer-lowest to keep matrix runtime stable.
if [ "${{ matrix.dependency-version }}" != "prefer-lowest" ]; then
composer test:static
fi
composer test:refactor
# Skip Psalm on prefer-lowest: older transitive amphp versions can trigger PHP 8.4+ deprecations at startup.
if [ "${{ matrix.dependency-version }}" != "prefer-lowest" ]; then
Expand Down
29 changes: 23 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,22 @@ Pathwise is a robust PHP library designed as **Flysystem + more** for streamline
3. [Installation](#installation)
4. [Features Overview](#features-overview)
5. [Documentation Map](#documentation-map)
6. [FileManager](#filemanager)
6. [Quality Gates](#quality-gates)
7. [FileManager](#filemanager)
- [SafeFileReader](#safefilereader)
- [SafeFileWriter](#safefilewriter)
- [FileOperations](#fileoperations)
- [FileCompression](#filecompression)
7. [DirectoryManager](#directorymanager)
8. [DirectoryManager](#directorymanager)
- [DirectoryOperations](#directoryoperations)
8. [Utils](#utils)
9. [Utils](#utils)
- [PathHelper](#pathhelper)
- [PermissionsHelper](#permissionshelper)
- [MetadataHelper](#metadatahelper)
9. [Handy Functions](#handy-functions)
10. [Handy Functions](#handy-functions)
- [File and Directory Utilities](#file-and-directory-utilities)
10. [Support](#support)
11. [License](#license)
11. [Support](#support)
12. [License](#license)

## **Prerequisites**
- Language: PHP 8.4/+
Expand Down Expand Up @@ -87,6 +88,22 @@ Then use module pages for details:
- [Retention](docs/retention.rst)
- [Utilities](docs/utilities.rst)

## **Quality Gates**

Pathwise includes a cognitive complexity gate powered by `tomasvotruba/cognitive-complexity` on top of PHPStan.

Run it locally:

```bash
composer test:phpstan
```

Current thresholds (see `phpstan.neon.dist`):

- Class cognitive complexity: `250`
- Function/method cognitive complexity: `9`
- Dependency-tree complexity: `400`

## **FileManager**

The `FileManager` module provides classes for handling files, including reading, writing, compressing, and general file operations.
Expand Down
4 changes: 0 additions & 4 deletions captainhook.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@
"action": "composer audit",
"options": []
},
{
"action": "composer test:security",
"options": []
},
{
"action": "composer tests",
"options": []
Expand Down
16 changes: 5 additions & 11 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"pestphp/pest-plugin-drift": "^4.1",
"rector/rector": "^2.3.9",
"symfony/var-dumper": "^7.3 || ^8.0.8",
"tomasvotruba/cognitive-complexity": "^1.1",
"vimeo/psalm": "^6.16.1"
},
"minimum-stability": "stable",
Expand All @@ -50,27 +51,20 @@
"scripts": {
"test:code": "@php vendor/bin/pest --parallel --processes=10",
"test:security": "@php vendor/bin/psalm --config=psalm.xml --security-analysis --show-info=false --no-progress --threads=1",
"test:static": "@php vendor/bin/phpstan analyse --configuration=phpstan.neon.dist --memory-limit=1G --no-progress",
"test:refactor": "@php vendor/bin/rector process --dry-run",
"test:lint": "@php vendor/bin/pint --test",
"test:hook": [
"captainhook hook:post-checkout",
"captainhook hook:pre-commit",
"captainhook hook:post-commit",
"captainhook hook:post-merge",
"captainhook hook:post-rewrite",
"captainhook hook:pre-push"
],
"tests": [
"@test:code",
"@test:lint",
"@test:static",
"@test:refactor",
"@test:security"
],
"git:hook": "captainhook install --only-enabled -nf",
"git:hook": "@php vendor/bin/captainhook install --only-enabled -nf",
"test": "@php vendor/bin/pest",
"refactor": "@php vendor/bin/rector process",
"lint": "@php vendor/bin/pint",
"security:scan": "@test:security",
"post-autoload-dump": "captainhook install --only-enabled -nf"
"post-autoload-dump": "@php vendor/bin/captainhook install --only-enabled -nf"
}
}
12 changes: 9 additions & 3 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
includes:
- vendor/tomasvotruba/cognitive-complexity/config/extension.neon

parameters:
level: 3
customRulesetUsed: true
paths:
- src
- tests
tmpDir: var/phpstan
parallel:
maximumNumberOfProcesses: 1
cognitive_complexity:
class: 150
function: 15
dependency_tree: 150
dependency_tree_types: []
1 change: 0 additions & 1 deletion psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
errorLevel="3"
cacheDirectory=".psalm-cache"
>
<projectFiles>
<directory name="src" />
Expand Down
Loading
Loading