Understand effort estimation stated in TODO or FIXME comments

I just discovered this old request “Add an arbitrary effort for TODO’s and FIXME’s” which has never been replied to. If I understand it correctly, it suggests to configure a global non-zero “default” effort for TODO or FIXME issues, which sounds quite interesting to me.

It is related to my request “Edit remediation cost”, which aimed at individually configuring the effort for each TODO or FIXME issue.

Both requests pursue basically the same objective, namely considering a significant effort for TODO or FIXME issues in the calculation of maintainability cost.

As stated by @ganncamp, using the remediation_* parameters from api/rules/update, it might be possible to set the default effort for newly created issues (I haven’t tried yet). However, this solution seems to be a bit cumbersome.

Perhaps it’s easier to state the individual effort estimation (remediation cost) directly in the code?

Consider these examples:

// TODO {effort: 15min} add checks for division by zero.

// TODO add implementation {effort: 30min}

// TODO {effort: 10min} correct spelling in Javadoc

// FIXME {effort: 3h} fix calculation for leap years

// TODO make class immutable {effort: 1d}

// TODO {effort: 4d} rewrite these packages to support generics

When SonarQube creates issues for these comments (squid:S1134 or squid:S1135), it should pick up the effort durations stated in the comments and assign them automatically to the respective issues.

The examples above are just a sketch to illustrate this idea. The exact syntax is open for discussion.

Some suggestions for different or additional syntaxes:

// TODO replace by proxy SONAR-EFFORT:4h

// TODO [10min] delete this method and its usages

// TODO add copyright notes (5 minutes effort)

// FIXME possible NPE here; remediation-cost:15min 

// FIXME class is not thread-safe sonar-cost:1d

Hello Björn,

Thank you for the feedback and the detailed description!

Unfortunately, our thinking on this topic is that this is a very specific feature that adds complexity without providing enough value to all of our users. As an alternative, if you are on SonarQube, you could take a look into adding your own rule for this.

Best,
Martin

2 Likes