WordPress / WordPress/WordPress-Coding-Standards

WordPress standard does not flag syntax issues in IDE, does in Terminal

Open
#2,260 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Type: Question
Dominant language
PHP
Stars
2.8k
Forks
521
Avg merge
5d 20h
Merged PRs (30d)
1

Description

I have a weird issue where after installed WPCS in Sublime Text it does work as expected but does not recognise for example = alignment errors or => alignment errors in the IDE (Neither it beautifies them), but it does recognise wrong indentation for example.

Also it recognises wrong alignments just fine in the terminal.

As an example:

$args = array(
				'post_type' => 'post',
				'posts_per_page' => 1,
				'meta_query' => array(
					array(
						'key' => 'blabla',
						'compare' => 'NOT EXISTS',
					),
				),
				'tax_query' => array(),
				'post_status' => 'publish',
				'orderby' => 'date',
				'order' => 'ASC',
			);

It should, but does not recognise the wrong => alignments. It does recognise them in terminal, weirdly.

Does anyone have a clue why this might be?
As said otherwise WPCS works just fine, it even recognises indentation issues, and beautifier works as well, just that it seems it does not use the full WordPress set, even if I declared it in the IDE Settings.

Ever stranger is that if I pass all subsets in the IDE settings, so not just WordPress but the whole bunch (even if they all should be part of WordPress) like so "--standard": "WordPress-Extra, WordPress-Docs, WordPress-Core, WordPress, WordPress-Core",, then the IDE console tells me ERROR: the " WordPress-Docs" coding standard is not installed. The installed coding standards are MySource, PEAR, PSR1, PSR2, PSR12, Squiz, Zend, WordPress, WordPress-Core, WordPress-Docs and WordPress-Extra

Well... it says WordPress-Docs is not there, but then says it is installed anyway. And, WordPress-Docs is not the one broken, it works just fine.

I have installed WPCS following these steps: https://github.com/WordPress/WordPress-Coding-Standards/issues/2001

Maybe someone can hint me what I am doing wrong?
(PS, in order to not waste the time of devs here, maybe it would be a good idea to open a discussion tab in this git project so users can help users without polluting the issues list?)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the Sublime Text WPCS configuration with the terminal invocation, focusing on the declared --standard value and the installed coding standards shown in the IDE console. Reproduce the example's alignment errors in both environments; done means the IDE applies the same WordPress standard and reports the same alignment issues without claiming an installed standard is missing.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.