Skip to content

Conversation

@naman9271
Copy link

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 naman9271 changed the title linitng setup added linitng setup added for PHP Nov 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a linting setup for current PHP codebase

1 participant