-
-
Notifications
You must be signed in to change notification settings - Fork 37
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
Installing coding standards when executing Composer with --no-scripts #4
Comments
Good to hear you have gotten things to work! In regards to your question, I'm not entirely sure I understand your current situation. Am I correct in assuming your {
"require-dev": {
"squizlabs/php_codesniffer": "^2.7",
"dealerdirect/phpcodesniffer-composer-installer": "^0.2.1",
"frenck/php-compatibility": "^7.1"
},
"scripts": {
"post-install-cmd": [
"# Running incenteev/composer-parameter-handler ...",
"# Clearing cache...",
"phpcs src"
]
}
} You would want to run |
@frenck The most simple way I can think of is to expose the functionality of the plugin directly so it could be called as an (aliased) composer-script command. I've drafted a working example in PR #5. The plugin could be triggered by the following {
"...": {
"...": "..."
},
"scripts": {
"codesniffer": [
"phpcs src"
],
"post-install-cmd": [
"# Running incenteev/composer-parameter-handler ...",
"# Clearing cache...",
"@codesniffer"
],
"run-codesniffer": [
"Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin::run"
"@codesniffer"
]
}
} That way, Thoughts? 1 Although the sniffer could also be run as a separate command in the build, outside of the composer file. |
We have standard scripts definition for Symfony project: {
"scripts": {
"symfony-scripts": [
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
],
"post-install-cmd": [
"@symfony-scripts"
],
"post-update-cmd": [
"@symfony-scripts"
]
}
} And there is Your solution is perfect, I thought about something like that - ability to run For now we have mocked some parameters and polished Gitlab CI configuration so everything is working fine, but this functionality would be great anyway :-) |
Thank you very much, it works as expected 👍 Just as a note, this feature can be used like this:
You can then use Also in Gitlab CI's |
I've successfully integrated your installer and
frenck/php-compatibility
in Symfony application and it works on my localhost. However, when I want to use Gitlab CI it fails, because:incenteev/composer-parameter-handler
for semi-automatic parameters configuration and few of them need to be set in order to work (Gitlab CI works in non-interactive mode and takes all parameters from dist file into final parameters file). Of course I can mock them in dist file, as a workaround--no-scripts
will not trigger parameters handler and other (e.g. cache clearing) but also will not trigger installing PHPCompatibility rule set, so runningphpcs
will fail dueReferenced sniff "PHPCompatibility" does not exist
errorIs there possibility to run some custom Composer command/script and just install PHPCS plugins, without calling other scripts?
Do you have any suggestions how it should be configured and handled?
The text was updated successfully, but these errors were encountered: