Skip to content

[Feature] autofixer #337

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

Merged
merged 29 commits into from
Apr 4, 2020
Merged

[Feature] autofixer #337

merged 29 commits into from
Apr 4, 2020

Conversation

Jibbarth
Copy link
Collaborator

@Jibbarth Jibbarth commented Dec 15, 2019

Q A
Bug fix? no
New feature? yes
Fixed tickets #54

Hey! I worked on autofix feature. It's not totally ready yet, but I wanted to create a PR to at least show you.

It add a --fix option to analyse command to apply check where it's possible during a complete analyze.
I also add a phpinsights fix command to don't get full report, but only apply fixes.

@caneco do you have idea on how improve the output ?

It's look like this for now:

phpinsights-autofix-2

TODO:

  • Add tests
  • Add documentations
  • DefinitionResolver for booting container and create configuration (TODO in the code)
  • Launch fix on all project (This will be done on another PR)

I'm also wondering if we should create a next branch for aggregate developments on v2.0 ? What do you think @nunomaduro @olivernybroe ?

@nunomaduro
Copy link
Owner

Nothing to say about the code, sounds good to me. Can I test this already locally?

@nunomaduro
Copy link
Owner

ps: @Jibbarth Very very good job.

@nunomaduro nunomaduro requested review from olivernybroe and nunomaduro and removed request for olivernybroe December 15, 2019 17:32
@nunomaduro nunomaduro added enhancement New feature or request Docs Related to the documentation labels Dec 15, 2019
@Jibbarth
Copy link
Collaborator Author

Can I test this already locally?

@nunomaduro Sure ! To test it on an other project, add this in composer.json

{
    //...
    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/jibbarth/phpinsights"
        }
    ]
}

Then require phpinsights on correct branch :

composer require nunomaduro/phpinsights:dev-feature/autofixer

To get the code locally on your phpinsights folder, you could also add a remote on git:

git remote add jibbarth [email protected]:Jibbarth/phpinsights.git
git fetch jibbarth
git checkout feature/autofixer

And I think you can even push on my branch if you want, github allow edit for mainteners in PR 🙂

Copy link
Collaborator

@olivernybroe olivernybroe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks great! Amazing work @Jibbarth

So how does the result look when using the other formatters? I guess the result is just as it normally looks when running without fixing?

@olivernybroe
Copy link
Collaborator

@Jibbarth @nunomaduro regarding creating a new branch for v2.0 stuff, I think we should consider making a branch for v.1 stuff instead and keep master for v2 stuff.

@nunomaduro
Copy link
Owner

@Jibbarth @olivernybroe For now, I don't see any breaking change here.

@zolotov88
Copy link

Hi! What about finish and relise this feature?

@Jibbarth
Copy link
Collaborator Author

@zolotov88 I'll try to work on this this weekend 😉

@zolotov88
Copy link

Yahoorei! =)

@YDoomA
Copy link

YDoomA commented Feb 3, 2020

Hi) Bro, we are really looking forward to this release) You will have time to finish before the end of the week?)

@olivernybroe olivernybroe linked an issue Feb 18, 2020 that may be closed by this pull request
@Jibbarth Jibbarth force-pushed the feature/autofixer branch from f8da6e2 to 05da8e0 Compare March 15, 2020 13:28
@Jibbarth
Copy link
Collaborator Author

I think we only need to add the fix information to the other formatters and it should all be there.

@olivernybroe I added a "fixed issues" count in summary of Json Formatter.

For other, I don't think it's necessary (and I also don't know where to place it 😅)
For Checkstyle Formatter, we haven't summary field, and I think it's mainly used by CI to register issues.
Idem for GithubFormatter, as it's used to write issue on PR, it shouldn't be used with --fix option ?

WDYT ?

@olivernybroe
Copy link
Collaborator

I think that is fine for now :) If somebody says they can see a use-case in another formatter, a small pr can always be created.

Copy link
Collaborator

@olivernybroe olivernybroe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! 👍

Just some small cleanup comments and I think we are there.

@nunomaduro
Copy link
Owner

Any chance we can get this under the 2.0 scope? #294

Copy link
Collaborator

@olivernybroe olivernybroe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing!

I would say this is ready now 👍

@olivernybroe
Copy link
Collaborator

@Jibbarth if this is ready, then let's resolve the conflicts and get it merged 😄

@Jibbarth
Copy link
Collaborator Author

Jibbarth commented Apr 3, 2020

@olivernybroe I'll try to finish my pendings PRs tonight or during the weekend 😉

@Jibbarth Jibbarth requested a review from olivernybroe April 4, 2020 12:48
@Jibbarth
Copy link
Collaborator Author

Jibbarth commented Apr 4, 2020

@olivernybroe Conflicts fixed ! Could you redo a slight review ? 🙏

Copy link
Collaborator

@olivernybroe olivernybroe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 👍
You can merge it in :)

@Jibbarth Jibbarth merged commit 6485861 into nunomaduro:master Apr 4, 2020
@Jibbarth Jibbarth deleted the feature/autofixer branch April 4, 2020 16:20
@viezel
Copy link

viezel commented Apr 4, 2020

Freaking fantastic 👏🏻👏🏻

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

Successfully merging this pull request may close these issues.

Fixing Errors Automatically.
6 participants