Skip to content
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

Feature Requst: Overwrite File locations #3892

Open
3 tasks done
MakerTim opened this issue Sep 22, 2023 · 1 comment
Open
3 tasks done

Feature Requst: Overwrite File locations #3892

MakerTim opened this issue Sep 22, 2023 · 1 comment

Comments

@MakerTim
Copy link

Context

At places like


we report the full file location.
basepath is a config property that can be used to remove it, but doesn't fully work for this.
In our pipelines we have another path then in develop. And not every developer has the same prefix, nginx/apache locations vary.
So supporting multiple is needed to fix this for us.

To reproduce

In an apache docker container
php cbf
And see a File with /var/www/html/...
In a nginx container /usr/share/nginx/html/...
On bitbucket pipelines /opt/atlassian/pipelines/agent/build/...

The set to support is for us these 3, but currently unable to fix this natively

Work around

is use | sed and remove this prefix, but the substring process makes this process not reliable.

echo '...'.substr($file, ($fileLength - ($width - 6)));

Please confirm:

  • I have searched the issue list and am not opening a duplicate issue.
  • I confirm that this bug is a bug in PHP_CodeSniffer and not in one of the external standards.
  • I have verified the issue still exists in the master branch of PHP_CodeSniffer.
@jrfnl
Copy link
Contributor

jrfnl commented Sep 22, 2023

@MakerTim How are you setting the basepath ?

I normally use the below and would expect that to work exactly like you intend it for the situation you describe:

	<!-- Strip the directory the PHPCS config file lives in from the filepath. -->
	<arg name="basepath" value="./"/>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants