denis-korchagin95 / fs-control
fs-control helps you to keep your directory tree under control.
Requires
- php: >=8.1
- symfony/yaml: >=5.2
- webmozart/glob: ^4.7
Requires (Dev)
- mikey179/vfsstream: ^1.6
- phpstan/phpstan: ^2.0
- phpstan/phpstan-strict-rules: ^2.0
- phpunit/phpunit: ^9.5
- roave/security-advisories: dev-latest
- slevomat/coding-standard: ^8.6
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
fs-control is an analyzer for your directory tree to allow you to keep it under control.
Maybe you have some agreements in your project and rules to the directory tree, but actually in real life it may not work on 100%. This tool can allow you to define your variant of configuration and help you to fix that and control.
If your mindset changes about the directory tree, okay, it's cool. Just edit configuration and fs-control will care about for you. Also set you free from some "review battles" and allow you to concentrate on more important things.
Getting started
You can install fs-control via Composer using the main composer.json:
composer require --dev denis-korchagin95/fs-control
Or you may to install fs-control via Composer in a dedicated composer.json,
for example, in the tools/fs-control directory:
mkdir -p tools/fs-control composer require --working-dir=tools/fs-control denis-korchagin95/fs-control
Usage
You need to create a configuration file for a whole project or just its small part.
The basic configuration file may look like:
fs_control: paths: - ./example-fs/Container exclude_paths: - ./example-fs/Container/Infrastructure/ParamConverter/Check groups: Application: ~ Domain: ~ Infrastructure: ~ bindings: $/Application: Application $/Domain: Domain $/Infrastructure: Infrastructure rules: Entity: - Domain ParamConverter: - Infrastructure Command: - Application
You can analyze the project using a configuration file for some project.
./vendor/bin/fs-control example-fs-config.yaml
To keep directories such as vendor or generated code completely out of analysis, add a
.gitignore-style .fs-control-ignore
file to your project root.
Adopting the tool on an existing project? Switch it to the
tolerant mode (mode: tolerant, or --mode=tolerant):
the rules you already described keep being enforced, while the rest of the tree is reported
as out of coverage instead of failing the run.
See usage, tool concepts, built-in extension list, and config reference documentation for more examples and details.
If you need to solve your specific problems that are not supported by the tool, you can create a custom extension.
Contribute
Any contributions are welcome. This repository is open to pull requests.