├── .alexignore ├── .editorconfig ├── .github ├── ISSUE_TEMPLATE.md ├── PULL_REQUEST_TEMPLATE.md └── dependabot.yml ├── .gitignore ├── .noninteractive ├── .remarkrc ├── .spelling ├── .travis.yml ├── .yamllint ├── CONTRIBUTING.md ├── LICENSE.md ├── README.md ├── bin ├── install.sh └── install.sh.sig ├── composer.json ├── grumphp.yml └── package.json /.alexignore: -------------------------------------------------------------------------------- 1 | CONTRIBUTING.md 2 | vendor/* 3 | node_modules/* 4 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | end_of_line = lf 6 | indent_style = space 7 | insert_final_newline = true 8 | trim_trailing_whitespace = true 9 | 10 | [*.md] 11 | ident_size = 2 12 | trim_trailing_whitespace = false 13 | 14 | [*.sh] 15 | ident_size = 2 16 | 17 | [*.json] 18 | ident_size = 2 19 | 20 | [{.gitignore,.gitkeep,.editorconfig}] 21 | ident_size = 2 22 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ## Problem/Motivation 2 | 3 | > (Why the issue was filed) 4 | 5 | ## Expected behaviour 6 | 7 | > (What you expected to happen) 8 | 9 | ## Actual behaviour 10 | 11 | > (What actually happened) 12 | 13 | ## Steps to reproduce 14 | 15 | > (How can someone else make/see it happen) 16 | 17 | ## Proposed changes 18 | 19 | > (If you have a proposed change, workaround or fix, describe the rationale behind it) 20 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ## Proposed Changes 2 | 3 | > (Describe the changes and rationale behind them) 4 | 5 | ## Related Issues 6 | 7 | > ([GitHub link](https://help.github.com/articles/autolinked-references-and-urls/) to related issues or pull requests) 8 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # To get started with Dependabot version updates, you'll need to specify which 2 | # package ecosystems to update and where the package manifests are located. 3 | # Please see the documentation for all configuration options: 4 | # https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates 5 | 6 | version: 2 7 | updates: 8 | - package-ecosystem: "composer" # See documentation for possible values 9 | directory: "/" # Location of package manifests 10 | schedule: 11 | interval: "daily" 12 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | vendor/ 3 | composer.lock 4 | npm-debug.log 5 | yarn.lock 6 | -------------------------------------------------------------------------------- /.noninteractive: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dealerdirect/php-qa-tools/f648a6c56c2d87dc2d1078f897fda7533627f7db/.noninteractive -------------------------------------------------------------------------------- /.remarkrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | "remark-preset-lint-dealerdirect" 4 | ], 5 | "plugins": { 6 | "validate-links": { 7 | } 8 | }, 9 | "settings": { 10 | "commonmark": true, 11 | "gfm": true, 12 | "yaml": true, 13 | "rule": "-", 14 | "ruleSpaces": false, 15 | "ruleRepetition": 70, 16 | "emphasis": "*", 17 | "listItemIndent": "1", 18 | "incrementListMarker": false, 19 | "spacedTable": false 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /.spelling: -------------------------------------------------------------------------------- 1 | B.V. 2 | Dealerdirect 3 | sublicense 4 | 5 | - ./.github/ISSUE_TEMPLATE.md 6 | behaviour 7 | 8 | - ./.github/PULL_REQUEST_TEMPLATE.md 9 | GitHub 10 | 11 | - ./CONTRIBUTING.md 12 | dealerdirect.nl. 13 | http 14 | opensource 15 | sexualized 16 | 17 | - ./README.md 18 | _CodeBrowser 19 | _CodeCoverage 20 | _CodeSniffer 21 | _Depend 22 | _eyes 23 | api 24 | ApiGen 25 | Behat 26 | codebase 27 | Codeception 28 | Deployer 29 | dealerdirect.com 30 | devops 31 | frontend 32 | Githooks 33 | Goutte 34 | GrumPHP 35 | https 36 | Linters 37 | metapackage 38 | Nijhof 39 | ParaTest 40 | Phing 41 | Phinx 42 | PHPCompatibility 43 | phpcov 44 | phpDocumentor 45 | phpDox 46 | PhpMetrics 47 | PHPUnit 48 | Sami 49 | Selenium2 50 | SensioLabs 51 | versioning 52 | WebDriver 53 | workingatdealerdirect.eu 54 | PHP_CodeSniffer 55 | PHP_Depend 56 | PHP_CodeSniffer 57 | PHP_CodeBrowser 58 | PHP_CodeCoverage 59 | heart_eyes 60 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | --- 2 | language: php 3 | sudo: required 4 | 5 | php: 6 | - 7.3 7 | - 7.2 8 | - 7.1 9 | 10 | env: 11 | global: 12 | - PATH="${HOME}/bin:${PATH}" 13 | - SHELLCHECK_URL="https://s3.amazonaws.com/travis-blue-public/binaries/ubuntu/14.04/x86_64/shellcheck-0.4.5.tar.bz2" 14 | 15 | cache: 16 | directories: 17 | - "${HOME}/bin" 18 | - "${HOME}/.composer/cache/files" 19 | - "${HOME}/.npm" 20 | - "${HOME}/.yarn-cache" 21 | 22 | before_install: 23 | - travis_retry gpg --keyserver hkp://subset.pool.sks-keyservers.net --recv-keys C4133165DF5EB4BAEABDADCACF1E7823C5339B59 24 | - npm set loglevel error 25 | - npm set progress false 26 | 27 | install: 28 | - sudo pip install yamllint 29 | - if ! shellcheck --version ; then 30 | curl -sSL "${SHELLCHECK_URL}" | tar --exclude 'SHA256SUMS' --strip-components=1 -C "${HOME}/bin" -xjf -; 31 | fi 32 | - shellcheck --version 33 | - npm install -g yarn 34 | - npm install -g jsonlint 35 | 36 | script: 37 | - find . -type f -name "*.yml" -print0 | xargs -0 -n1 yamllint 38 | - find . -type f -name "*.json" -print0 | xargs -0 -n1 jsonlint -q 39 | - gpg --verify ./bin/install.sh.sig 40 | - shellcheck ./bin/install.sh 41 | - composer validate 42 | - travis_wait 45 composer install --no-progress --no-suggest 43 | - yarn install --no-progress 44 | - yarn run test 45 | - ./vendor/bin/codecept --version 46 | - ./vendor/bin/composer -V 47 | - ./vendor/bin/dep -V 48 | - ./vendor/bin/grumphp --version 49 | - ./vendor/bin/jsonlint -h 50 | - ./vendor/bin/parallel-lint -h 51 | - ./vendor/bin/paratest --version 52 | - ./vendor/bin/pdepend --version 53 | - ./vendor/bin/phinx --version 54 | - ./vendor/bin/php-cs-fixer --version 55 | - ./vendor/bin/phpcbf --version 56 | - ./vendor/bin/phpcpd --version 57 | - ./vendor/bin/phpcs --version 58 | - ./vendor/bin/phploc --version 59 | - ./vendor/bin/phpmd --version 60 | - ./vendor/bin/phpmetrics --version 61 | - ./vendor/bin/phpunit --version 62 | - ./vendor/bin/security-checker --version 63 | - ./vendor/bin/tombstone --version 64 | -------------------------------------------------------------------------------- /.yamllint: -------------------------------------------------------------------------------- 1 | --- 2 | rules: 3 | braces: 4 | level: error 5 | min-spaces-inside: 0 6 | max-spaces-inside: 1 7 | min-spaces-inside-empty: -1 8 | max-spaces-inside-empty: -1 9 | brackets: 10 | level: error 11 | min-spaces-inside: 0 12 | max-spaces-inside: 0 13 | min-spaces-inside-empty: -1 14 | max-spaces-inside-empty: -1 15 | colons: 16 | level: error 17 | max-spaces-before: 0 18 | max-spaces-after: 1 19 | commas: 20 | level: error 21 | max-spaces-before: 0 22 | min-spaces-after: 1 23 | max-spaces-after: 1 24 | comments: 25 | level: error 26 | require-starting-space: true 27 | min-spaces-from-content: 2 28 | comments-indentation: 29 | level: error 30 | document-end: 31 | level: error 32 | present: false 33 | document-start: 34 | level: error 35 | present: true 36 | empty-lines: 37 | level: error 38 | max: 1 39 | max-start: 0 40 | max-end: 1 41 | hyphens: 42 | level: error 43 | max-spaces-after: 1 44 | indentation: 45 | level: error 46 | spaces: 2 47 | indent-sequences: true 48 | check-multi-line-strings: false 49 | key-duplicates: 50 | level: error 51 | line-length: 52 | level: warning 53 | max: 120 54 | allow-non-breakable-words: true 55 | allow-non-breakable-inline-mappings: true 56 | new-line-at-end-of-file: 57 | level: error 58 | new-lines: 59 | level: error 60 | type: unix 61 | trailing-spaces: 62 | level: error 63 | truthy: 64 | level: error 65 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | When contributing to this repository, please first discuss the change you wish 4 | to make via issue, email, or any other method with the owners of this repository 5 | before making a change. 6 | 7 | Please note we have a code of conduct, please follow it in all your interactions 8 | with the project. 9 | 10 | ## Issues and feature requests 11 | 12 | You've found a bug in the source code, a mistake in the documentation or maybe 13 | you'd like a new feature? You can help us by submitting an issue to our 14 | [GitHub Repository][github]. Before you create an issue, make sure you search 15 | the archive, maybe your question was already answered. 16 | 17 | Even better: You could submit a pull request with a fix / new feature! 18 | 19 | ## Pull request process 20 | 21 | 1. Search our repository for open or closed [pull requests][prs] that relates 22 | to your submission. You don't want to duplicate effort. 23 | 24 | 2. You may merge the pull request in once you have the sign-off of two other 25 | developers, or if you do not have permission to do that, you may request 26 | the second reviewer to merge it for you. 27 | 28 | ## Code of conduct 29 | 30 | ### Our pledge 31 | 32 | In the interest of fostering an open and welcoming environment, we as 33 | contributors and maintainers pledge to making participation in our project and 34 | our community a harassment-free experience for everyone, regardless of age, body 35 | size, disability, ethnicity, gender identity and expression, level of experience, 36 | nationality, personal appearance, race, religion, or sexual identity and 37 | orientation. 38 | 39 | ### Our standards 40 | 41 | Examples of behavior that contributes to creating a positive environment 42 | include: 43 | 44 | - Using welcoming and inclusive language 45 | - Being respectful of differing viewpoints and experiences 46 | - Gracefully accepting constructive criticism 47 | - Focusing on what is best for the community 48 | - Showing empathy towards other community members 49 | 50 | Examples of unacceptable behavior by participants include: 51 | 52 | - The use of sexualized language or imagery and unwelcome sexual attention or advances 53 | - Trolling, insulting/derogatory comments, and personal or political attacks 54 | - Public or private harassment 55 | - Publishing others' private information, such as a physical or electronic address, without explicit permission 56 | - Other conduct which could reasonably be considered inappropriate in a professional setting 57 | 58 | ### Our responsibilities 59 | 60 | Project maintainers are responsible for clarifying the standards of acceptable 61 | behavior and are expected to take appropriate and fair corrective action in 62 | response to any instances of unacceptable behavior. 63 | 64 | Project maintainers have the right and responsibility to remove, edit, or 65 | reject comments, commits, code, wiki edits, issues, and other contributions 66 | that are not aligned to this Code of Conduct, or to ban temporarily or 67 | permanently any contributor for other behaviors that they deem inappropriate, 68 | threatening, offensive, or harmful. 69 | 70 | ### Scope 71 | 72 | This Code of Conduct applies both within project spaces and in public spaces 73 | when an individual is representing the project or its community. Examples of 74 | representing a project or community include using an official project e-mail 75 | address, posting via an official social media account, or acting as an appointed 76 | representative at an online or offline event. Representation of a project may be 77 | further defined and clarified by project maintainers. 78 | 79 | ### Enforcement 80 | 81 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 82 | reported by contacting the project team at opensource@dealerdirect.nl. All 83 | complaints will be reviewed and investigated and will result in a response that 84 | is deemed necessary and appropriate to the circumstances. The project team is 85 | obligated to maintain confidentiality with regard to the reporter of an incident. 86 | Further details of specific enforcement policies may be posted separately. 87 | 88 | Project maintainers who do not follow or enforce the Code of Conduct in good 89 | faith may face temporary or permanent repercussions as determined by other 90 | members of the project's leadership. 91 | 92 | ### Attribution 93 | 94 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], 95 | version 1.4, available at [http://contributor-covenant.org/version/1/4][version] 96 | 97 | [homepage]: http://contributor-covenant.org 98 | [version]: http://contributor-covenant.org/version/1/4/ 99 | [github]: https://github.com/dealerdirect/php-qa-tools/issues 100 | [prs]: https://github.com/dealerdirect/php-qa-tools/pulls 101 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016-2017 Dealerdirect B.V. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Dealerdirect: PHP Quality Assurance Tools 2 | 3 | ![Project Stage][project-stage-shield] 4 | ![Maintenance][maintenance-shield] 5 | ![Awesome][awesome-shield] 6 | [![License][license-shield]](LICENSE.md) 7 | 8 | [![Travis][travis-shield]][travis] 9 | [![Latest Version on Packagist][packagist-version-shield]][packagist-version] 10 | [![Packagist][packagist-shield]][packagist] 11 | 12 | > _“If you don’t have time to do it right you must have time to do it over.”_ 13 | 14 | This is essentially a Composer meta package, creating a fast, easy and 15 | convenient way of installing all PHP Quality Assurance tools. 16 | 17 | ## Contents 18 | 19 | You'll get the following tools by depending on this package: 20 | 21 | ### Linters / Fixers 22 | 23 | - **[JSON Lint][json-lint]**: JSON Lint for PHP 24 | - **[PHP Coding Standards Fixer][phpcs-fixer]**: A tool to automatically fix PHP coding standards issues 25 | - **[PHP Parallel Lint][php-parallel-lint]**: Check syntax of PHP files faster than serial check with fancier output 26 | - **[PHP_CodeSniffer][phpcs]**: Detects violations of a defined set of coding standards 27 | 28 | ### Quality Assistance 29 | 30 | - **[GrumPHP][grumphp]**: Githooks for PHP QA tooling 31 | - **[PHP_Depend][pdepend]**: Software metrics for PHP 32 | - **[PHPCPD][phpcpd]**: Copy/Paste Detector 33 | - **[PHPLOC][phploc]**: Quickly measure the size of a PHP project 34 | - **[PHPMD][phpmd]**: PHP Mess Detector 35 | - **[PhpMetrics][phpmetrics]**: A static analysis tool for PHP 36 | - **[SensioLabs Security Checker][security-checker]**: Checks for dependencies with known security vulnerabilities 37 | 38 | ### Test Related 39 | 40 | - **[Codeception][codeception]**: Modern full-stack testing framework for PHP 41 | - **[ParaTest][paratest]**: Parallel testing for PHPUnit 42 | - **[PHPUnit][phpunit]**: Testing framework for PHP 43 | 44 | ### Other 45 | 46 | Other packages that you'll get: 47 | 48 | - **[Composer Versions Check][versions-check]**: Checks if packages are up to date to last major versions after update 49 | - **[Deployer][deployer]**: Deployment tool for PHP 50 | - **[Deployer Recipes][deployer-recipes]**: Third party recipes to integrate with Deployer 51 | - **[Phinx][phinx]**: Phinx makes it ridiculously easy to manage the database migrations for your PHP app 52 | - **[PHP_CodeSniffer Composer Installer][phpcs-composer-installer]**: For installing PHP_CodeSniffer coding standards 53 | - **[PHPCompatibility][phpcompatibility]**: PHP Compatibility checks for PHP_CodeSniffer 54 | - **[Prestissimo][prestissimo]**: Composer parallel install plugin 55 | - **[Tombstone Analyzer][tombstone-analyzer]**: Report generation for Tombstones 56 | 57 | ## Suggested 58 | 59 | The following packages are suggested: 60 | 61 | - **[Behat][behat]**: Scenario-oriented BDD framework 62 | - **[ApiGen][apigen]**: Smart and Readable Documentation for your PHP project 63 | - **[Mockery][mockery]**: A simple yet flexible PHP mock object framework 64 | - **[PHP_CodeBrowser][php-codebrowser]**: A code browser that augments the code with information from various QA tools 65 | - **[phpcov]**: Command-line frontend for the PHP_CodeCoverage library 66 | - **[phpDocumentor][phpdoc]**: Documentation generator for PHP 67 | - **[phpDox][phpdox]**: Documentation generator for PHP 68 | - **[Sami][sami]**: An API documentation generator 69 | 70 | ## Usage 71 | 72 | This is a simple metapackage which can be used in two different ways; globally installed or on a per project basis. 73 | 74 | Both methods have their strengths (+) and weaknesses (-). 75 | 76 | **Global installation**: 77 | 78 | - \+ All tools are present anywhere on your system 79 | - \+ Can be used on any codebase, even the ones that don't use Composer. 80 | - \- You'll have to update manually, since it's not a project, versioning is not managed. 81 | 82 | **Per project installation**: 83 | 84 | - \+ Versioning (update/installation) is provided in the project 85 | - \- Tools not available system wide. You'll need to run them from a specific path. 86 | 87 | These methods are not mutual exclusive. You can have your global installed version, which can be used anywhere, but 88 | still use the one provided in a project. 89 | 90 | ## Installation 91 | 92 | ### Global installation 93 | 94 | The following script will install a system wide Composer for you, including the QA tools. 95 | 96 | ```bash 97 | bash <(curl -S https://raw.githubusercontent.com/Dealerdirect/php-qa-tools/master/bin/install.sh) 98 | ``` 99 | 100 | That's it. This can be put in any instructions, such as a README or someone's blog, since the logic is in the shell 101 | script. Provided you download the script using https, the file has standard levels of authentication and encryption 102 | protecting it from manipulation. We also sign the install with a GPG key, this way you can check if the downloaded 103 | releases signature matches the public key of Dealerdirect. 104 | 105 | ```bash 106 | gpg --keyserver hkp://keys.gnupg.net --recv-keys C4133165DF5EB4BAEABDADCACF1E7823C5339B59 107 | curl -O https://raw.githubusercontent.com/Dealerdirect/php-qa-tools/master/bin/install.sh 108 | curl -O https://raw.githubusercontent.com/Dealerdirect/php-qa-tools/master/bin/install.sh.sig 109 | gpg --verify install.sh.sig 110 | bash install.sh 111 | ``` 112 | 113 | This is obviously a shell script, if you're really concerned about the argument that it may contain nefarious 114 | activities within, you can easily review it before you run it. 115 | 116 | ```bash 117 | curl -O https://raw.githubusercontent.com/Dealerdirect/php-qa-tools/master/bin/install.sh 118 | less install.sh 119 | bash instal.sh 120 | ``` 121 | 122 | If you already have a global Composer setup, you could include the tools manually, without the need for running 123 | the shell script above. 124 | 125 | ```bash 126 | composer global require "dealerdirect/qa-tools:*" 127 | ``` 128 | 129 | #### Per project installation 130 | 131 | The other option is to install this on a per project basis. 132 | 133 | Using Composer (preferred method): 134 | 135 | ```bash 136 | composer require --dev "dealerdirect/qa-tools" 137 | ``` 138 | 139 | Or modify your `composer.json` to include `dealerdirect/qa-tools` in the `require-dev` sections: 140 | 141 | ```json 142 | { 143 | "name": "acme/my-project", 144 | "require": { 145 | "…": "*" 146 | }, 147 | "require-dev": { 148 | "dealerdirect/qa-tools": "*" 149 | } 150 | } 151 | ``` 152 | 153 | ## Contributing 154 | 155 | This is an active open-source project. We are always open to people who want to 156 | use the code or contribute to it. 157 | 158 | We've set up a separate document for our [contribution guidelines](CONTRIBUTING.md). 159 | 160 | Thank you for being involved! :heart_eyes: 161 | 162 | ## Authors & contributors 163 | 164 | The original idea and setup of this repository is by [Franck Nijhof][frenck], employee @ Dealerdirect. 165 | 166 | For a full list off all author and/or contributors, check [the contributors page][contributors]. 167 | 168 | ## Working @ Dealerdirect 169 | 170 | Dealerdirect is always on the looking for energetic and hard working developers 171 | and devops engineers. 172 | 173 | Interested in working at Dealerdirect? 174 | Then please be sure to check out [our vacancies][vacancies]. 175 | 176 | Did not find a matching vacancy? Just [get in touch][get-in-touch]! 177 | 178 | [dealerdirect.com][dealerdirectcom] 179 | 180 | ## License 181 | 182 | The MIT License (MIT) 183 | 184 | Copyright (c) 2016-2018 Dealerdirect B.V. 185 | 186 | Permission is hereby granted, free of charge, to any person obtaining a copy 187 | of this software and associated documentation files (the "Software"), to deal 188 | in the Software without restriction, including without limitation the rights 189 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 190 | copies of the Software, and to permit persons to whom the Software is 191 | furnished to do so, subject to the following conditions: 192 | 193 | The above copyright notice and this permission notice shall be included in 194 | all copies or substantial portions of the Software. 195 | 196 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 197 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 198 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 199 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 200 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 201 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 202 | THE SOFTWARE. 203 | 204 | [apigen]: http://www.apigen.org 205 | [awesome-shield]: https://img.shields.io/badge/awesome%3F-yes-brightgreen.svg 206 | [behat]: http://behat.org 207 | [codeception]: http://codeception.com 208 | [contributors]: https://github.com/dealerdirect/php-qa-tools/graphs/contributors 209 | [dealerdirectcom]: http://www.dealerdirect.com/en 210 | [deployer-recipes]: https://github.com/deployphp/recipes 211 | [deployer]: https://deployer.org 212 | [frenck]: https://github.com/frenck 213 | [get-in-touch]: https://www.dealerdirect.com/en/contact 214 | [grumphp]: https://github.com/phpro/grumphp 215 | [json-lint]: https://github.com/Seldaek/jsonlint 216 | [license-shield]: https://img.shields.io/github/license/dealerdirect/php-qa-tools.svg 217 | [maintenance-shield]: https://img.shields.io/maintenance/yes/2019.svg 218 | [mockery]: https://github.com/padraic/mockery 219 | [packagist-shield]: https://img.shields.io/packagist/dt/dealerdirect/qa-tools.svg 220 | [packagist-version-shield]: https://img.shields.io/packagist/v/dealerdirect/qa-tools.svg 221 | [packagist-version]: https://packagist.org/packages/dealerdirect/qa-tools 222 | [packagist]: https://packagist.org/packages/dealerdirect/qa-tools 223 | [paratest]: https://github.com/brianium/paratest 224 | [pdepend]: https://github.com/pdepend/pdepend 225 | [phinx]: https://phinx.org 226 | [php-codebrowser]: https://github.com/mayflower/PHP_CodeBrowser 227 | [php-parallel-lint]: https://github.com/JakubOnderka/PHP-Parallel-Lint 228 | [phpcompatibility]: https://github.com/PHPCompatibility/PHPCompatibility 229 | [phpcov]: https://github.com/sebastianbergmann/phpcov 230 | [phpcpd]: https://github.com/sebastianbergmann/phpcpd 231 | [phpcs-composer-installer]: https://github.com/Dealerdirect/phpcodesniffer-composer-installer 232 | [phpcs-fixer]: http://cs.sensiolabs.org 233 | [phpcs]: https://github.com/squizlabs/PHP_CodeSniffer 234 | [phpdoc]: https://www.phpdoc.org 235 | [phpdox]: http://phpdox.de 236 | [phploc]: https://github.com/sebastianbergmann/phploc 237 | [phpmd]: https://phpmd.org 238 | [phpmetrics]: http://www.phpmetrics.org 239 | [phpunit]: https://phpunit.de 240 | [prestissimo]: https://github.com/hirak/prestissimo 241 | [project-stage-shield]: https://img.shields.io/badge/Project%20Stage-Development-yellowgreen.svg 242 | [sami]: https://github.com/FriendsOfPHP/sami 243 | [security-checker]: https://security.sensiolabs.org 244 | [tombstone-analyzer]: https://github.com/scheb/tombstone-analyzer 245 | [travis-shield]: https://img.shields.io/travis/Dealerdirect/php-qa-tools.svg 246 | [travis]: https://travis-ci.org/Dealerdirect/php-qa-tools 247 | [vacancies]: https://www.dealerdirect.com/en/vacancies 248 | [versions-check]: https://github.com/Soullivaneuh/composer-versions-check 249 | -------------------------------------------------------------------------------- /bin/install.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # ============================================================================== 3 | # 4 | # Dealerdirect PHP QA Tools Installer 5 | # 6 | # Installs Composer and the Dealerdirect PHP Quality Assurance tools 7 | # globally on your system. 8 | # 9 | # ============================================================================== 10 | # MIT License 11 | # 12 | # Copyright (c) 2016 Dealerdirect B.V. 13 | # 14 | # Permission is hereby granted, free of charge, to any person obtaining a copy 15 | # of this software and associated documentation files (the "Software"), to deal 16 | # in the Software without restriction, including without limitation the rights 17 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 18 | # copies of the Software, and to permit persons to whom the Software is 19 | # furnished to do so, subject to the following conditions: 20 | # 21 | # The above copyright notice and this permission notice shall be included in 22 | # all copies or substantial portions of the Software. 23 | # 24 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 25 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 26 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 27 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 28 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 29 | # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 30 | # IN THE SOFTWARE. 31 | # ============================================================================== 32 | set -o errexit # Exit script when a command exits with non-zero status 33 | set -o nounset # Exit script on use of an undefined variable 34 | set -o pipefail # Return exit status of the last command in the pipe that failed 35 | 36 | # ============================================================================== 37 | # GLOBALS 38 | # ============================================================================== 39 | readonly EX_OK=0 # Successful termination 40 | readonly EX_PHP_NOT_FOUND=3 # PHP was not found 41 | readonly EX_GIT_NOT_FOUND=4 # GIT not found 42 | readonly EX_CURL_NOT_FOUND=5 # curl not found 43 | readonly EX_NET_ERR=6 # Something went wrong during a file download 44 | readonly EX_SIG_MISMATCH=7 # Composer installer signature mismatch 45 | readonly EX_SETUP_ERR=8 # Composer setup failure 46 | 47 | # Temporary directory for storing the Composer setup script 48 | readonly COMPOSER_TMPDIR=$(mktemp -d "/tmp/composer.XXXXXXXXXXXX") 49 | 50 | # ============================================================================== 51 | # UTILITY 52 | # ============================================================================== 53 | 54 | # ------------------------------------------------------------------------------ 55 | # Displays a status message 56 | # Globals: 57 | # None 58 | # Arguments: 59 | # $* Status message to display 60 | # Returns: 61 | # None 62 | # ------------------------------------------------------------------------------ 63 | display_status_message() { 64 | local status=$* 65 | 66 | echo 67 | echo "-----> $*" 68 | echo 69 | } 70 | 71 | # ------------------------------------------------------------------------------ 72 | # Displays a notice 73 | # Globals: 74 | # None 75 | # Arguments: 76 | # $* Notice message to display 77 | # Returns: 78 | # None 79 | # ------------------------------------------------------------------------------ 80 | display_notice_message() { 81 | local status=$* 82 | 83 | echo 84 | echo "NOTICE: $*" 85 | echo 86 | } 87 | 88 | # ------------------------------------------------------------------------------ 89 | # Displays a error message and is able to terminate te script execution 90 | # Globals: 91 | # None 92 | # Arguments: 93 | # $1 Error message 94 | # $2 Exitcode, script will continue execution when omitted 95 | # Returns: 96 | # None 97 | # ------------------------------------------------------------------------------ 98 | display_error_message() { 99 | local status=$1 100 | local exitcode=${2:-0} 101 | 102 | echo >&2 103 | echo " ! ERROR: $status" >&2 104 | echo >&2 105 | 106 | if [[ $exitcode -ne 0 ]]; then 107 | exit "$exitcode" 108 | fi 109 | } 110 | 111 | # ============================================================================== 112 | # SCRIPT LOGIC 113 | # ============================================================================== 114 | 115 | # ------------------------------------------------------------------------------ 116 | # Check if required tools for this script are installed. 117 | # Globals: 118 | # EX_CURL_NOT_FOUND 119 | # EX_GIT_NOT_FOUND 120 | # EX_PHP_NOT_FOUND 121 | # UID 122 | # Arguments: 123 | # None 124 | # Returns: 125 | # None 126 | # ------------------------------------------------------------------------------ 127 | check_runtime_requirements() { 128 | type php > /dev/null 2>&1 || display_error_message \ 129 | 'PHP is not found, installation aborted!' $EX_PHP_NOT_FOUND 130 | type git > /dev/null 2>&1 || display_error_message \ 131 | 'GIT is not found, installation aborted!' $EX_GIT_NOT_FOUND 132 | type curl > /dev/null 2>&1 || display_error_message \ 133 | 'curl is not found, installation aborted!' $EX_CURL_NOT_FOUND 134 | } 135 | 136 | # ------------------------------------------------------------------------------ 137 | # Install composer on this system 138 | # Globals: 139 | # COMPOSER_TMPDIR 140 | # EX_SETUP_ERR 141 | # EX_SIG_MISMATCH 142 | # EX_NET_ERR 143 | # Arguments: 144 | # None 145 | # Returns: 146 | # None 147 | # ------------------------------------------------------------------------------ 148 | install_composer() { 149 | local composer_filename="composer" 150 | local composer_setup="$COMPOSER_TMPDIR/composer-setup.php" 151 | local composer_temp="$COMPOSER_TMPDIR/$composer_filename" 152 | local composer_dest="/usr/local/bin/$composer_filename" 153 | 154 | display_status_message 'Downloading Composer setup' 155 | command curl -o "$composer_setup" 'https://getcomposer.org/installer' || 156 | display_error_message 'Failed downloading Composer installer' $EX_NET_ERR 157 | 158 | display_status_message 'Checking Composer setup signature' 159 | 160 | if [ \ 161 | "$(command curl -S https://composer.github.io/installer.sig)" != \ 162 | "$(command php -r "echo hash_file(\"SHA384\", \"$composer_setup\");")" \ 163 | ]; then 164 | display_error_message \ 165 | 'Invalid composer installer signature' $EX_SIG_MISMATCH 166 | fi 167 | 168 | display_status_message 'Running Composer setup' 169 | command php "$composer_setup" --quiet --filename="$composer_filename" \ 170 | --install-dir="$COMPOSER_TMPDIR" || display_error_message \ 171 | 'Error occured while running Composer setup' $EX_SETUP_ERR 172 | 173 | display_notice_message \ 174 | 'Installing Composer globally. Administrator privileges will be required...' 175 | sudo mv "$composer_temp" "$composer_dest" || 176 | display_error_message \ 177 | "Failed moving Composer to $composer_dest" $EX_SETUP_ERR 178 | 179 | display_status_message 'Composer has been installed.' 180 | } 181 | 182 | # ------------------------------------------------------------------------------ 183 | # Updates a shell profile with extra environment variables. 184 | # Globals: 185 | # COMPOSER_TMPDIR 186 | # HOME 187 | # Arguments: 188 | # $1 Profile file to update 189 | # Returns: 190 | # None 191 | # ------------------------------------------------------------------------------ 192 | update_profile() { 193 | local profile="$HOME/$1" 194 | 195 | display_status_message "Updating profile file '$profile'" 196 | 197 | if [[ ! -f "$profile" ]]; then 198 | command touch "$profile" 199 | fi 200 | 201 | update_profile_export "COMPOSER_HOME" "$HOME/.composer" "$profile" 202 | update_profile_export "PATH" "\$PATH:\$COMPOSER_HOME/vendor/bin" "$profile" 203 | } 204 | 205 | # ------------------------------------------------------------------------------ 206 | # Helper function for ensuring an enviroment variable is exported profile file 207 | # Globals: 208 | # None 209 | # Arguments: 210 | # $1 Enviroment variable name to export 211 | # $2 Value of enviroment variable to export 212 | # $3 Profile file to update 213 | # Returns: 214 | # None 215 | # ------------------------------------------------------------------------------ 216 | update_profile_export() { 217 | local export_line="export ${1}=${2}" 218 | local profile=$3 219 | 220 | if ! grep -q -F "${export_line}" "$profile"; then 221 | echo "$export_line" >> "$profile" 222 | fi 223 | } 224 | 225 | # ------------------------------------------------------------------------------ 226 | # Uses Composer to install the QA tools 227 | # Globals: 228 | # None 229 | # Arguments: 230 | # None 231 | # Returns: 232 | # None 233 | # ------------------------------------------------------------------------------ 234 | install_qa_tools() { 235 | display_status_message \ 236 | 'Installing Composer Prestissimo in order to speed up next steps' 237 | command composer global require 'hirak/prestissimo:^0.3' 238 | 239 | display_status_message 'Installing Dealerdirect PHP QA Tools' 240 | command composer global require 'dealerdirect/qa-tools:*' 241 | 242 | display_status_message 'Removing local Prestissimo dependency' 243 | command composer global remove 'hirak/prestissimo' 244 | } 245 | 246 | # ------------------------------------------------------------------------------ 247 | # Runs Composer updating the QA tools 248 | # Globals: 249 | # None 250 | # Arguments: 251 | # None 252 | # Returns: 253 | # None 254 | # ------------------------------------------------------------------------------ 255 | update_qa_tools() { 256 | display_status_message 'Updating Dealerdirect PHP QA Tools' 257 | command composer global update 'dealerdirect/qa-tools' 258 | } 259 | 260 | # ------------------------------------------------------------------------------ 261 | # Cleanup function after execution is of the script is stopped. (trap) 262 | # Globals: 263 | # COMPOSER_TMPDIR 264 | # Arguments: 265 | # None 266 | # Returns: 267 | # None 268 | # ------------------------------------------------------------------------------ 269 | cleanup() { 270 | command rm -f -r "$COMPOSER_TMPDIR" 271 | } 272 | 273 | # ============================================================================== 274 | # RUN LOGIC 275 | # ------------------------------------------------------------------------------ 276 | # Globals: 277 | # EX_OK 278 | # HOME 279 | # SHELL 280 | # Arguments: 281 | # None 282 | # Returns: 283 | # None 284 | # ------------------------------------------------------------------------------ 285 | main() { 286 | trap cleanup ERR 287 | trap cleanup EXIT 288 | 289 | check_runtime_requirements 290 | type composer > /dev/null 2>&1 || install_composer 291 | 292 | update_profile '.profile' 293 | if [[ "$(basename "$SHELL")" = 'zsh' ]]; then 294 | update_profile '.zprofile' 295 | fi 296 | 297 | if ! grep -q -F "dealerdirect/qa-tools" \ 298 | "$HOME/.composer/composer.json" > /dev/null 2>&1; 299 | then 300 | install_qa_tools 301 | else 302 | update_qa_tools 303 | fi 304 | 305 | display_status_message 'Installation completed.' 306 | 307 | display_notice_message \ 308 | 'Your shell enviroment might have been changed.' \ 309 | 'Please restart your terminal session.' 310 | 311 | exit $EX_OK 312 | } 313 | main 314 | -------------------------------------------------------------------------------- /bin/install.sh.sig: -------------------------------------------------------------------------------- 1 | -----BEGIN PGP SIGNATURE----- 2 | 3 | iQIcBAABCgAGBQJYEe4zAAoJELY9nlxX4qkVWOgQAJ3X9wfOUgkBmXOzdNby/8sF 4 | L75nfahYKHgNpK0uoLDp18w3b9QhbNLDRZTAMpKKtykD8rXZ6zG/2GXvc9XObAf+ 5 | QsTs4fEOsACy/PFHmHpnW2/L+loM7bRanRRWgR30NFQP2sj0DPRBQwNFK0321dem 6 | Cpvp6DKDU+kseAj6yP2qurAmDp8YzwG0qYN+n3dHhhl8XRd6b+hZFcHzqKTLGGpv 7 | tP13jPprOTC0fNDfGYAXiZrjbiC4f6OvcRZid/Kp8dG/H3aGO+JsDFiRqi4KlBYq 8 | fz8XrHKh0LztYBgX3x47qRPOeVpeg1N7aNcpJXnIpwP7vlwBidT50i7Vw354yq7n 9 | HlG0W67W4t3PIE+KoT5bpX3RiIwkyTl9hMVYny2ERmGdeGwiu6OBJb7MtDejElw7 10 | O6UehVgUqZaJaWV/+luQ/OMsJXHEgFVd64BiXEJT+YUpg/s9zFhmNXH8lKkYxuZz 11 | Plx46fIY3PCC1oQaYQ/olQtBIiBP4J8IZcR4ZuN+z5ihuR+51yzHLMGhaiRnzIku 12 | TZfKUkuGdhe4YHng4NIb1weOXzoRaMgYzQkhwCd3zWBli3yhX5atvEi+KD0Wq56Z 13 | shFO5SjSq6Lgmfv8V6SgAy+okxCN9C1KIyoJTEWh3ciUMuzeG2ehqEiMXs6CSHv8 14 | UuSQbq19lh2yFxKYkCmE 15 | =QjAG 16 | -----END PGP SIGNATURE----- 17 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dealerdirect/qa-tools", 3 | "description": "Meta package for installing all PHP QA tools you'll ever need", 4 | "type": "metapackage", 5 | "keywords": [ 6 | "php", 7 | "qa", "quality", "code quality", 8 | "stylecheck", "unittest" 9 | ], 10 | "homepage": "http://workingatdealerdirect.eu", 11 | "license": "MIT", 12 | "authors": [ 13 | { 14 | "name": "Franck Nijhof", 15 | "email": "franck.nijhof@dealerdirect.nl", 16 | "homepage": "http://workingatdealerdirect.eu", 17 | "role": "Developer" 18 | } 19 | ], 20 | "support": { 21 | "email": "opensource@dealerdirect.nl", 22 | "issues": "https://github.com/dealerdirect/php-qa-tools/issues", 23 | "source": "https://github.com/DealerDirect/php-qa-tools" 24 | }, 25 | "require": { 26 | "php": ">=5.6,<8.0-dev", 27 | "brianium/paratest": ">=0.14|^1.0", 28 | "codeception/codeception": "^2.3", 29 | "dealerdirect/phpcodesniffer-composer-installer": "^0.7", 30 | "deployer/deployer": "^4.3", 31 | "deployer/recipes": "^4.0", 32 | "friendsofphp/php-cs-fixer": "^2.8", 33 | "jakub-onderka/php-parallel-lint": ">=0.9.1,<1.0.0", 34 | "pdepend/pdepend": "^2.5", 35 | "phpcompatibility/php-compatibility": "^9.0", 36 | "phploc/phploc": "^4.0", 37 | "phpmd/phpmd": "^2.6.0", 38 | "phpmetrics/phpmetrics": "^2.3.2", 39 | "phpro/grumphp": ">=0.11.0,<1.0.0,!=0.11.4", 40 | "phpunit/phpunit": "^5.7|^6.5", 41 | "robmorgan/phinx": "^0.10", 42 | "scheb/tombstone-analyzer": "^0.3", 43 | "sebastian/phpcpd": "^3.0", 44 | "seld/jsonlint": "^1.6", 45 | "sensiolabs/security-checker": "^5.0", 46 | "sllh/composer-versions-check": "^2.0", 47 | "squizlabs/php_codesniffer": "^3.2" 48 | }, 49 | "suggest": { 50 | "apigen/apigen": "Smart and Readable Documentation for your PHP project.", 51 | "behat/behat": "Scenario-oriented BDD framework", 52 | "mayflower/php-codebrowser": "A code browser that augments the code with information from various QA tools.", 53 | "mockery/mockery": "A simple yet flexible PHP mock object framework", 54 | "phpdocumentor/phpdocumentor": "Documentation generator for PHP.", 55 | "phpunit/phpcov": "Command-line frontend for the PHP_CodeCoverage library", 56 | "sami/sami": "Documentation generator used for Symfony2 docs.", 57 | "theseer/phpdox": "A fast Documentation generator for PHP Code using standard technology (SRC, DOCBLOCK, XML and XSLT) with event based processing." 58 | }, 59 | "config": { 60 | "sort-packages": true 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /grumphp.yml: -------------------------------------------------------------------------------- 1 | --- 2 | parameters: 3 | git_dir: . 4 | bin_dir: vendor/bin 5 | tasks: 6 | jsonlint: 7 | detect_key_conflicts: true 8 | composer: ~ 9 | yamllint: ~ 10 | securitychecker: ~ 11 | git_conflict: ~ 12 | npm_script: 13 | script: "test" 14 | triggered_by: [md] 15 | working_directory: "./" 16 | is_run_task: true 17 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dealerdirect-php-qa-tools", 3 | "version": "0.1.0", 4 | "description": "PHP Composer meta package for installing all PHP QA tools you'll ever need.", 5 | "keywords": [ 6 | "dealerdirect", 7 | "guides" 8 | ], 9 | "author": "Franck Nijhof ", 10 | "homepage": "https://github.com/dealerdirect/php-qa-tools", 11 | "license": "MIT", 12 | "dependencies": { 13 | "alex": "^4.0.1", 14 | "markdown-spellcheck": "^0.11.0", 15 | "remark-cli": "^2.1.0", 16 | "remark-lint": "^5.2.0", 17 | "remark-lint-books-links": "^1.0.0", 18 | "remark-lint-no-empty-sections": "^1.0.0", 19 | "remark-lint-no-url-trailing-slash": "^2.0.0", 20 | "remark-preset-lint-dealerdirect": "^0.1.0", 21 | "remark-validate-links": "^5.0.0" 22 | }, 23 | "scripts": { 24 | "lint:alex": "alex .", 25 | "lint:remark": "remark -f . --ignore-path '.gitignore'", 26 | "lint:spellcheck": "find . -type f -name '*.md' -not -path './CHANGELOG.md' -not -path './node_modules/*' -not -path './vendor/*' -print0 | xargs -0 -n1 mdspell --report --en-us --ignore-numbers --ignore-acronyms", 27 | "lint:spellcheck-interactive": "find . -type f -name '*.md' -not -path './node_modules/*' -not -path './vendor/*' -print0 | xargs -0 -n1 mdspell --en-us --ignore-numbers --ignore-acronyms", 28 | "lint": "yarn run lint:alex && yarn run lint:remark && yarn run lint:spellcheck-interactive", 29 | "test": "yarn run lint:alex && yarn run lint:remark && yarn run lint:spellcheck" 30 | }, 31 | "repository": { 32 | "type": "git", 33 | "url": "git+https://github.com/dealerdirect/php-qa-tools.git" 34 | }, 35 | "bugs": { 36 | "url": "https://github.com/dealerdirect/php-qa-tools/issues" 37 | } 38 | } 39 | --------------------------------------------------------------------------------