OpenML icon indicating copy to clipboard operation
OpenML copied to clipboard

linitng setup added for PHP

Open naman9271 opened this issue 1 month ago • 0 comments

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 .editorconfig to 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.php configuration 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.xml to 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.json to add squizlabs/php_codesniffer and friendsofphp/php-cs-fixer as 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

naman9271 avatar Nov 15 '25 20:11 naman9271