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

Autofix using phpcbf (?) #41

Open
soderlind opened this issue Aug 3, 2016 · 1 comment
Open

Autofix using phpcbf (?) #41

soderlind opened this issue Aug 3, 2016 · 1 comment

Comments

@soderlind
Copy link

soderlind commented Aug 3, 2016

Since phpcbf is included, how about adding the option autofix to the config and have phpcbf fix many of the coding standard errors ?

engines:
    phpcodesniffer:
       enabled: true
       config:
          standard: "WordPress-Core"
       autofix: true
@josephdpurcell
Copy link
Contributor

I believe the intention of Code Climate is to focus on analysis and reporting. Modifications to the code being analyzed (to me) seems out of range, but I'm only a spectator in that regard.

That said, I think in order for this to work I could see two options:

  1. Code Climate be given write access to the repository being analyzed and an integration written to create a pull request (or just a branch) that includes the changes.
  2. Code Climate expand the reporting API and instead of just reporting back a status it also includes a link to a diff/patch that the API consumer could download and apply the patch themselves. This would be a safer option than the first.

In any case, my recommendation would be to only use PHPCBF on a local machine and a manual review of the changes be done before committing, as (in my experience) it does not always do the correct refactoring. Consequently, I don't think this is something I would recommend Code Climate supporting at present.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants