-
Notifications
You must be signed in to change notification settings - Fork 22
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
SkipLintProcess: Pass script by file-name instead of code #178
base: develop
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -23,15 +23,12 @@ class SkipLintProcess extends PhpProcess | |||||
public function __construct(PhpExecutable $phpExecutable, array $filesToCheck) | ||||||
{ | ||||||
$scriptPath = __DIR__ . '/../../bin/skip-linting.php'; | ||||||
$script = file_get_contents($scriptPath); | ||||||
|
||||||
if (!$script) { | ||||||
if (!is_file($scriptPath)) { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
I think it would make sense to silence a potential warning coming from |
||||||
throw new RuntimeException("skip-linting.php script not found in '$scriptPath'."); | ||||||
} | ||||||
|
||||||
$script = str_replace('<?php', '', $script); | ||||||
|
||||||
$parameters = array('-d', 'display_errors=stderr', '-r', $script); | ||||||
$parameters = array('-d', 'display_errors=stderr', '-f', realpath($scriptPath)); | ||||||
parent::__construct($phpExecutable, $parameters, implode(PHP_EOL, $filesToCheck)); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. btw: I wonder why this but thats a story for a future PR. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've been wondering the same, but that was before my time, so will need some history digging (in the old repo) to see if we can figure out the reason. If there is none, I'd welcome a change for this. |
||||||
} | ||||||
|
||||||
|
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.
Brain fart (untested): changing this line to the below and removing the call to
realpath()
might fix the issue with the PHAR ?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.
found a working solution at https://php-tips.readthedocs.io/en/latest/tips/run_any_phar_file.html