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

Fixing squid:MethodCyclomaticComplexity Methods should not be too complex part 2 #147

Merged
merged 3 commits into from
Jun 20, 2016
Merged

Fixing squid:MethodCyclomaticComplexity Methods should not be too complex part 2 #147

merged 3 commits into from
Jun 20, 2016

Conversation

devFozgul
Copy link
Contributor

This pull request is focused on resolving occurrences of Sonar rule
squid:MethodCyclomaticComplexity - “""Methods should not be too complex”.
You can find more information about the issue here:
This PR will remove 41 min of TD.
https://dev.eclipse.org/sonar/rules/show/squid:MethodCyclomaticComplexity
Please let me know if you have any questions.
Fevzi Ozgul

@gallandarakhneorg
Copy link
Owner

gallandarakhneorg commented Jun 20, 2016

This PR does not provide an efficient code.
Indeed, creating a Map and searching inside has an average complexity of O(k/n).
A solution should be to abstract the function and let define concrete functions for each enumeration constant.

    ...
    BOOLEAN {
       public Object getDefaultValue() {
           return Boolean.FALSE;
       }
    }
    ....
    public abstract Object getDefaultValue();
    ....
}

@devFozgul
Copy link
Contributor Author

I'll have a look at it again.

On Mon, Jun 20, 2016 at 2:14 PM, Stéphane Galland notifications@github.com
wrote:

This PR does not provide an efficient code.
Indeed, creating a Map and searching inside has an average complexity of
O(k/n).
A solution should be to put the default value in an attribute of each
enumeration constant.

A similar job was done for the string representation of the types: see
commit f77896e
f77896e
.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#147 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AR09BPdyUjoxB-amtCu_KqG3zaKHTg8cks5qNnX8gaJpZM4I4cdx
.

@gallandarakhneorg gallandarakhneorg merged commit d7cf649 into gallandarakhneorg:master Jun 20, 2016
gallandarakhneorg added a commit that referenced this pull request Jun 20, 2016
Signed-off-by: Stéphane Galland <galland@arakhne.org>
@gallandarakhneorg
Copy link
Owner

Don't worry. I have merged your contribution and fix the issue.

@devFozgul
Copy link
Contributor Author

Thanks a lot.

On Mon, Jun 20, 2016 at 2:30 PM, Stéphane Galland notifications@github.com
wrote:

Don't worry. I have merged your contribution and fix the issue.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#147 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AR09BIVyXrMRtmurjiKJbqqWU6oi5nCDks5qNnnVgaJpZM4I4cdx
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants