Skip to content

Issues are sorted for all formatters #348

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 8 commits into from
Feb 7, 2020
Merged

Issues are sorted for all formatters #348

merged 8 commits into from
Feb 7, 2020

Conversation

bastien-phi
Copy link
Contributor

Q A
Bug fix? no
New feature? yes

I use a lot phpinsights and we keep a phpinsights.txt file inside our project repositories (basically just the output of php artisan insights --no-interaction -v). It helps us to see which issues are solved or created when we develop features.

Unfortunately, diffs are sometimes very hard to read because order in insights details can change between platforms (linux or macos) or for any other obscure reason.

Moreover, the fact that details are not sorted by file makes more difficult find the issue and fix then in batch. For example, a sample of what I got :

app/App/Admin/Filters/ByRuleTemplate.php:25: Unused parameter $request.
app/App/Dashboard/Controllers/UserController.php:54: Unused parameter $user
app/Support/Rules/HexColor.php:9: Unused parameter $attribute.
app/Support/Rules/ActivitySvg.php:17: Unused parameter $attribute.
app/Support/Rules/DomainName.php:17: Unused parameter $attribute.
app/Domain/User/Policies/UserPolicy.php:14: Unused parameter $admin.

This PR fixes this, sorting details of each insights, firstly by file, then line, function and finally message.

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, I really like this and the implementation is clean.

Think this could help a lot of people figuring out what errors they are getting.

Copy link
Collaborator

@Jibbarth Jibbarth left a comment

Choose a reason for hiding this comment

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

👏 Looks great !

Do you think you could add some tests, especially for DetailComparator class ?

@bastien-phi
Copy link
Contributor Author

@Jibbarth Should I add more test cases ?

Copy link
Collaborator

@Jibbarth Jibbarth left a comment

Choose a reason for hiding this comment

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

👍 Thank you @bastien-phi

@olivernybroe
Copy link
Collaborator

@bastien-phi Really nice! Could you add a test for the comparison order described in the PR, after that I'll say it is ready for merging 👍

@bastien-phi
Copy link
Contributor Author

@olivernybroe is ee87ed0 what you wanted ?

@olivernybroe
Copy link
Collaborator

@bastien-phi Yep, it was something like that I had in mind, thanks a lot! ❤️

@olivernybroe olivernybroe merged commit bc27390 into nunomaduro:master Feb 7, 2020
@bastien-phi bastien-phi deleted the sort_details_in_outputs branch February 7, 2020 12:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants