{"id":20251738,"url":"https://github.com/maximal/gitlab-code-quality","last_synced_at":"2025-04-10T23:16:22.817Z","repository":{"id":144719695,"uuid":"616400039","full_name":"maximal/gitlab-code-quality","owner":"maximal","description":"GitLab Code Quality generator for PHP and JS projects","archived":false,"fork":false,"pushed_at":"2025-03-15T19:55:56.000Z","size":70,"stargazers_count":6,"open_issues_count":1,"forks_count":1,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-04-10T23:16:15.934Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/maximal.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-03-20T10:12:20.000Z","updated_at":"2025-03-15T19:56:00.000Z","dependencies_parsed_at":null,"dependency_job_id":"1a4bcdf1-bced-4706-a69e-07e2331b1594","html_url":"https://github.com/maximal/gitlab-code-quality","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maximal%2Fgitlab-code-quality","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maximal%2Fgitlab-code-quality/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maximal%2Fgitlab-code-quality/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maximal%2Fgitlab-code-quality/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maximal","download_url":"https://codeload.github.com/maximal/gitlab-code-quality/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248312133,"owners_count":21082638,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-14T10:12:34.840Z","updated_at":"2025-04-10T23:16:22.788Z","avatar_url":"https://github.com/maximal.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GitLab Code Quality generator for PHP and JS projects\n\nThis program generates [Code Climate](https://github.com/codeclimate/platform/blob/master/spec/analyzers/SPEC.md#data-types) report for [GitLab Code Quality widget](https://docs.gitlab.com/ee/ci/testing/code_quality.html#view-code-quality-results) in merge requests and pipelines using various tools and linters:\n* [Psalm](https://psalm.dev/)\n* [PHPStan](https://phpstan.org/)\n* [PHP CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer)\n* [ECS](https://github.com/easy-coding-standard/easy-coding-standard)\n* [ESLint](https://eslint.org/)\n* [StyleLint](https://stylelint.io/)\n* [Biome](https://biomejs.dev/)\n\nThey are automatically detected in the following paths:\n* `vendor/bin/psalm`\n* `vendor/bin/phpstan`\n* `vendor/bin/phpcs`\n* `vendor/bin/ecs`\n* `node_modules/eslint/bin/eslint.js`\n* `node_modules/stylelint/bin/stylelint.mjs`\n* `node_modules/@biomejs/biome/bin/biome`\n\nTwo JS runtimes supported (to run Biome, ESLint, and StyleLint checks):\n* [Bun](https://bun.sh/) (preferred over Node);\n* [Node](https://nodejs.org/en) (used if no Bun executable found).\n\nThe application is written in pure PHP (8.0+) without any framework or library dependencies.\n\n\n## Installation\nInstall the tool via [Composer](https://getcomposer.org/):\n```shell\ncomposer require --dev maximal/gitlab-code-quality\n```\n\nMake the test run:\n```shell\n./vendor/bin/gitlab-code-quality \u003e gl-code-quality-report.json\n```\nNow, you should have `gl-code-quality-report.json` file with all code quality issues found in your project.\n\n\n## Usage\nEdit your GitLab CI/CD config to have `code_quality` step, which runs this tool.\n\nExample `.gitlab-ci.yml` file:\n```yaml\n# ... ... ...\n\n# GitLab Code Quality Widget\n# https://docs.gitlab.com/ee/ci/testing/code_quality.html#view-code-quality-results\ncode_quality:\n  stage: test\n  script:\n    - ./vendor/bin/gitlab-code-quality \u003e gl-code-quality-report.json\n  artifacts:\n    reports:\n      codequality: gl-code-quality-report.json\n    expire_in: 1 month\n    paths: [gl-code-quality-report.json]\n\n# ... ... ...\n```\n\n\n### Strict Mode\nBy default, the tool returns non-zero exit code (1) only if critical errors are found. For example, on PHP syntax parsing errors (the code cannot be executed at all). This is considered a non-strict behavior.\n\nAlthough, you can harden issue handling and have non-zero exit code (2) if any issues are found:\n```shell\n./vendor/bin/gitlab-code-quality --strict \u003e gl-code-quality-report.json\n```\n\nIn strict mode, code quality stage will fail CI/CD pipeline even on minor issues.\n\n\n## Configuration\nCode quality tools are detected automatically and run with their default config files.\nYou can override this behavior in `extra` section of your project’s `composer.json` file:\n```json5\n{\n\t// composer.json\n\t// ... ... ...\n\t\"extra\": {\n\t\t// GitLab Code Quality report settings with their default values\n\t\t// All the paths and filenames are relative to the root of the project\n\t\t\"gitlab-code-quality\": {\n\t\t\t// Directory for PHP checks/linters\n\t\t\t\"php-dir\": \".\",\n\t\t\t// Directory for JS checks/linters\n\t\t\t\"js-dir\": \"resources\",\n\t\t\t// Paths above are typical for Laravel projects\n\t\t\t// Print issue statistics table to STDERR (`false` to only print issues JSON to STDOUT)\n\t\t\t\"stats\": true,\n\t\t\t// Print last issue location for every issue type in statistics table:\n\t\t\t// `false` or `\"no\"` — do not print\n\t\t\t// `true` or `\"yes\"` — print\n\t\t\t// `\"single\"` (default) — print only if the issue is the only one of its class\n\t\t\t\"last\": \"single\",\n\t\t\t// Run Psalm and PHP CodeSniffer with `--no-cache` and ECX with `--clear-cache`\n\t\t\t\"cache\": false,\n\t\t\t// Strict mode:\n\t\t\t// `false` to return non-zero exit code only if critical errors are found (for example, PHP parsing errors)\n\t\t\t// `true` to return non-zero exit code if any issues are found\n\t\t\t\"strict\": false,\n\n\t\t\t// Run Psalm if it exists in `vendor/bin`\n\t\t\t\"psalm\": true,\n\t\t\t// Psalm config file path\n\t\t\t\"psalm-config\": \"psalm.xml\",\n\n\t\t\t// Run PHPStan if it exists in `vendor/bin`\n\t\t\t\"phpstan\": true,\n\t\t\t// PHPStan config file path\n\t\t\t\"phpstan-config\": \"phpstan.neon\",\n\n\t\t\t// Run PHP CodeSniffer if it exists in `vendor/bin`\n\t\t\t\"phpcs\": true,\n\t\t\t// PHP CodeSniffer standard (name or path to rules file)\n\t\t\t\"phpcs-standard\": \"PSR12\",\n\n\t\t\t// Run ECS (Easy Coding Standard) if it exists in `vendor/bin`\n\t\t\t\"ecs\": true,\n\t\t\t// ECS config file path\n\t\t\t\"ecs-config\": \"ecs.php\",\n\n\t\t\t// Bun executable for EsLint and StyleLint (preferred over Node)\n\t\t\t\"bun\": \"bun\",\n\t\t\t// Node executable for EsLint and StyleLint (used if no Bun found)\n\t\t\t\"node\": \"node\",\n\n\t\t\t// Run ESLint if it exists in `node_modules/eslint/bin/eslint.js`\n\t\t\t\"eslint\": true,\n\t\t\t// ESLint config file\n\t\t\t\"eslint-config\": \".eslintrc.yml\",\n\n\t\t\t// Run StyleLint if it exists in `node_modules/stylelint/bin/stylelint.mjs`\n\t\t\t\"stylelint\": true,\n\t\t\t// StyleLint config file\n\t\t\t\"stylelint-config\": \".stylelintrc.yml\",\n\t\t\t// Files to check glob pattern for StyleLint\n\t\t\t\"stylelint-files\": \"resources/**/*.{css,scss,sass,vue}\",\n\n\t\t\t// Run Biome if it exists in `node_modules/@biomejs/biome/bin/biome`\n\t\t\t\"biome\": true,\n\t\t\t// Biome config file\n\t\t\t\"biome-config\": \"biome.jsonc\"\n\t\t}\n\t},\n\t// ... ... ...\n}\n```\n\nIn most cases you only need to specify `php-dir` and `js-dir` paths. For example:\n```json5\n{\n\t// composer.json\n\t// ... ... ...\n\t\"require-dev\": {\n\t\t// ...\n\t\t\"maximal/gitlab-code-quality\": \"^1.0\",\n\t\t// ...\n\t},\n\t// ... ... ...\n\t\"extra\": {\n\t\t\"gitlab-code-quality\": {\n\t\t\t// Run all quality tools if they exist,\n\t\t\t// considering that PHP files are located in `app` directory\n\t\t\t// and JS files are located in `frontend` directory\n\t\t\t\"php-dir\": \"app\",\n\t\t\t\"js-dir\": \"frontend\",\n\t\t}\n\t},\n\t// ... ... ...\n}\n```\n\nIn an ordinary [Laravel](https://laravel.com/) project this tool runs in zero-config way with Laravel’s default paths (`php-dir` is `.` and `js-dir` is `resourses`):\n```json5\n{\n\t// composer.json\n\t// ... ... ...\n\t\"require-dev\": {\n\t\t// ...\n\t\t\"maximal/gitlab-code-quality\": \"^1.0\",\n\t\t// ...\n\t},\n\t// ... ... ...\n\t\"extra\": {\n\t\t\"laravel\": {\n\t\t\t// ... Laravel’s `dont-discover` and other configs ...\n\t\t},\n\t\t// No `gitlab-code-quality` section\n\t},\n\t// ... ... ...\n}\n```\n\n\n## Coding Style\nPER-2T / PSR-12T (PHP’s standard [PER-2](https://www.php-fig.org/per/coding-style/) / [PSR-12](https://www.php-fig.org/psr/psr-12/) with [SmartTabs](https://www.emacswiki.org/emacs/SmartTabs) instead of spaces).\n\n\n## Author\n* https://github.com/maximal\n* https://maximals.ru/\n* https://sijeko.ru/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaximal%2Fgitlab-code-quality","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaximal%2Fgitlab-code-quality","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaximal%2Fgitlab-code-quality/lists"}