openml / openml/OpenML

Add Comprehensive Code Quality Tools(PHPStan,Psalm,PHP-CS-Fixer)

Open
#1,272 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
755
Forks
128
PR merge metrics
No merged PRs in 30d

Description

Description

Problem

The current PHP codebase lacks modern static analysis and code-quality enforcement. This causes:

Inconsistent code style across the project

Missed type and logic errors that static analysis could catch early

Harder onboarding for new contributors

No automated checks in CI/CD to prevent regressions

Proposed solution

Integrate the following tools:

PHPStan (level 5+) — catch type errors and bugs

Psalm — complementary static analysis with optional security checks

PHP-CS-Fixer — automatically fix code style to follow PSR-12

PHPMD — detect code smells and complexity issues

Steps/Code to Reproduce

Implementation plan

1. Repo files (examples)
.phpstan.neon

parameters:
    level: 5
    paths:
        - openml_OS
    excludePaths:
        - openml_OS/libraries/*
        - openml_OS/third_party/*

.php-cs-fixer.php

<?php
$config = new PhpCsFixer\Config();
return $config
    ->setRules([
        '@PSR12' => true,
        '@PHP80Migration' => true,
        'array_syntax' => ['syntax' => 'short'],
    ])
    ->setFinder(
        PhpCsFixer\Finder::create()
            ->in('openml_OS')
            ->exclude(['libraries', 'third_party'])
    );

psalm.xml (minimal starter)

<?xml version="1.0"?>
<psalm errorLevel="5">
  <projectFiles>
    <directory name="openml_OS"/>
    <exclude name="openml_OS/libraries"/>
    <exclude name="openml_OS/third_party"/>
  </projectFiles>
</psalm>

2. composer.json scripts
Add dev dependencies and useful scripts:

{
  "require-dev": {
    "phpstan/phpstan": "^1.12",
    "vimeo/psalm": "^5.0",
    "friendsofphp/php-cs-fixer": "^3.0",
    "phpmd/phpmd": "^2.10"
  },
  "scripts": {
    "cs:check": "php-cs-fixer fix --dry-run --diff",
    "cs:fix": "php-cs-fixer fix",
    "phpstan": "phpstan analyse -c .phpstan.neon",
    "psalm": "psalm --output-format=summary",
    "phpmd": "phpmd openml_OS text codesize,unusedcode,naming"
  }
}

3. CI / GitHub Actions
Example /.github/workflows/ci-quality.yml:

name: PHP Quality Checks

on:
  pull_request:
  push:
    branches: [ main ]

jobs:
  quality:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Setup PHP
        uses: shivammathur/setup-php@v2
        with:
          php-version: 8.2
          extensions: mbstring, intl
      - name: Install composer deps
        run: composer install --prefer-dist --no-progress --no-suggest
      - name: PHP-CS-Fixer (check)
        run: composer run cs:check
      - name: PHPStan
        run: composer run phpstan
      - name: Psalm
        run: composer run psalm
      - name: PHPMD
        run: composer run phpmd

4. Onboarding & rollout

Add the config files to repo root.

Add the composer dev dependencies and scripts.

Add the GitHub Actions workflow above.

Run composer run cs:fix once on a branch to apply auto-fixes; commit changes in a single formatting PR.

Optionally run PHPStan/Psalm with --level=0 or --showProgress and gradually raise to level 5 while fixing issues.

Document developer steps in CONTRIBUTING.md.

Expected Results

Consistent PSR-12 formatting enforced automatically.

Early detection of type and security issues.

CI prevents regressions.

Faster, easier onboarding and safer refactors.

Actual Results

(No changes yet — this issue requests the integration.)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing composer.json, the proposed .phpstan.neon, .php-cs-fixer.php, psalm.xml, and .github/workflows/ci-quality.yml targets. Then inspect CONTRIBUTING.md and the openml_OS, libraries, and third_party paths to confirm the analysis scope and exclusions. Done means the four tools are configured, composer scripts and CI checks run successfully, and developer steps are documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions, php
Domain
ci-cd, developer-experience, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.