VS 代码 - SonarLint:Simplify 表达式产生无效语法
VS code - SonarLint:Simplify the expression produce invalid syntax
我收到 S1125 是因为有代码味道:
MyVO vo;
public boolean is() {
return vo == null ? false : vo.is();
}
Remove the unnecessary boolean literal.sonarlint(java:S1125)
But when choosing Quick Fix -> SonarLint:Simplify the expression
it return invalid java syntax:
return !vo == null && vo.is();
是 Sonar Lint 错误吗?是我的 vs code 设置有误吗?
显然它应该固定为:
return vo != null && vo.is();
(使用最新的 VS 代码和 sonar lint 插件)
我在声纳中没有发现任何问题community/Jira
在 Sonar 社区中打开了一个问题 https://community.sonarsource.com/t/sonarlint-simplify-the-expression-wrong-syntax-on-java-s1125/62467
报告为 SONARJAVA-4241
S1125: erroneous quick fix suggestion when negating a binary operation
可能会被删除
It seems that covering all the cases seems tricky. We might want to simplify and simply don't suggest a quick fix if the expression is a binary operation.
我收到 S1125 是因为有代码味道:
MyVO vo;
public boolean is() {
return vo == null ? false : vo.is();
}
Remove the unnecessary boolean literal.sonarlint(java:S1125)
But when choosing Quick Fix -> SonarLint:Simplify the expression
it return invalid java syntax:
return !vo == null && vo.is();
是 Sonar Lint 错误吗?是我的 vs code 设置有误吗?
显然它应该固定为:
return vo != null && vo.is();
(使用最新的 VS 代码和 sonar lint 插件)
我在声纳中没有发现任何问题community/Jira
在 Sonar 社区中打开了一个问题 https://community.sonarsource.com/t/sonarlint-simplify-the-expression-wrong-syntax-on-java-s1125/62467
报告为 SONARJAVA-4241
S1125: erroneous quick fix suggestion when negating a binary operation
可能会被删除
It seems that covering all the cases seems tricky. We might want to simplify and simply don't suggest a quick fix if the expression is a binary operation.