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

Integrate phpstan #1426

Open
SanketDG opened this issue Feb 10, 2017 · 11 comments · May be fixed by #1468
Open

Integrate phpstan #1426

SanketDG opened this issue Feb 10, 2017 · 11 comments · May be fixed by #1468
Assignees

Comments

@SanketDG
Copy link
Member

https://github.com/phpstan/phpstan

@damngamerz
Copy link
Member

I would like to work on this bear proposal 😄

@damngamerz
Copy link
Member

Tested phpstan!! The linter is good.
While converting it to bear I m having issues.
As phpstan is being installed through composer.
I Tried installing both composer and phpstan globally.
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" php -r "if (hash_file('SHA384', 'composer-setup.php') === '55d6ead61b29c7bdee5cccfb50076874187bd9f21f65d8991d46ec5cc90518f447387fb9f76ebae1fbbacf329e583e30') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" php composer-setup.php php -r "unlink('composer-setup.php');" mv composer.phar /usr/local/bin/composer composer global require phpstan/phpstan
added phpstan to $PATH
As suggested by @SanketDG to checkout which phpstan on CLI
It doesnt show any path wheareas whereis phpstan shows the package.
Because of this issue Im unable to run this bear.
Attaching Screenshots for reference
screenshot from 2017-02-17 18-25-27

@Makman2
Copy link
Member

Makman2 commented Feb 20, 2017

whereis is different from which, as it tries to find the given binary not only in the PATH. Though still it's weird that which can't find it. Do you use maybe the docker alias? That's why which may not find it^^

EDIT: Shouldn't be the problem, which then displays that it's an alias...

@Makman2
Copy link
Member

Makman2 commented Feb 20, 2017

On the docker image of phpstan I've a valid path:

 mak  ~  docker run -i --entrypoint sh phpstan/phpstan:0.6 
which phpstan
/composer/vendor/bin/phpstan

@damngamerz
Copy link
Member

damngamerz commented Feb 21, 2017

@Makman2 by following those above commands even i have valid path.But its strange
i have added this alias to ~/.bashrc
alias phpstan='docker run -v $PWD:/app --rm phpstan/phpstan:0.6'
still its not having valid path while invoking which in my CLI.Any thoughts ?

@Makman2
Copy link
Member

Makman2 commented Feb 24, 2017

This is what I get:

 mak  ~  which phpstan
alias phpstan='docker run -v $PWD:/app --rm phpstan/phpstan:0.6'
	/usr/bin/docker

What shell do you use? maybe your shell does not display aliases with which^^

@damngamerz
Copy link
Member

@Makman2 Im using bash which is default shell for ubuntu.My setup is Ubuntu 16.04 LTS.Any Thoughts?Im stuck at this point.Cant go any further if the bear doesnt detect phpstan installation.

@Makman2
Copy link
Member

Makman2 commented Feb 25, 2017

Try to write the bear using executable=phpstan, and let's see how we get it to work and how we can install phpstan on CI. I'll try it then too on my machine 👍

@damngamerz
Copy link
Member

@Makman2 I have already written it! But im unable to test it cause coala is not able to detect the installation of phpstan.Here http://pastebin.com/eiqZJA5N
now while running

coala --bear-dirs=. --bears=PhpstanBear --files=hello.php --flush-cache

gives

[ERROR][03:43:52] The bear PhpstanBear does not fulfill all requirements. 'phpstan' is not installed.

@Makman2
Copy link
Member

Makman2 commented Feb 27, 2017

ah wait I know... you can't use .bashrc as this is the bash shell environment, not your system environment! :D
@linter directly executes a program without shell, so it relies on the system defaults and paths. Maybe this link helps: http://unix.stackexchange.com/questions/26047/how-to-correctly-add-a-path-to-path

@damngamerz
Copy link
Member

damngamerz commented Feb 27, 2017

@Makman2 Worked like a magic!! your magic is strong 😉
which doesn't takes care of ~/while in PATH.whereas bash takes care of it while invoking for running a program.
so added
export PATH="$HOME/.config/composer/vendor/bin/:$PATH" to ~/.bashrc file
now

which phpstan
/home/damngamerz/.config/composer/vendor/bin//phpstan

and my linter works perfectly.yay!
screenshot from 2017-02-28 01-52-50
Thanks!!
I will make a PR soon 👍

