{"id":13852332,"url":"https://github.com/mglaman/drupal-check","last_synced_at":"2025-05-14T09:07:59.736Z","repository":{"id":34361098,"uuid":"170727577","full_name":"mglaman/drupal-check","owner":"mglaman","description":"Check Drupal code for deprecations and discover bugs via static analysis","archived":false,"fork":false,"pushed_at":"2024-12-12T19:31:06.000Z","size":1797,"stargazers_count":334,"open_issues_count":31,"forks_count":68,"subscribers_count":10,"default_branch":"main","last_synced_at":"2025-04-11T04:08:46.852Z","etag":null,"topics":["drupal","drupal-8","hacktoberfest","phpstan"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mglaman.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"mglaman","patreon":null,"open_collective":"phpstan-drupal","tidelift":"packagist/mglaman/drupal-check","ko_fi":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2019-02-14T17:06:00.000Z","updated_at":"2025-01-09T13:25:53.000Z","dependencies_parsed_at":"2024-06-18T10:55:55.880Z","dependency_job_id":"73402a46-6010-4e80-9c1c-11ead3be0149","html_url":"https://github.com/mglaman/drupal-check","commit_stats":{"total_commits":205,"total_committers":27,"mean_commits":7.592592592592593,"dds":0.2731707317073171,"last_synced_commit":"7dbd731f744882fb0d043be3644950e96e124f11"},"previous_names":[],"tags_count":33,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mglaman%2Fdrupal-check","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mglaman%2Fdrupal-check/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mglaman%2Fdrupal-check/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mglaman%2Fdrupal-check/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mglaman","download_url":"https://codeload.github.com/mglaman/drupal-check/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254110374,"owners_count":22016391,"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":["drupal","drupal-8","hacktoberfest","phpstan"],"created_at":"2024-08-04T22:01:15.743Z","updated_at":"2025-05-14T09:07:58.036Z","avatar_url":"https://github.com/mglaman.png","language":"PHP","readme":"# drupal-check [![Build](https://github.com/mglaman/drupal-check/actions/workflows/php.yml/badge.svg)](https://github.com/mglaman/drupal-check/actions/workflows/php.yml) [![CircleCI](https://circleci.com/gh/mglaman/drupal-check.svg?style=svg)](https://circleci.com/gh/mglaman/drupal-check) [![Latest release](https://img.shields.io/github/release/mglaman/drupal-check.svg)](https://github.com/mglaman/drupal-check/releases/latest)\n\nBuilt on [PHPStan](https://github.com/phpstan/phpstan), this static analysis tool will check for correctness (e.g. using a class that doesn't exist), deprecation errors, and more.\n\nWhy? While there are many static analysis tools out there, none of them run with the Drupal context in mind. This allows checking contrib modules for deprecation errors thrown by core.\n\nAre you ready for Drupal 9? Check out our [Drupal 9 Readiness](https://github.com/mglaman/drupal-check/wiki/Drupal-9-Readiness) instructions for details on how this tool can help.\n\n## Sponsors\n\n\u003ca href=\"https://www.undpaul.de/\"\u003e\u003cimg src=\"https://www.undpaul.de/themes/custom/undpaul3/logo.svg\" alt=\"undpaul\" width=\"250\" /\u003e\u003c/a\u003e \u003ca href=\"https://www.optasy.com/\"\u003e\u003cimg src=\"https://www.optasy.com/images/logo.svg\" alt=\"undpaul\" width=\"200\" /\u003e\u003c/a\u003e\n\n[Would you like to sponsor?](https://github.com/sponsors/mglaman)\n\n## Requirements\n\n* PHP \u003e=7.2\n\n## Installation\n\nYou can install this in your project using Composer as a development dependency like so:\n\n```\ncomposer require mglaman/drupal-check --dev\n```\n\nYou can also install this globally using Composer like so:\n\n```\ncomposer global require mglaman/drupal-check\n```\n\nRefer to Composer's documentation on how to ensure global binaries are in your PATH: https://getcomposer.org/doc/00-intro.md#manual-installation.\n\n## Usage\n\n```\nphp vendor/bin/drupal-check [options] [--] \u003cpath\u003e...\n```\nArguments:\n* `path` - The Drupal code path(s) to inspect\n\nOptions:\n* `--drupal-root[=DRUPAL-ROOT]` - Path to Drupal root.\n* `--format[=FORMAT]` - Formatter to use: raw, table, checkstyle, json, or junit [default: \"table\"]\n* `-d, --deprecations` - Check for deprecations\n* `-a, --analysis` - Check code analysis\n* `-s, --style` - Check code style\n* `--php8` - Set PHPStan phpVersion for 8.1 (Drupal 10 requirement)\n* `--memory-limit[=MEMORY-LIMIT]` - Memory limit for analysis\n* `-e, --exclude-dir[=EXCLUDE-DIR]` - Directories to exclude. Separate multiple directories with a comma, no spaces.\n* `--no-progress` - Do not show progress bar, only results\n* `-h, --help` - Display this help message\n* `-q, --quiet` - Do not output any message\n* `-V, --version` - Display this application version\n* `--ansi` - Force ANSI output\n* `--no-ansi` - Disable ANSI output\n* `-n, --no-interaction` - Do not ask any interactive question\n* `-v|vv|vvv, --verbose` - Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug\n\nExamples:\n\n* Check the address contrib module:\n\n```\nphp vendor/bin/drupal-check web/modules/contrib/address\n```\n\n* Check the address contrib module for deprecations:\n\n```\nphp vendor/bin/drupal-check -d web/modules/contrib/address\n```\n\n* Check the address contrib module for analysis:\n\n```\nphp vendor/bin/drupal-check -a web/modules/contrib/address\n```\n\n## Rollback update to PHPStan level 2 for deprecation analysis\n\ndrupal-check:1.4.0 set PHPStan's analysis level to 2 for deprecations and 6 for analysis. This ensures basic analysis\nerrors are fixed to provide the best deprecated code detection experience. You can read more about PHPStan's rule\nlevels here: https://phpstan.org/user-guide/rule-levels\n\nIf you do not want to run PHPStan at level 2 and only report deprecation messages, use the following instructions\n\n```shell\ncomposer remove mglaman/drupal-check\ncomposer require  --dev phpstan/phpstan \\\n  phpstan/extension-installer \\\n  mglaman/phpstan-drupal \\\n  phpstan/phpstan-deprecation-rules\n```\n\nCreate a `phpstan.neon` file with the following:\n\n```neon\nparameters:\n\tcustomRulesetUsed: true\n\tignoreErrors:\n\t\t- '#\\Drupal calls should be avoided in classes, use dependency injection instead#'\n\t\t- '#Plugin definitions cannot be altered.#'\n\t\t- '#Missing cache backend declaration for performance.#'\n\t\t- '#Plugin manager has cache backend specified but does not declare cache tags.#'\n\n\t# FROM mglaman/drupal-check/phpstan/base_config.neon\n\treportUnmatchedIgnoredErrors: false\n\texcludePaths:\n\t\t- */tests/Drupal/Tests/Listeners/Legacy/*\n\t\t- */tests/fixtures/*.php\n\t\t- */settings*.php\n\t\t- */bower_components/*\n\t\t- */node_modules/*\n```\n\nYou can copy this from the Upgrade Status module directly https://git.drupalcode.org/project/upgrade_status/-/blob/8.x-3.x/deprecation_testing_template.neon\n\n## Drupal Check - VS Code Extension\n\nYou can run Drupal Check from VSCode using this extension: https://marketplace.visualstudio.com/items?itemName=bbeversdorf.drupal-check\n\nThe code can be found at: https://github.com/bbeversdorf/vscode-drupal-check\n\n## License\n\n[GPL v2](LICENSE.txt)\n\n## Issues\n\nSubmit issues and feature requests here: https://github.com/mglaman/drupal-check/issues.\n\n### Known Issues\n\nThere are conflicts with dependencies shared with other libraries that might be installed on a Drupal project:\n\n* This tool does not work with BLT 9: https://github.com/mglaman/drupal-check/issues/9\n* If you run into issues with other libraries, please submit an issue to this project.\n\n## Contributing\n\nSee the [CONTRIBUTING.md](CONTRIBUTING.md).\n\n## References\n\n* [Writing better Drupal code with static analysis using PHPStan](https://glamanate.com/blog/writing-better-drupal-code-static-analysis-using-phpstan)\n* [PHPStan: Find Bugs In Your Code Without Writing Tests!](https://medium.com/@ondrejmirtes/phpstan-2939cd0ad0e3)\n* [Online PHPStan Analyzer](https://phpstan.org/)\n\n","funding_links":["https://github.com/sponsors/mglaman","https://opencollective.com/phpstan-drupal","https://tidelift.com/funding/github/packagist/mglaman/drupal-check"],"categories":["PHP","CLI Tools \u0026 Frameworks"],"sub_categories":["Code Review \u0026 CI/CD Tools"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmglaman%2Fdrupal-check","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmglaman%2Fdrupal-check","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmglaman%2Fdrupal-check/lists"}