添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
紧张的手电筒  ·  三斗室·  6 小时前    · 
腼腆的卡布奇诺  ·  Panduit | CLT150F-X20·  3 月前    · 
咆哮的地瓜  ·  Camco Currituck ...·  5 月前    · 
英俊的槟榔  ·  小米14u对比p70-西瓜视频·  5 月前    · 

Let’s say you have a class that extends RuntimeException, ExtendedRuntimeException.
Then you have a class that extends that, ExtraExtendedRuntimeException.
Then you have a class that extends that, ExtraExtraExtendedRuntimeException.

In your application, this in practical purposes only really has an inheritance depth of 3.

However squid:MaximumInheritanceDepth of max depth = 6 will hit because this exceeds max inheritance depth. Because

Throwable -> Exception -> RuntimeException -> ExtendedRuntimeException -> ExtraExtendedRuntimeException -> ExtraExtraExtendedRuntimeException

We should remove the Throwable, Exception and RuntimeException java.lang classes from the counter.

Hello @ndeepizza , thanks for the feedback.

In fact, you can already reach this behavior with the current state of the rule, there is a rule parameter ( filteredClasses ), where you can list classes to be filtered out of the count of inheritance.

I don’t think adding it by default is a good idea, other user might be happy to consider the effective inheritance depth (count every classes, even the one not written by himself).

Hope this helps,
Quentin

[WEBINAR] AI-Enhanced, Sonar Assured: Boost Developer Productivity and Improve Code Security in your SDLC - October 16 Register Now