Wikimate icon indicating copy to clipboard operation
Wikimate copied to clipboard

Add linters or other code checkers

Open waldyrious opened this issue 2 years ago • 4 comments

As mentioned here:

The main standards are the PSRs, and I've looked into some occasionally but am not well versed in any, and am not sure Wikimate even meets the basic coding or PHPDoc standards in all relevant aspects.

It may be worth setting up automated checks for those PSRs or other good practices. I don't know if there are tools that are commonly used/recommended for this type of task in the PHP world, so I'll just leave a few links from a cursory search here, and later we might refine/improve the options.

I also found the Setup PHP action, which appears to be quite popular, but seems like a generic tool to set up an environment to run PHP tasks in GitHub actions. There's also the PHP Actions organization, which appears to contain multiple PHP-related GitHub Actions, but I'm not sure how it relates to the other options listed above.

waldyrious avatar Aug 29 '21 21:08 waldyrious

FYI, I didn't encounter the latter two yet, but giving PHPStan a spin locally was already on my to-do list before we wrap up v1.0. Don't know what to expect of it, or the others, though.

Xymph avatar Aug 29 '21 21:08 Xymph

Cross-referencing #142 and #143.

waldyrious avatar Nov 01 '21 23:11 waldyrious

I gave PHP-CS-Fixer a whirl, but in running a similar PSR-12 check, it adds nothing that PHP_CodeSniffer doesn't already do, while the latter is more informative of how a rules standard isn't met (and leaves any automatic fixes to the separate phpcbf tool). So I removed PHP-CS-Fixer.

Xymph avatar Nov 02 '21 17:11 Xymph

Apparently the super-linter action supports PHP linters. It might be an easier way to set this up.

waldyrious avatar Jul 21 '23 10:07 waldyrious