문제

We have a Java project that uses TeamCity to do static analysis of our Java classes each night to find low hanging bugs in our code. We would like to tell TeamCity to look for a new type of bug that developers might introduce that has to do with the usage of == vs .equals

For a particular type within the system we were using == to do comparisons because we designed our software such that it was valid. Well, now it's no longer valid, and we want to tell TeamCity to look for == for this type and report it as a bug in it's detailed reporting. Does anyone know how to do this? Static analysis seems to be the most appropriate way to catch this if it's ever introduced into the source base. We have a template within Eclipse as well for code guidelines and formatting, but I don't think Eclipse can tell anything about types. Any help is appreciated.

도움이 되었습니까?

해결책

Considering that TeamCity can run ALL of IntelliJ's code analysis tools , that is all 632 of them, you could rely on that to detect this kind of error.

It does have the test "== used instead of equals()", that you can customize by specifying the types to check.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top