amitaibu / og

A fork to work on OG8
https://github.com/Gizra/og
29 stars 16 forks source link

Configure scrutinizer for coding standards checks #301

Closed pfrenssen closed 8 years ago

pfrenssen commented 8 years ago

Experimenting with Scrutinizer CI. I have set it up in my fork. See the first results here: https://scrutinizer-ci.com/g/pfrenssen/og/?branch=8.x-1.x

amitaibu commented 8 years ago

Cool stuff

On Aug 9, 2016 8:11 PM, "Pieter Frenssen" notifications@github.com wrote:

Experimenting with Scrutinizer CI. I have set it up in my fork. See the first results here: https://scrutinizer-ci.com/g/

pfrenssen/og/?branch=8.x-1.x

You can view, comment on, or merge this pull request online at:

https://github.com/amitaibu/og/pull/301 Commit Summary

  • Configure scrutinizer for coding standards checks.

File Changes

Patch Links:

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/amitaibu/og/pull/301, or mute the thread https://github.com/notifications/unsubscribe-auth/AAHrCxQVSDKLaPhYypn7tuIeAPOjt24gks5qeLNkgaJpZM4JgTWa .

pfrenssen commented 8 years ago

Little update about how this is going: configuring Scrutinizer CI is not really straightforward. It does a lot of checks which are nonsensical for a Drupal project. These can be filtered out by clicking in the UI, but it does not seem to be possible to configure this in the .scrutinizer.yml file.

It also seems to mark all tests as green, since it considers our current code quality to be "good enough". There is some documentation about how to mark a build as failed (https://scrutinizer-ci.com/docs/configuration/build_status) - looking into that now to mark any PHPCS error as a failure.

pfrenssen commented 8 years ago

I'm not going to continue to try to get Scrutinizer to conform to our standards. It really tries hard to autoconfigure things so it can give some recommendations. I cannot seem to disable it after trying for hours.

I've now tried a different service: ContinuousPHP, it literally took 5 minutes to configure it, and it's working out of the box: it is checking coding standards and correctly failing the build.

amitaibu commented 8 years ago

Thank you for doing this!

pfrenssen commented 8 years ago

My coding style fixes have introduced some bugs it seems.

@amitaibu I suppose you don't like these kinds of changes:

-    if ($permissions) {
+    if (!empty($permissions)) {

This were suggestions by Scrutinizer CI - if a variable contains an array it suggests to use empty() to check if it is empty, so that the value is not implicitly cast to a boolean. If I remember correctly you prefer the shorter version?

Are there also other cleanups that I have done that you think don't have much value?

My next plans for this PR are:

amitaibu commented 8 years ago

I suppose you don't like these kinds of changes:

Yes, I don't like them, as they might hide errors of wrong initializations of values - I prefer to get an error/ notice - and fix the underlying issue, instead of wrapping all statements with empty().

IMO, don't loose to much time on the rebases - we should use you time and talent on more important issues ;)

pfrenssen commented 8 years ago

Closing in favor of https://github.com/Gizra/og/pull/173