New Code analysis only

(jagadesh manchala) #1


Thanks for all the help in advance.

I started using sonarqube recently and trying to understand more of it. I would like to know if there is a way to scan newly written code.

I have written a code and scanned and obtained some value. Is there any way to scan only the code that i have newly written from old one.

Please let me know if you need any more details on this.

(G Ann Campbell) #2


Analysis will always include all code. Why? Why take the time to analyze all of it when only a file or two has been changed? Because any given change can have far-reaching effects. I’ll give you two examples:

  • I check in a change that deprecates a much-used method. Suddenly, issues about the use of deprecated code should be raised all over the project, but because I only analyzed that one file, no new issues were raised.

  • I modify a much-used method to return null in some cases. Suddenly all the methods that dereference the returned value without first null-checking it are at risk of NullPointerExceptions. But only the one file that I changed was analyzed, so none of those “Possible NPE” issues are raised. Worse, they won’t be raised until after each individual file happens to be touched. :frowning:

And that’s why all files are included in each analysis.