{"id":13758635,"url":"https://github.com/joonty/vim-phpqa","last_synced_at":"2025-04-05T11:23:49.518Z","repository":{"id":2828365,"uuid":"3830779","full_name":"joonty/vim-phpqa","owner":"joonty","description":"PHP QA tools for Vim","archived":false,"fork":false,"pushed_at":"2018-04-10T12:01:13.000Z","size":322,"stargazers_count":290,"open_issues_count":12,"forks_count":31,"subscribers_count":20,"default_branch":"master","last_synced_at":"2025-02-10T22:26:02.901Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://www.joncairns.com","language":"VimL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/joonty.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-03-26T08:11:49.000Z","updated_at":"2024-05-31T04:16:31.000Z","dependencies_parsed_at":"2022-08-26T06:52:16.345Z","dependency_job_id":null,"html_url":"https://github.com/joonty/vim-phpqa","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joonty%2Fvim-phpqa","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joonty%2Fvim-phpqa/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joonty%2Fvim-phpqa/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joonty%2Fvim-phpqa/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/joonty","download_url":"https://codeload.github.com/joonty/vim-phpqa/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247327192,"owners_count":20920991,"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-08-03T13:00:33.984Z","updated_at":"2025-04-05T11:23:49.486Z","avatar_url":"https://github.com/joonty.png","language":"VimL","funding_links":[],"categories":["Ferramentas"],"sub_categories":[],"readme":"# PHP QA Tools For Vim\n\nThis is a plugin for Vim that integrates PHP quality checking tools, to allow you to code to a particular standard and easily spot errors and violations.\n\nIt uses PHP linter to check for syntax errors, and integrates with [PHP Code Sniffer][1] and [PHP Mess Detector][2] to check for coding standard violations, and shows code coverage from clover XML files.\n\n### Quick Guide\n\nThe plugin is configured by default to automatically run the QA tools when a PHP file is saved. Therefore, save a file and the linter will run. If there is a syntax error, the offending line will be highlighted. Plus, a [quickfix][3] window opens to show the error and it's position in the file.\n\nIf there are no syntax errors, PHP Code Sniffer and Mess Detector will run. These will require some configuration to fit your needs, which you can read about under the \"Configuration\" heading. The output of these two commands are combined, and the file is highlighted with the occurences. Again, a quickfix window opens, showing the violations and allowing you to navigate through them.\n\nYou can toggle markers with the following commands (in command mode):\n\n```vim\n\u003cLeader\u003eqa\t\" Show/hide code sniffer and mess detector violations\n\u003cLeader\u003eqc\t\" Show/hide code coverage markers\n```\n\nWhat's the `\u003cLeader\u003e` key? It's likely to be either `\\` or `,`, but you can set it from the command line or in your *.vimrc* file using:\n\n```vim\nlet mapleader=\"@\"\n```\n\nor whatever you want it to be.\n\nYou can also run each command separately on demand:\n\n- `:Php` - check for syntax errors\n- `:Phpcs` - run code sniffer\n- `:Phpmd` - run mess detector (will ask for a rule XML file if not set) \n- `:Phpcc` - show code coverage (will ask for a clover XML file if not set)\n\n### Code Coverage\n\nIf you generate clover code coverage reports with your tests, you can toggle markers to show which lines are covered and which aren't. You can run the command once using `Phpcc` as shown above, or you can configure it to load the markers every time you open a new file - see the configuration section for more information.\n\nYou can also toggle code coverage (to stop it automatically running on opening a file) with:\n\n```vim\n\u003cLeader\u003eqc\n```\n\n### Installation\n\nInstallation is easy-peasy if you're using [Vundle][4]. Just add this to your *.vimrc* file:\n\n```vim\nBundle 'joonty/vim-phpqa.git'\n```\nand run `vim +BundleInstall +qall` from a terminal.\n\nIf you aren't using vundle, you will have to extract the files in each folder to the correct folder in *.vim/*.\n\n**Note:** your Vim installation must be compiled with *signs* for this plugin to work. If you want to use code coverage support you will need to have Vim compiled with Python.\n\n### Configuration\n\nEach command has it's own configuration settings, which allow you to get the functionality you want.\n\n#### PHP, Mess Detector and Codesniffer\n\nPHP mess detector needs a ruleset XML file (see the [mess detector website][2] for more information) to run, which you will be prompted for the first time the command runs. However, it's much easier to just specify it in your *.vimrc* file:\n\n```vim\nlet g:phpqa_messdetector_ruleset = \"/path/to/phpmd.xml\"\n```\n\nFor PHP code sniffer, you can pass arguments to the command line binary (run `phpcs --help` to see a list). For example:\n\n```vim\n\" Set the codesniffer args\nlet g:phpqa_codesniffer_args = \"--standard=Zend\"\n```\n\nHowever, **don't** set the `--report=` argument, as it won't work!\n\nFor all the commands, you can override the executable:\n\n```vim\n\" PHP executable (default = \"php\")\nlet g:phpqa_php_cmd='/path/to/php'\n\n\" PHP Code Sniffer binary (default = \"phpcs\")\nlet g:phpqa_codesniffer_cmd='/path/to/phpcs'\n\n\" PHP Mess Detector binary (default = \"phpmd\")\nlet g:phpqa_messdetector_cmd='/path/to/phpmd'\n```\nHowever, you don't need to do this if the commands `php`, `phpcs` and `phpmd` are can be found in your `$PATH` environment variable.\n\nAnd you can stop them running automatically:\n\n```vim\n\" Don't run messdetector on save (default = 1)\nlet g:phpqa_messdetector_autorun = 0\n\n\" Don't run codesniffer on save (default = 1)\nlet g:phpqa_codesniffer_autorun = 0\n\n\" Show code coverage on load (default = 0)\nlet g:phpqa_codecoverage_autorun = 1\n```\n\nBy default, the location list window will open when mess detector/codesniffer violations are found. You can stop this happening by setting this option:\n\n```vim\n\" Stop the location list opening automatically\nlet g:phpqa_open_loc = 0\n```\n\n#### Code Coverage Configuration\n\nFor code coverage, you can specify a clover XML file to stop the prompt appearing each time, and choose to only show markers for lines that aren't covered - by default both covered and uncovered code have markers. Not showing covered line markers is likely to speed things up noticeably when moving between files.\n\n```vim\n\" Clover code coverage XML file\nlet g:phpqa_codecoverage_file = \"/path/to/clover.xml\"\n\" Show markers for lines that ARE covered by tests (default = 1)\nlet g:phpqa_codecoverage_showcovered = 0\n```\n\n### Acknowlegements\n\nThis plugin **originally** reused and modified a lot of the code from the Vim [QuickHigh plugin][5], written by Brian Medley. Although this plugin no longer uses any of that code, my thanks goes to Brian for the work that's gone into that script.\n\n### License\n\nThis plugin is released under the [MIT License][6].\n\n\n[1]: http://pear.php.net/package/PHP_CodeSniffer/redirected\n[2]: http://phpmd.org/\n[3]: http://vimdoc.sourceforge.net/htmldoc/quickfix.html\n[4]: https://github.com/gmarik/vundle\n[5]: http://www.vim.org/scripts/script.php?script_id=124\n[6]: https://github.com/joonty/vim-phpqa/raw/master/LICENSE\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoonty%2Fvim-phpqa","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjoonty%2Fvim-phpqa","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoonty%2Fvim-phpqa/lists"}