damngamerz added a commit to damngamerz/coala-bears that referenced this issue Feb 28, 2017
Introduce PHPStanBear
Checks the code with ``phpstan analyze``.
Closes coala#1426
@damngamerz damngamerz linked a pull request Feb 28, 2017 that will close this issue
2 tasks
damngamerz added a commit to damngamerz/coala-bears that referenced this issue Feb 28, 2017
Introduce PHPStanBear
Checks the code with ``phpstan analyze``.
Closes coala#1426
damngamerz added a commit to damngamerz/coala-bears that referenced this issue Feb 28, 2017
Introduce PHPStanBear
Checks the code with ``phpstan analyze``.
Closes coala#1426
damngamerz added a commit to damngamerz/coala-bears that referenced this issue Feb 28, 2017
Introduce PHPStanBear
Checks the code with ``phpstan analyze``.
Closes coala#1426
damngamerz added a commit to damngamerz/coala-bears that referenced this issue Feb 28, 2017
Introduce PHPStanBear
Checks the code with ``phpstan analyze``.
Closes coala#1426
damngamerz added a commit to damngamerz/coala-bears that referenced this issue Feb 28, 2017
Introduce PHPStanBear
Checks the code with ``phpstan analyze``.
Closes coala#1426
damngamerz added a commit to damngamerz/coala-bears that referenced this issue Feb 28, 2017
Introduce PHPStanBear
Checks the code with ``phpstan analyze``.
Closes coala#1426
damngamerz added a commit to damngamerz/coala-bears that referenced this issue Mar 1, 2017
Introduce PHPStanBear
Checks the code with ``phpstan analyze``.
Closes coala#1426
damngamerz added a commit to damngamerz/coala-bears that referenced this issue Mar 1, 2017
composer is required for the bear dependencies.
Related to coala#1426
damngamerz added a commit to damngamerz/coala-bears that referenced this issue Mar 1, 2017
Setting up phpstan/phpstan via composer.
Related to coala#1426
damngamerz added a commit to damngamerz/coala-bears that referenced this issue Mar 1, 2017
Introduce PHPStanBear
Checks the code with ``phpstan analyze``.
Closes coala#1426
damngamerz added a commit to damngamerz/coala-bears that referenced this issue Mar 1, 2017
Add composer and phpstan for ci
Related to coala#1426
damngamerz added a commit to damngamerz/coala-bears that referenced this issue Mar 1, 2017
Add composer and phpstan for ci
Related to coala#1426
damngamerz added a commit to damngamerz/coala-bears that referenced this issue Mar 1, 2017
Add composer and phpstan for ci
Related to coala#1426
damngamerz added a commit to damngamerz/coala-bears that referenced this issue Mar 1, 2017
Add composer and phpstan for ci
Related to coala#1426
damngamerz added a commit to damngamerz/coala-bears that referenced this issue Mar 1, 2017
Add composer and phpstan for ci
Related to coala#1426
damngamerz added a commit to damngamerz/coala-bears that referenced this issue Mar 1, 2017
Add composer and phpstan for ci
Related to coala#1426
damngamerz added a commit to damngamerz/coala-bears that referenced this issue Mar 1, 2017
Introduce PHPStanBear
Checks the code with ``phpstan analyze``.
Closes coala#1426
damngamerz added a commit to damngamerz/coala-bears that referenced this issue Mar 1, 2017
Introduce PHPStanBear
Checks the code with ``phpstan analyze``.
Closes coala#1426
damngamerz added a commit to damngamerz/coala-bears that referenced this issue Mar 2, 2017
Introduce PHPStanBear
Checks the code with ``phpstan analyze``.
Closes coala#1426
damngamerz added a commit to damngamerz/coala-bears that referenced this issue Mar 2, 2017
Introduce PHPStanBear
Checks the code with ``phpstan analyze``.
Closes coala#1426
damngamerz added a commit to damngamerz/coala-bears that referenced this issue Mar 4, 2017
Introduce PHPStanBear
Checks the code with ``phpstan analyze``.
Closes coala#1426
damngamerz added a commit to damngamerz/coala-bears that referenced this issue Mar 6, 2017
Introduce PHPStanBear
Checks the code with ``phpstan analyze``.
Closes coala#1426
damngamerz added a commit to damngamerz/coala-bears that referenced this issue Mar 6, 2017
Introduce PHPStanBear
Checks the code with ``phpstan analyze``.
Closes coala#1426
damngamerz added a commit to damngamerz/coala-bears that referenced this issue Mar 6, 2017
Introduce PHPStanBear
Checks the code with ``phpstan analyze``.
Closes coala#1426
damngamerz added a commit to damngamerz/coala-bears that referenced this issue Mar 6, 2017
Introduce PHPStanBear
Checks the code with ``phpstan analyze``.
Closes coala#1426
damngamerz added a commit to damngamerz/coala-bears that referenced this issue Mar 25, 2017
Introduce PHPStanBear
Checks the code with ``phpstan analyze``.
Closes coala#1426
damngamerz added a commit to damngamerz/coala-bears that referenced this issue Apr 25, 2017
Introduce PHPStanBear
Checks the code with ``phpstan analyze``.
Closes coala#1426
damngamerz added a commit to damngamerz/coala-bears that referenced this issue Apr 25, 2017
Introduce PHPStanBear
Checks the code with ``phpstan analyze``.
Closes coala#1426
damngamerz added a commit to damngamerz/coala-bears that referenced this issue Apr 25, 2017
Introduce PHPStanBear
Checks the code with ``phpstan analyze``.
Closes coala#1426
damngamerz added a commit to damngamerz/coala-bears that referenced this issue Apr 28, 2017
Introduce PHPStanBear
Checks the code with ``phpstan analyze``.
Closes coala#1426
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

5 participants