Semanticmediawiki: Not an entry point..." when using "composer cs-standalone"

Created on 27 Mar 2016  路  10Comments  路  Source: SemanticMediaWiki/SemanticMediaWiki

I want to check the code on style issues, it has been overdue :) I tried several times the last few weeks and wanted to check first if I made any mistakes but it seems things are broken and I am not sure what is going on. Normally I use something like:

vendor/bin/phpcs docs/* includes/* languages/* maintenance/* res/* src/* tests/* --standard=phpcs.xml --extensions=php -s --report=source

But that results in:

image

So I went back to basics and used the original documentation (#899) written by @JeroenDeDauw and used composer cs-standalone but that has the same result. Did I mis something or is this broken?

Tested on MW-1.25.3, MySQL 5.5.47 & PHP 5.5.9

bug infrastructure

Most helpful comment

I've update the description there

All 10 comments

I can confirm this. SemanticMediaWiki.php is being included and then errors out.

I'm not sure what changed. I tried on 2.2 and get the same issue. Perhaps something in Composer changed, or perhaps in PHPCS.

As far as I can tell, that is besides the point. This is about the cs-standalone command. Which is supposed to be runnable without having MediaWiki or SMW installed.

I am trying to get this going again. I can't remember if I ever ran these checks under windows but looking at what is happening it seems that, at least, under windows /vendor/bin/phpcs.bat is generating a invalid path. I echoed "%BIN_TARGET%" % in phpcs.bat:

"C:\Git\CodeViolations\vendor\bin\/../squizlabs/php_codesniffer/scripts/phpcs" docs/* includes/* languages/* maintenance/* res/* src/* tests/* --standard=phpcs.xml --extensions=php -s --report=source

This will result in the message Not an entry point. I will check this under Linux this afternoon before I put any time in trying to get it to work under windows.

Where are /vendor/bin/phpcs.bat and /vendor/bin/phpcs maintained and did they ever change in the beginning of 2016?

I know why it is failing, though do not know what changed and why it worked at some point.

/vendor/bin/phpcs is the entropy point for phpcs that gets installed via Composer. It includes the CodeSniffer/CLI.php entropy point of phpcs itself (also installed via Composer). And this includes the composer autoloader, which then includes the SMW entropy point, which then bails out since MW is not loaded.

I suspect PHPCS used to not include the Composer autoloader... that would explain why it worked before.

Anyway, what you can do is just use your own phpcs version, rather than what SMW installs via Composer.

curl -OL https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar
php phpcs.phar src/* includes/* tests/* --standard=phpcs.xml --extensions=php -sp

Ok, that works, thanks.

Can this be closed?

When you ask me, yes. I can work with the above solution but it is up to @JeroenDeDauw to give the final verdict because it does not work anymore like described in #899.

I've update the description there

Was this page helpful?
0 / 5 - 0 ratings

Related issues

OyvindLGjesdal picture OyvindLGjesdal  路  3Comments

mwjames picture mwjames  路  3Comments

simontaurus picture simontaurus  路  3Comments

alex-mashin picture alex-mashin  路  4Comments

akuckartz picture akuckartz  路  3Comments