S1448 : Classes should not have too many methods

1,013 views
Skip to first unread message

Dominique Jean-Prost

unread,
Sep 22, 2016, 11:57:53 AM9/22/16
to SonarQube
Hello,

Could it be possible to add a parameter to this rule S1448  : to not take in account getters and setters method ?

Thank you.
dom

Brian Sperlongano

unread,
Sep 22, 2016, 3:43:22 PM9/22/16
to SonarQube
I'm not sure that I agree with this.  If you have so many setters and getters that it trips this rule, perhaps the data structure is too flat and too large to be easily understood/worked with?

Michael Gumowski

unread,
Sep 23, 2016, 4:10:44 AM9/23/16
to Brian Sperlongano, SonarQube
Hello Dominique,

Another option would be to disable the rule in packages which only contains POJOs, especially when such objects have many fields (see Narrowing the Focus).
Now, if your objects does more than holding values and also have tons of getters/setters (following Brian's idea), I'm convinced that having an issue there is correct. Consequently, for the time being, we won't change the rule.

If I'm missing the point, don't hesitate to give an example of code where the rule is making too much noise because of getters/setters!

Regards,

Michael

--
You received this message because you are subscribed to the Google Groups "SonarQube" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonarqube+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarqube/58ef312b-cb76-41d0-bd1c-3ce8f0f5b79c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--

Michael GUMOWSKI | SonarSource
Software Developer @ Language Team
http://sonarsource.com

Dominique Jean-Prost

unread,
Sep 23, 2016, 11:00:42 AM9/23/16
to SonarQube, zelon...@gmail.com
Hello Michael,

Thank you for pointing the fact that I could disable the rule for specific class name (DTO).
I guess with this idea, I don't need the rule change anymore.
Dom
Reply all
Reply to author
Forward
0 new messages