plugin-GoogleAnalyticsImporter icon indicating copy to clipboard operation
plugin-GoogleAnalyticsImporter copied to clipboard

Added test for phpcs

Open AltamashShaikh opened this issue 2 months ago • 4 comments

Description:

Added test for phpcs

Review

AltamashShaikh avatar Apr 09 '24 05:04 AltamashShaikh

@AltamashShaikh I guess it should be better to have a separate action for this. The test yml file can be auto generated with a command. Doing that would throw away the PHPCS part. Also using strict PSR12 won't easily work without introducing braking changes. This is the CS we are currently using for core: https://github.com/matomo-org/matomo/blob/5.x-dev/phpcs.xml Note: We are currently working on enabling a few more rules to get closer to PSR12... At some point we need to create a new repository that holds our PHPCS rules, and maybe even allows to add custom rules in the future. Every repo would than need to require those rules and simply run PHPCS with them.

sgiehl avatar Apr 09 '24 07:04 sgiehl

@AltamashShaikh I guess it should be better to have a separate action for this. The test yml file can be auto generated with a command. Doing that would throw away the PHPCS part. Also using strict PSR12 won't easily work without introducing braking changes. This is the CS we are currently using for core: https://github.com/matomo-org/matomo/blob/5.x-dev/phpcs.xml Note: We are currently working on enabling a few more rules to get closer to PSR12... At some point we need to create a new repository that holds our PHPCS rules, and maybe even allows to add custom rules in the future. Every repo would than need to require those rules and simply run PHPCS with them.

@sgiehl Yes will move to a separate action and as suggested will make the related changes

AltamashShaikh avatar Apr 10 '24 00:04 AltamashShaikh

I would exclude vendor and all the prefixed dependencies from the code check, and only apply the action to actual plugin code. As mentioned before in a meeting, and as Stefan also suggests, longterm we should aim at having something like matomo-org/matomo-coding-standards repo that can be shared across core and plugins and cover other areas like JSLint or prettier rules etc., not just PHP. It's a start here though. Github actions can also be reused from other repo, so here we could simply reference the core repo action (check examples in https://docs.github.com/en/actions/using-workflows/reusing-workflows, mainly https://docs.github.com/en/actions/using-workflows/reusing-workflows#calling-a-reusable-workflow).

michalkleiner avatar Apr 23 '24 01:04 michalkleiner

e reused from other repo, so here we could simply reference the core repo action (

@michalkleiner I can try your suggestions and update you accordingly :+1:

AltamashShaikh avatar Apr 29 '24 03:04 AltamashShaikh