-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
apply rector: set variable name to camel case #3680
Merged
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
b772c5e
apply rector: set local variable name to camel case
samsonasik 4e3bd79
exclude __DIR__ . '/system/Debug/Toolbar/Views/toolbar.tpl.php'
samsonasik a5b2bf4
using rector ^0.8.10
samsonasik 789858e
skip _ in first char
samsonasik ff41678
cs fix
samsonasik eb7ac59
skip _ in first character to not be changed to camelcase
samsonasik 4cd051c
sort use statement and indentation in composer.json
samsonasik c65bf8f
revert change to /system/Autoloader/Autoloader.php as code removed in…
samsonasik bf4916f
sort exclude path in rector config
samsonasik 50c8c4c
using rector-prefixed phar with require-dev nette/utils
samsonasik 5e5e2fc
update both parameter and @param docblock
samsonasik 0b4e27f
apply composer cache
samsonasik b594d98
update rector dependency and class reference
samsonasik c95d52e
using option skip for skip system/Autoloader/Autoloader.php for Under…
samsonasik 2431aab
add migrify/php-config-printer
samsonasik 3351a67
pin rector/rector-prefixed:0.8.10
samsonasik 9149f8c
pin rector/rector-prefixed:0.8.11
samsonasik cf6e11d
Revert "using option skip for skip system/Autoloader/Autoloader.php f…
samsonasik File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# When a PR is opened or a push is made, perform | ||
# a static analysis check on the code using Rector. | ||
name: Rector | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- 'develop' | ||
- '4.*' | ||
paths: | ||
- 'app/**' | ||
- 'system/**' | ||
push: | ||
branches: | ||
- 'develop' | ||
- '4.*' | ||
paths: | ||
- 'app/**' | ||
- 'system/**' | ||
|
||
jobs: | ||
build: | ||
name: Analyze code (Rector) | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: '7.4' | ||
extensions: intl | ||
|
||
- name: Use latest Composer | ||
run: composer self-update | ||
|
||
- name: Validate composer.json | ||
run: composer validate --strict | ||
|
||
- name: Get composer cache directory | ||
id: composer-cache | ||
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | ||
|
||
- name: Create composer cache directory | ||
run: mkdir -p ${{ steps.composer-cache.outputs.dir }} | ||
|
||
- name: Cache composer dependencies | ||
uses: actions/cache@v2 | ||
with: | ||
path: ${{ steps.composer-cache.outputs.dir }} | ||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} | ||
restore-keys: ${{ runner.os }}-composer- | ||
|
||
- name: Install dependencies | ||
run: composer install --ansi --no-progress --no-suggest --no-interaction | ||
|
||
- name: Run static analysis | ||
run: vendor/bin/rector process --dry-run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
use Rector\Core\Configuration\Option; | ||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; | ||
use Utils\Rector\UnderscoreToCamelCaseVariableNameRector; | ||
|
||
return static function (ContainerConfigurator $containerConfigurator): void { | ||
$parameters = $containerConfigurator->parameters(); | ||
|
||
// paths to refactor; solid alternative to CLI arguments | ||
$parameters->set(Option::PATHS, [__DIR__ . '/app', __DIR__ . '/system']); | ||
|
||
// is there a file you need to skip? | ||
$parameters->set(Option::EXCLUDE_PATHS, [ | ||
__DIR__ . '/app/Views', | ||
__DIR__ . '/system/Autoloader/Autoloader.php', | ||
__DIR__ . '/system/Debug/Toolbar/Views/toolbar.tpl.php', | ||
__DIR__ . '/system/ThirdParty', | ||
]); | ||
|
||
// Rector relies on autoload setup of your project; Composer autoload is included by default; to add more: | ||
$parameters->set(Option::AUTOLOAD_PATHS, [ | ||
// autoload specific file | ||
__DIR__ . '/system/Test/bootstrap.php', | ||
]); | ||
|
||
$services = $containerConfigurator->services(); | ||
$services->set(UnderscoreToCamelCaseVariableNameRector::class); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This should use the Composer cache so it can benefit from all the other running workflows. E.g from test-phpstan.yml:
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.
implemented.