Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
2.5k views
in Technique[技术] by (71.8m points)

java - How to tell SonarQube not to apply a certain rule if the affected code satisfies some regex rule

There is a SonarQube rule named The diamond operator ("<>") should be used. The codebase I'm working on is pretty old so there are numerous instances like this:

List<String> list = new ArrayList<String>();

SonarQube suggests removal of 'String' on the right-side. So far so good.

The problem is, SonarQube also reports cases where we have something like this:

foobar.setItems(new ArrayList<String>());

How do I tell SonarQube to ignore all such cases (where for example, the new keyword is preceded by a parenthesis (?

Or is there a better way to disregard such reports, other than marking everyone of them as false positive?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

Just Browsing Browsing

[2] html - How to create even cell spacing within a

2.1m questions

2.1m answers

60 comments

57.0k users

...