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

Make the cyclomatic complexity limit configurable. #190

Merged
merged 6 commits into from Jun 20, 2019
Merged

Make the cyclomatic complexity limit configurable. #190

merged 6 commits into from Jun 20, 2019

Conversation

@tvbeek
Copy link
Contributor

@tvbeek tvbeek commented Jun 19, 2019

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

I found that I wanted to change the limit of the cyclomatic complexity insight. Currently this is hard coded fixed on 5. So with this PR I add the option to change it.

Copy link
Owner

@nunomaduro nunomaduro left a comment

It's perfect, I would just rename limit to maxComplexity. What do you think?

Loading

@tvbeek
Copy link
Contributor Author

@tvbeek tvbeek commented Jun 19, 2019

Good idea, I have changed it.

Loading

Copy link
Owner

@nunomaduro nunomaduro left a comment

@tvbeek Can you run composer test locally? Tests are not passing.

Loading

@tvbeek
Copy link
Contributor Author

@tvbeek tvbeek commented Jun 19, 2019

Yes, sorry I just saw it. Currently working on it.

Loading

@tvbeek
Copy link
Contributor Author

@tvbeek tvbeek commented Jun 19, 2019

It passed the test, do you have anything else that you like to have changed?

Loading

Copy link
Collaborator

@olivernybroe olivernybroe left a comment

Looks great, thanks for the contribution!

If it's not too much trouble could you add a test for it? :)

Loading

@Jibbarth
Copy link
Collaborator

@Jibbarth Jibbarth commented Jun 19, 2019

Great addition 👍 Thank you @tvbeek 🙏

If you can, can you also update documentation to help users to know how to configure it ?

You just have to add in https://github.com/nunomaduro/phpinsights/blob/master/docs/insights/complexity.md something like

+ <details>
+     <summary>Configuration</summary>
+
+ ```php
+ \NunoMaduro\PhpInsights\Domain\Insights\CyclomaticComplexityIsHigh::class => [
+     'maxComplexity' => 5
+ ]
+ ```
+ </details>

after Insight Class: NunoMaduro\PhpInsights\Domain\Insights\CyclomaticComplexityIsHigh

Loading

@tvbeek
Copy link
Contributor Author

@tvbeek tvbeek commented Jun 19, 2019

@olivernybroe There wasn't a test for this insight but I will create it.

@Jibbarth thanks for pointing out to the documentation. I have added it.

Loading

@tvbeek
Copy link
Contributor Author

@tvbeek tvbeek commented Jun 20, 2019

I have added a test for the CyclomaticComplexityIsHigh Insight that test this config (and the normal behavior)

Loading

Copy link
Collaborator

@olivernybroe olivernybroe left a comment

Amazing work!

This PR has everything.
Tests, docs and a nice contribution 🎉

Loading

@olivernybroe
Copy link
Collaborator

@olivernybroe olivernybroe commented Jun 20, 2019

@nunomaduro @Jibbarth I'll say this is ready for merge. So if one of you agree with me, just merge it in :)

Loading

docs/insights/complexity.md Outdated Show resolved Hide resolved
Loading
src/Domain/Insights/CyclomaticComplexityIsHigh.php Outdated Show resolved Hide resolved
Loading
…n and update the documentation so that the configuration is visible.

Thanks @Jibbarth for the feedback.
Copy link
Collaborator

@Jibbarth Jibbarth left a comment

👌 Perfect

Loading

@Jibbarth Jibbarth merged commit 3fdee8d into nunomaduro:master Jun 20, 2019
1 check passed
Loading
@nunomaduro
Copy link
Owner

@nunomaduro nunomaduro commented Jun 20, 2019

@Jibbarth @olivernybroe Tonight I will release a new version of php insights.

Loading

@nunomaduro
Copy link
Owner

@nunomaduro nunomaduro commented Jun 20, 2019

Thanks @tvbeek for this pull request.

Loading

@Jibbarth Jibbarth mentioned this pull request Jun 20, 2019
7 tasks
@tvbeek tvbeek deleted the add_option_to_change_the_cyclomatic_complexity_limit branch Jun 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants