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

Codacy fails to run PHPCS #955

Closed
MathieuLamiot opened this issue Jan 15, 2025 · 7 comments · Fixed by #964
Closed

Codacy fails to run PHPCS #955

MathieuLamiot opened this issue Jan 15, 2025 · 7 comments · Fixed by #964
Assignees

Comments

@MathieuLamiot
Copy link
Contributor

Context
On Codacy, the PHPCS analysis fails. For instance, go here and click the "1 problem" button: https://app.codacy.com/gh/wp-media/imagify-plugin/commits/411070d11c010900e4342e428bc3b4688284339a/issues

The logs say:

KubernetesDockerRunner: Container for codacy/codacy-codesniffer:2.6.10 exited with non-zero code 1
Error executing the tool
java.lang.Exception: 
CodeSniffer exited with code 3
stdout: ERROR: Ruleset invalid. Property "customPropertiesWhitelist" does not exist on sniff WordPress.NamingConventions.ValidVariableName

Run "phpcs --help" for usage information

stderr: 
                
	at codacy.codesniffer.CodeSniffer$.$anonfun$apply$1(CodeSniffer.scala:55)
	at scala.util.Try$.apply(Try.scala:217)
	at codacy.codesniffer.CodeSniffer$.apply(CodeSniffer.scala:29)
	at com.codacy.tools.scala.seed.DockerEngine.executeTool(DockerEngine.scala:53)
	at com.codacy.tools.scala.seed.DockerEngine.$anonfun$main$2(DockerEngine.scala:35)
	at scala.util.Success.map(Try.scala:270)
	at com.codacy.tools.scala.seed.DockerEngine.$anonfun$main$1(DockerEngine.scala:27)
	at scala.util.Success.flatMap(Try.scala:266)
	at com.codacy.tools.scala.seed.DockerEngine.main(DockerEngine.scala:26)
	at codacy.Engine.main(Engine.scala)

It seems to be an issue with Property "customPropertiesWhitelist" does not exist on sniff WordPress.NamingConventions.ValidVariableName, maybe from our phpcs.xml?

Expected behavior
Codacy checks must run without issues.

Acceptance Criteria

  • Create a PR.
  • Find it on Codacy and check that no problems are reported.

Additional information
Asking ChatGPT, customPropertiesWhitelist might be deprecated and replaced with propertiesToCheck

@remyperona
Copy link
Contributor

Do we need to run PHPCS on Codacy, since we already do it directly in GH?

@MathieuLamiot
Copy link
Contributor Author

Not necessarily, I can deactivate it for now. However, it seems weird that we have this error on Imagify and not WP Rocket 🤔

@MathieuLamiot
Copy link
Contributor Author

PHPCS is deactivated on Codacy now. Let's see if the analysis works as expected now, and it would be good to understand the root cause of this.

@remyperona
Copy link
Contributor

customPropertiesWhitelist was replaced by allowed_custom_properties in WPCS 3.0.

It's something that never popped-up in WP Rocket because we never used it.

We can update the configuration to fix the deprecation, might be a good time to review all its content too, as it has not been updated often.

@remyperona
Copy link
Contributor

Update on this, the WPCS version used on Imagify was still 2.3.

After updating to 3 and and fixing the configuration, we have new violations to handle, I'm looking into it.

@remyperona remyperona linked a pull request Feb 4, 2025 that will close this issue
3 tasks
@wordpressfan
Copy link
Contributor

We will merge this into develop and with the next release we will do QA there because here we touched everything in the plugin.

@remyperona
Copy link
Contributor

There is no need for QA on the currently open PR, it is specifically focused on style changes that have no impact on functionality of the plugin

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

Successfully merging a pull request may close this issue.

3 participants