Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicitly check for code style compliance against some standard at PR time #270

Closed
gregcorbett opened this issue Feb 10, 2021 · 4 comments
Assignees
Labels
enhancement good first issue Issues that require "minimal" knowledge of the codebase hackathon Issues that could be solved within a day

Comments

@gregcorbett
Copy link
Member

It's not clear to me what codacy and codeclimate are actually using as "the gold standard" of PHP code. Specifying a well known code standard is at least possible in codeclimate.

We also have a PHP Mess Detector config ruleset around (#265), and I like the fact we can use that to configure exceptions for things we are never going to change (variable names like $em for example). But with phpcodesniffer it seems we can aim for a standard, even if it tells us "the code is bad and you should feel bad" all the time. Perhaps another PHP linter / CI platform can do both.

PSR-12: Extended Coding Style is a standard. Other standards may be available.

@gregcorbett gregcorbett added enhancement good first issue Issues that require "minimal" knowledge of the codebase hackathon Issues that could be solved within a day labels Feb 10, 2021
@tofu-rocketry tofu-rocketry self-assigned this Feb 14, 2022
@tofu-rocketry
Copy link
Member

tofu-rocketry commented Feb 14, 2022

#265 has now been merged to give a basic PHP Mess Detector rule set.

PSR-12 seems like a good standard to aim for as a baseline, as it's used by a number of large PHP projects. I suggest we add a simple phpcs.xml for PHP CodeSniffer to check against PSR12 (as the CodeSniffer option is written). Then we have the following to follow up on:

gregcorbett added a commit to gregcorbett/gocdb that referenced this issue May 24, 2022
Correct to PSR-12 code style. See also  GOCDB#270

Co-authored-by: gregcorbett <gregcorbett@users.noreply.github.com>
@gregcorbett
Copy link
Member Author

So after #365, codeSniffer on Codeclimate will check the code against PSR12?

@tofu-rocketry
Copy link
Member

So after #365, codeSniffer on Codeclimate will check the code against PSR12?

Theoretically. It seemed impossible to tell while I was just working on a branch. Might be able to check now.

@tofu-rocketry
Copy link
Member

Ok, Codeclimate knows that the config is coming from a .codeclimate.yml so I guess this is now done.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement good first issue Issues that require "minimal" knowledge of the codebase hackathon Issues that could be solved within a day
Projects
None yet
Development

No branches or pull requests

2 participants