-
Notifications
You must be signed in to change notification settings - Fork 23
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
Minor project style improvements #129
base: 1.5.x
Are you sure you want to change the base?
Conversation
if("cli" !== php_sapi_name()) { | ||
use Doctrine\SqlFormatter\SqlFormatter; | ||
|
||
if('cli' !== php_sapi_name()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This kind of CS change should be handled by PHPCS. Can we please configure PHPCS so that it runs on the files you've changed here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@greg0ire you are an CI expect, might I know why the phpcs is not working for examples/ and for bin/?
examples/ - they are added in https://github.com/doctrine/sql-formatter/blob/e1e39d8f4c/phpcs.xml.dist#L22 and ending with .php
, but it seems they are completely ignored as for ex. constants like in https://github.com/doctrine/sql-formatter/blob/e1e39d8f4c/examples/cli.php#L10 are not added to uses.
bin/ - the file does not end with .php
but a full path is specified - it seems ignored currently as well as I would expect the php_sapi_name()
in https://github.com/doctrine/sql-formatter/blob/e1e39d8f4c/bin/sql-formatter#L6 to be replaced with a constant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It works, it's just that you did not spot
Lines 25 to 36 in 7c0096a
<rule ref="Generic.Files.InlineHTML"> | |
<exclude-pattern>examples/*.php</exclude-pattern> | |
<exclude-pattern>tests/performance.php</exclude-pattern> | |
</rule> | |
<!-- The sniff does not detect usages for some reason --> | |
<rule ref="SlevomatCodingStandard.Namespaces.UnusedUses"> | |
<exclude-pattern>examples/*.php</exclude-pattern> | |
</rule> | |
<!-- The sniff attempts to badly format templating syntax end blocks --> | |
<rule ref="SlevomatCodingStandard.ControlStructures.BlockControlStructureSpacing.IncorrectLinesCountAfterControlStructure"> | |
<exclude-pattern>examples/*.php</exclude-pattern> | |
</rule> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I spot the config but found UnusedUses
rule not relevant...
So in examples/
- InlineHTML
is still preventing any CS rules when a single inline HTML/PHP is found?
And in bin/
the CS rules are still not applied.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well in bin
, there are no files ending with .php
🤷♂️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
InlineHTML
is still preventing any CS rules when a single inline HTML/PHP is found?
You don't need a working Github CI to figure that out, do you?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well in
bin
, there are no files ending with.php
🤷♂️
In the config, I am using <file>bin/sql-formatter</file>
, so I wonder how to do that, I need a help in this topic, IDK the solution myself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider filing an issue at https://github.com/PHPCSStandards/PHP_CodeSniffer/
a6d0fc9
to
e1e39d8
Compare
30794d6
to
218a72a
Compare
submitting as a separate PR as requested