Closed (fixed)
Project:
Drupal core
Version:
8.5.x-dev
Component:
base system
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
14 Jun 2017 at 21:50 UTC
Updated:
29 Nov 2017 at 03:09 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
GrandmaGlassesRopeManDon't need that extra space.
Comment #3
dawehnerI think this is a great idea, it's just one thing less to learn about, and instead you can just use it.
Comment #4
wim leers❤️❤️❤️
Comment #5
dawehnerI really like the general direction!
Without this adaption:
With this adaption:
Comment #7
alexpottThere is similar work in #2902381: Revert phpcs.xml.dist changes from "Ensure that we're using the right ruleset for coding standards checking" - i think we need to borrow from that and add the option
--runtime-set installed_paths $(pwd)/../vendor/drupal/coder/coder_snifferto both commands. This ensures that the correct ruleset will be used.One problem with this approach is that it assumes the location of vendor :( not sure yet how to get around that.
Comment #8
alexpottHere's a fix that addresses #7.
Comment #9
wim leersManually tested, works great. I think this is ready?
Comment #10
neclimdulThat vendor export trick is #$%^ing awesome! I don't know that people do weird things with vendor other than in Drupal otherwise I'd suggest you should make that into a package people can steal. :-D
Comment #11
chi commentedAnother trick to get vendor root.
Comment #12
alexpott@Chi that's not just another way - that's a better way! Thanks. Added @Chi to the issue credit.
Comment #13
neclimdulmind blown.
Comment #14
dawehnerNice!
Comment #15
wim leersLove the enthusiasm and collaboration here!
Comment #16
mile23Add
-psto thephpcscommand line please, so we're not staring at an unmoving screen for 10 minutes and don't have info about which sniffs are failing.Doesn't work from contrib, but the history is that it's not supposed to. :-)
Comment #17
dawehnerThat's a good idea!
Comment #18
wim leersFor those like me who don't know what
-psdoes:Makes sense!
Comment #19
mile23phpcbf doesn't have -ps. :-)
Comment #20
wim leers#19: that is … unexpected.
Comment #21
alexpott@Mile23 what does
mean?
With the current command I can do
composer run-script phpcs ./modules/redirectand it works just fine.+1 to adding -ps to the phpcs command since you can't add them yourself. You get a
[Symfony\Component\Console\Exception\RuntimeException] The "-p" option does not exist..Comment #22
mile23True, but then if the module has a phpcs.xml(.dist) then you're not honoring it. For instance:
This is fine, as far as I'm concerned, and shouldn't hold up this issue. Having a one-liner that you don't have to think too much about for running phpcs in core is the goal here. Examples (or other contrib) could roll their own phpcs composer command if they wanted.
Comment #23
dawehneroops, I guess I should have tried both commands :)
Comment #24
dawehnerDo you know of a page where best practises like that for module authors are documented? This could be really useful/powerful.
Comment #25
mile23More research needed. Looks doubtful, actually. Changing to the module directory and then saying
composer run someScriptworks, butcomposer config vendor-dironly gives a relative path, so we can't resolve it for core'svendor/directory.Contrib authors can say
--runtime-seton the command line, just like the testbot.Everything else looks good.
Comment #26
neclimdulCan I request we remove the progress and document how you can provide them to the composer script? You can add arguments but you can't take them away.
Comment #27
dawehner@neclimdul
What is the usecase of not having process? As far as I understand you could do
-qon CI environments.Comment #28
alexpottIn my mind these shortcuts are for humans and not CI scripts.
Comment #29
chi commentedIt worth mentioning that these options can be hardcoded in phpcs.xml.dist like follows
<arg value="ps"/>.Comment #30
dawehnerI agree with @alexpott, we should optimize for the common usecase. You probably configure a CI system way less often, than typing things into your shell.
Comment #31
woprrr commented+1 I agree with @alexpott too !! Great initiative :)
Comment #32
neclimdulI've to this day never run the progress with the sole exception of testing cases for related issues and don't plan on adding it to my usage since i'm just going to minimize the console and do something else until its done. Its just adding junk to my terminal backlog. So not my common use case and I do wonder if -q breaks the ability to use other tags. It definitely breaks the ability to use -v per the argument documentation.
In any case I'm happy to get this in and unblock other issues and deal with the side effects elsewhere.
Comment #33
zaporylieReally like this issue and hope #23 can get in soon.
RTBC +1
Comment #34
effulgentsia commentedI discussed this with @xjm and @catch.
We feel that adding the
-psoptions into this patch is out of scope and there isn't consensus on it per #26. #21 gives a good reason to add it by claiming that it can't be added after the fact on the command line but #26 contradicts that.Is #26 accurate that there is a reasonable way to add the
-psoptions yourself on the command line? If so, can we remove them from this patch and have a follow-up issue to discuss adding them?Comment #35
zaporylieAddressing #34
Yes,
composer phpcs -- -psworks like a charm.Comment #36
zaporylieOne last thing - should we also change
process timeoutin composer.json (i.e. https://getcomposer.org/doc/06-config.md#process-timeout)? It defaults to 300 seconds which may be not enough to run full core test and results with:Asking because I have experienced it today 😃
Comment #37
andypostMaybe it needs mention in README or change record to announce?
Comment #38
wim leers#37: +1: done!
Comment #39
mile23I guess
composer phpcs -- -psis better than adding--runtime-setor whatever else.There's no appropriate readme-esque text in core where we can document this.
Comment #40
neclimdulIt is in the help though which is where I found it.
Unfortunately the phpcs arguments are still obfuscated so you have to look that up.
I think this is RTBC worthy personally but I don't know if we need to address #36 here.
Comment #41
zaporylieTo be fair, #36 have happened because I had xdebug installed and active. With xdebug off single phpcs run takes only 20% of the time when xdebug is on (~80s rather than ~400 on my machine).
Comment #42
neclimdulsounds like a docbook entry then. "hey, if you run into this you might want to disable xdebug or adjust the timeout entry in your php.ini"
Comment #43
effulgentsia commentedThanks. Looks great to me. Ticking credit boxes for reviewers.
Comment #45
effulgentsia commentedPushed to 8.5.x. If anyone wants to open a followup to add back in the
-psinto composer.json or an issue on how to document how each user can do so on the command line, please go for it.Comment #46
wim leers🎉🎶
Comment #47
andypostWhy there's no change record? Also it probably need to be added to 8.5 release notes
Comment #48
effulgentsia commentedThis issue is already tagged "8.5.0 highlights" which I think is the correct tag per #2840392-85: Enable BigPipe by default in the Standard install profile.
A new change record might be helpful to some people. And/or, https://www.drupal.org/node/2839574 could use an update to reflect the new best-practice way to use it for 8.5. Anyone up for doing either or both?
Comment #49
tim.plunkettThis does not work when composer is installed via homebrew.
It fails to set $COMPOSER_BINARY to anything, and tries to work from the
/drupal/coder/coder_snifferdirectory.export COMPOSER_BINARY=`which composer`does not help.Getting a composer.phar into my D8 directory, this does work:
php composer.phar phpcs -- -pComment #50
neclimdulyeah, setting the environment wouldn't help because the variable is still going to be set in php.
Based on the fact that you're executing composer and the error is complaining about composer.phar, it seems the composer binary(composer.phar in this case) is not executable and homebrew is using some sort of wrapper script. That's both kinda odd and kind of curious since composer.phar is its own wrapper. Can you chmod the phar and see what happens? Also should we open a new issue to support homebrew's edge case?