{"action":"opened","issue":{"url":"https://api.github.com/repos/doctrine/dbal/issues/2917","repository_url":"https://api.github.com/repos/doctrine/dbal","labels_url":"https://api.github.com/repos/doctrine/dbal/issues/2917/labels{/name}","comments_url":"https://api.github.com/repos/doctrine/dbal/issues/2917/comments","events_url":"https://api.github.com/repos/doctrine/dbal/issues/2917/events","html_url":"https://github.com/doctrine/dbal/issues/2917","id":274557422,"number":2917,"title":"Incremental check for coding standards in pull requests","user":{"login":"morozov","id":59683,"avatar_url":"https://avatars1.githubusercontent.com/u/59683?v=4","gravatar_id":"","url":"https://api.github.com/users/morozov","html_url":"https://github.com/morozov","followers_url":"https://api.github.com/users/morozov/followers","following_url":"https://api.github.com/users/morozov/following{/other_user}","gists_url":"https://api.github.com/users/morozov/gists{/gist_id}","starred_url":"https://api.github.com/users/morozov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/morozov/subscriptions","organizations_url":"https://api.github.com/users/morozov/orgs","repos_url":"https://api.github.com/users/morozov/repos","events_url":"https://api.github.com/users/morozov/events{/privacy}","received_events_url":"https://api.github.com/users/morozov/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-11-16T15:30:39Z","updated_at":"2017-11-16T15:30:39Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"The existing approach of running `phpcs` over the entire codebase on pull requests is not really helpful because:\r\n\r\n1. The build stage [always fails](https://travis-ci.org/doctrine/dbal/jobs/289967293) due to existing standard violations.\r\n2. Therefore, there's a waste of time of developers and reviewers on manually finding and additionally fixing violations.\r\n3. If not found/fixed, new violations are introduced. It's a vicious circle.\r\n4. Without proper automation, many new contributors (including myself until recently) don't know that the project has its own custom coding standards.\r\n\r\nIncremental checks could be done using [morozov/diff-sniffer-pull-request](https://github.com/morozov/diff-sniffer-pull-request) like following:\r\n```\r\n# assuming we're in the dbal repo with installed dependencies\r\n$ wget https://github.com/morozov/diff-sniffer-pull-request/releases/download/3.0.0/pull-request.phar\r\n$ php pull-request.phar doctrine dbal 2494 --standard=vendor/doctrine/coding-standard/lib/Doctrine\r\n\r\nFILE: lib/Doctrine/DBAL/Driver/SQLSrv/SQLSrvStatement.php\r\n-------------------------------------------------------------------------------\r\nFOUND 4 ERRORS AFFECTING 2 LINES\r\n-------------------------------------------------------------------------------\r\n 203 | ERROR | [x] There must be a single space before a NOT operator; 0 found\r\n 203 | ERROR | [x] There must be a single space after a NOT operator; 0 found\r\n 210 | ERROR | [x] There must be a single space before a NOT operator; 0 found\r\n 210 | ERROR | [x] There must be a single space after a NOT operator; 0 found\r\n-------------------------------------------------------------------------------\r\nPHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY\r\n-------------------------------------------------------------------------------\r\n\r\n\r\nFILE: tests/Doctrine/Tests/DBAL/Functional/Driver/SQLSrv/StatementTest.php\r\n------------------------------------------------------------------------------\r\nFOUND 4 ERRORS AFFECTING 2 LINES\r\n------------------------------------------------------------------------------\r\n 12 | ERROR | [x] There must be a single space before a NOT operator; 0 found\r\n 12 | ERROR | [x] There must be a single space after a NOT operator; 0 found\r\n 18 | ERROR | [x] There must be a single space before a NOT operator; 0 found\r\n 18 | ERROR | [x] There must be a single space after a NOT operator; 0 found\r\n------------------------------------------------------------------------------\r\nPHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY\r\n------------------------------------------------------------------------------\r\n```\r\n\r\nOn Travis CI, it could be a [conditional build job](https://docs.travis-ci.com/user/conditional-builds-stages-jobs/#Conditional-Stages) which is only executed for pull requests.\r\n\r\nAnyone volunteers to implement?"}}
{"actor":{"display_login":"morozov"}}