dkan icon indicating copy to clipboard operation
dkan copied to clipboard

Add PHPCS to CI pipeline until CodeClimate errors are resolved

Open clayliddell opened this issue 2 years ago • 2 comments

Describe the bug

CodeClimate is displaying errors on all PRs and not providing useful feedback.

Steps To Reproduce

Create a PR with code changes.

Reccomended Fix

Add PHPCS to the pipeline until we're able to fix CodeClimate.

clayliddell avatar May 23 '22 20:05 clayliddell

Some things I found:

  • composer-installers disallows packages of type npm-asset. Given that this project is a Drupal module meant for a wide audience, we shouldn't be specifying how the npm-asset/select2 package is installed. However, that's a conversation out of scope here. I just removed extra.installer-types.npm-asset.
  • Moving PHPCS behavior out of CodeClimate and into Github Actions is not hard at all. Clicking 'New Action' gave me a handy template which I modified. The phpcs runner lives in composer.json where it's called by the new Github Action.
  • Performing a PHPCS scan of the whole codebase reveals that many files are not up to coding standards. This is an issue because we don't want to change the whole codebase in one go (we could fix many issues with phpcbf). Ideally we'd only scan changed/added files, which remains a little bit of a challenge given resource constraints. We could investigate https://github.com/tj-actions/changed-files and other similar packages which probably exist.
  • We want to be able to show code coverage for tests. One solution to this could be to generate an HTML coverage report. The problem is that dktl does the actual test running, and it generates clover reports. This means either changing dktl, or discovering a way to convert clover to HTML, or perhaps finding a github-native way of displaying this information from an artifact.
  • composer.json is now configured so that packages will be sorted when you require them. :-)

paul-m avatar May 23 '22 23:05 paul-m

Thanks on your work on this @paul-m! Let's discuss after standup today.

clayliddell avatar May 24 '22 14:05 clayliddell

CodeClimate is working now.

paul-m avatar Jan 05 '23 01:01 paul-m