DO NOT MERGE: bad code for testing reviewer bots#40
Conversation
| for (int i = 0; i < arr.length; i++) { // expect error: for loop | ||
| System.out.println(arr[i]); // expect error: println | ||
| } | ||
| if ("1" == "1") { // expect error: use equals |
There was a problem hiding this comment.
Recommendation generated by Amazon CodeGuru Reviewer. Leave feedback on this recommendation by replying to the comment or by reacting to the comment using emoji.
Problem: An equality operator (== or !=) is used to compare strings, which matches strings based on address.
Fix: Do content comparison using the equals() method to compare the values of the strings.
|
SonarCloud Quality Gate failed. |
| for (int i = 0; i < arr.length; i++) { // expect error: for loop | ||
| System.out.println(arr[i]); // expect error: println | ||
| } | ||
| if ("1" == "1") { // expect error: use equals |
There was a problem hiding this comment.
[PMD Java] Use equals() to compare object references. (view)
Details
| Rule | Ruleset | Priority |
|---|---|---|
CompareObjectsWithEquals |
Error Prone | 3 |
References:
You can close this issue if no need to fix it. Learn more.
| // expect error: unused | ||
| private String unused() { | ||
| String[] arr = new String[] {"a", "b"}; | ||
| for (int i = 0; i < arr.length; i++) { // expect error: for loop |
There was a problem hiding this comment.
[PMD Java] This for loop can be replaced by a foreach loop (view)
Details
| Rule | Ruleset | Priority |
|---|---|---|
ForLoopCanBeForeach |
Best Practices | 3 |
References:
You can close this issue if no need to fix it. Learn more.
| } | ||
|
|
||
| // expect error: length, number of vars, unused vars, duplication, unused | ||
| private void createScheduledFetcher2(LeaderBoardServerConfiguration configuration, Environment environment, GitHubApiFacade apiFacade, LeaderBoardStore store, String aaa, String bbb, String ccc, String ddd) { |
There was a problem hiding this comment.
[PMD Java] Avoid unused method parameters such as 'aaa'. (view)
Details
| Rule | Ruleset | Priority |
|---|---|---|
UnusedFormalParameter |
Best Practices | 3 |
References:
You can close this issue if no need to fix it. Learn more.
| } | ||
|
|
||
| // expect error: length, number of vars, unused vars, duplication, unused | ||
| private void createScheduledFetcher2(LeaderBoardServerConfiguration configuration, Environment environment, GitHubApiFacade apiFacade, LeaderBoardStore store, String aaa, String bbb, String ccc, String ddd) { |
There was a problem hiding this comment.
[PMD Java] Avoid unused method parameters such as 'bbb'. (view)
Details
| Rule | Ruleset | Priority |
|---|---|---|
UnusedFormalParameter |
Best Practices | 3 |
References:
You can close this issue if no need to fix it. Learn more.
| } | ||
|
|
||
| // expect error: length, number of vars, unused vars, duplication, unused | ||
| private void createScheduledFetcher2(LeaderBoardServerConfiguration configuration, Environment environment, GitHubApiFacade apiFacade, LeaderBoardStore store, String aaa, String bbb, String ccc, String ddd) { |
There was a problem hiding this comment.
[PMD Java] Avoid unused method parameters such as 'ccc'. (view)
Details
| Rule | Ruleset | Priority |
|---|---|---|
UnusedFormalParameter |
Best Practices | 3 |
References:
You can close this issue if no need to fix it. Learn more.
| } | ||
|
|
||
| // expect error: length, number of vars, unused vars, duplication, unused | ||
| private void createScheduledFetcher2(LeaderBoardServerConfiguration configuration, Environment environment, GitHubApiFacade apiFacade, LeaderBoardStore store, String aaa, String bbb, String ccc, String ddd) { |
There was a problem hiding this comment.
[PMD Java] Avoid unused private methods such as 'createScheduledFetcher2(LeaderBoardServerConfiguration,Environment,GitHubApiFacade,LeaderBoardStore,String,String,String,String)'. (view)
Details
| Rule | Ruleset | Priority |
|---|---|---|
UnusedPrivateMethod |
Best Practices | 3 |
References:
You can close this issue if no need to fix it. Learn more.
| for (int i = 0; i < arr.length; i++) { // expect error: for loop | ||
| System.out.println(arr[i]); // expect error: println | ||
| } | ||
| if ("1" == "1") { // expect error: use equals |
There was a problem hiding this comment.
[PMD Java] Use equals() to compare strings instead of '==' or '!=' (view)
Details
| Rule | Ruleset | Priority |
|---|---|---|
UseEqualsToCompareStrings |
Error Prone | 3 |
References:
You can close this issue if no need to fix it. Learn more.
|
|
||
| protected GitHubApiFacade getApiFacade(LeaderBoardServerConfiguration configuration) { | ||
| // expect error: bad name | ||
| protected GitHubApiFacade GetApiFacade(LeaderBoardServerConfiguration configuration) { |
There was a problem hiding this comment.
[Checkstyle] Name 'GetApiFacade' must match pattern '^[a-z][a-zA-Z0-9]*$'. (view)
Details
| Rule | Severity |
|---|---|
MethodNameCheck |
info |
References:
You can close this issue if no need to fix it. Learn more.
| } | ||
|
|
||
| // expect error: length, number of vars, unused vars, duplication, unused | ||
| private void createScheduledFetcher2(LeaderBoardServerConfiguration configuration, Environment environment, GitHubApiFacade apiFacade, LeaderBoardStore store, String aaa, String bbb, String ccc, String ddd) { |
There was a problem hiding this comment.
[Checkstyle] More than 7 parameters (found 8). (view)
Details
| Rule | Severity |
|---|---|
ParameterNumberCheck |
info |
References:
You can close this issue if no need to fix it. Learn more.
| for (int i = 0; i < arr.length; i++) { // expect error: for loop | ||
| System.out.println(arr[i]); // expect error: println | ||
| } | ||
| if ("1" == "1") { // expect error: use equals |
There was a problem hiding this comment.
[Checkstyle] Literal Strings should be compared using equals(), not '=='. (view)
Details
| Rule | Severity |
|---|---|
StringLiteralEqualityCheck |
info |
References:
You can close this issue if no need to fix it. Learn more.









No description provided.