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

Add Rector as tool #627

Closed
CodeCasterNL opened this issue Aug 5, 2022 · 4 comments
Closed

Add Rector as tool #627

CodeCasterNL opened this issue Aug 5, 2022 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@CodeCasterNL
Copy link

Describe the feature
Can Rector (https://github.com/rectorphp/rector, https://getrector.org/) be added to setup-php?

- name: Set up PHP with tools
  uses: shivammathur/setup-php@v2
  with:
    php-version: '8.1'
    tools: php-cs-fixer, phpstan, rector

Underlying issue
We use Rector (https://github.com/rectorphp/rector, https://getrector.org/) to analyze our code, in addition to PHP-CS-Fixer and PHPStan, and we --dry-run it in our GitHub Actions to check whether any code smells have been introduced.

Rector doesn't need the project's dependencies to be installed, it just checks our source files, so ideally we'd like to run it as early as possible in the pipeline, before Composer packages and whatnot have been installed.

Describe alternatives
Currently we run a composer install to install all of the project's dependencies, which includes Rector. Then we run Rector.

Are you willing to submit a PR?
I can try, I speak (Power)Shell.

@CodeCasterNL CodeCasterNL added the enhancement New feature or request label Aug 5, 2022
@shivammathur
Copy link
Owner

@CodeCasterNL

This would already work

- name: Set up PHP with tools
  uses: shivammathur/setup-php@v2
  with:
    php-version: '8.1'
    tools: php-cs-fixer, phpstan, rector/rector

I will add support in the next release so that just rector would work.

@CodeCasterNL
Copy link
Author

@shivammathur thanks, will test. Rector is not mentioned under https://github.com/shivammathur/setup-php#wrench-tools-support, do you mean you can just install any composer package like that?

@shivammathur
Copy link
Owner

Yes

@CodeCasterNL
Copy link
Author

In addition to above tools any composer tool or package can also be set up globally by specifying it as vendor/package matching the listing on Packagist.

I see, missed that entirely, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants