OpenML
OpenML copied to clipboard
linitng setup added for PHP
Fixes: #1256
This pull request introduces a standardized approach to code style and quality enforcement for the project, focusing on PHP and related files. The main improvements are the addition of configuration files and development dependencies to automate code formatting and linting, as well as new scripts to make these tools easy to use.
Code style and quality enforcement:
- Added
.editorconfigto ensure consistent coding styles across all supported file types (PHP, JS, CSS, JSON, YAML, Markdown, Makefile, SQL), including rules for indentation, charset, line endings, and whitespace trimming. - Added
.php-cs-fixer.phpconfiguration to define and enforce PHP code style rules (PSR-12 and others), specifying which directories to check and which to exclude, plus cache settings for faster runs. - Added
.phpcs.xmlto configure PHP_CodeSniffer with PSR-12 as the base standard, directory inclusions/exclusions, relaxed rules for legacy CodeIgniter code, and settings for encoding and tab width.
Development tooling:
- Updated
openml_OS/composer.jsonto addsquizlabs/php_codesnifferandfriendsofphp/php-cs-fixeras dev dependencies, and introduced composer scripts for linting and code style checks/fixes, making it easy for developers to run these tools.
Available Commands
- composer run lint - Check violations
- composer run lint:fix - Auto-fix with PHP_CodeSniffer
- composer run cs:check - Dry-run with PHP-CS-Fixer
- composer run cs:fix - Fix with PHP-CS-Fixer