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

Basepath option to show relative path names in report output #470

Closed
Hounddog opened this issue Feb 2, 2015 · 11 comments
Closed

Basepath option to show relative path names in report output #470

Hounddog opened this issue Feb 2, 2015 · 11 comments

Comments

@Hounddog
Copy link

Hounddog commented Feb 2, 2015

I am currently running php_codesniffer on jenkins with a vagrant-aws plugin.
When i run phpcs on the vagrant box and generate the report i get a fullpath starting at /vagrant/src/...

Once i copy this back to jenkins however the path doesnt match anymore.

Is there a way to generate reports with a base path or relative path?

@aik099
Copy link
Contributor

aik099 commented Feb 2, 2015

How come, that you generate report on one machine and use it on another machine?

@Hounddog
Copy link
Author

Hounddog commented Feb 2, 2015

As mentioned i use jenkins. I set up the test environment using vagrant-aws and also generate all the reports on the "vagrant" machine and then just syncronize the reports back to the host. This way i dont have to install any dependencies on jenkins and can keep my whole development/test environment boxed.

@gsherwood
Copy link
Member

There is no base path setting. Have you tried just passing a relative path to phpcs?

phpcs temp.php --report-file=./report.txt

@gsherwood
Copy link
Member

Oh sorry, I think I misunderstood what you are asking.

If you mean: can the report output contain a relative path instead of an absolute path to the files

The answer is: no

Your best option right now is to generate the file and then run a command over it to replace the /vagrant/src/... bit with whatever prefix you need for the other machine.

@Hounddog
Copy link
Author

Hounddog commented Feb 2, 2015

i figured as much. Would be great to generate it relative or absolute or with an own base path. Thanks for the quick reply though

@gsherwood gsherwood changed the title Basepath Basepath options to show relative path names in report output Feb 2, 2015
@gsherwood gsherwood changed the title Basepath options to show relative path names in report output Basepath option to show relative path names in report output Feb 2, 2015
@gsherwood
Copy link
Member

Thanks for clarifying for me. Seems like a good feature request.

@muffl0n
Copy link

muffl0n commented Mar 20, 2015

@Hounddog, like mentioned in #522 the violations plugin in jenkins works perfectly with absolute paths and even refuses to display the file content when I use relative paths. Maybe you have to modify your reports with a script after you moved them from your VM to your jenkins machine?

@aik099
Copy link
Contributor

aik099 commented Mar 20, 2015

Maybe instead you need to have some kind of report file transformation script that would fix paths as needed by machine that reads the report.

gsherwood added a commit that referenced this issue Dec 21, 2015
@gsherwood
Copy link
Member

I've added this option in. You can use --basepath=<basepath> to have a path stripped from the front of file paths output to reports and in debug output. The path can be absolute or relative to the current dir.

A handy settings is: --basepath=.

@GaryJones
Copy link
Contributor

GaryJones commented Feb 11, 2017

@gsherwood Would it be possible to add this to the 2.x branch?

@gsherwood
Copy link
Member

@gsherwood Would it be possible to add this to the 2.x branch?

It is possible, but I don't have the time to backport features from 3.x. I'm trying to move towards a 3.0 version ASAP and stabilise 2.x so it can stay around for a while during the migration.

jrfnl added a commit to jrfnl/PHP_CodeSniffer that referenced this issue Jul 29, 2024
…eference-add-tests-with-dnf-types

IsReferenceTest: add extra tests with intersection/DNF types
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants