Sonar parameters max count

  • 1 min read
  • Tags: 
  • java

Sonar tags as bad pattern functions with more than 7 (I think?) parameters. Everyone then pass objects containing the whole world to be sure to have everything they need. But then when unit testing that, they fill their world object with only the field they need to unit test. This is the worst pattern because you test nothing then.

Having one function parameter containing a POJO with 7 fields is the same as 7 function parameters.