-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DO NOT MERGE: bad code for testing reviewer bots #40
base: master
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[PMD Java] Use equals() to compare object references. (view)
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[PMD Java] This for loop can be replaced by a foreach loop (view)
Rule | Ruleset | Priority |
---|---|---|
ForLoopCanBeForeach |
Best Practices | 3 |
References:
You can close this issue if no need to fix it. Learn more.
@@ -65,4 +80,11 @@ | |||
executorService.scheduleAtFixedRate(new FetcherRunnable(store, fetcher), 0, configuration.getRefreshRateMinutes(), TimeUnit.MINUTES); | |||
} | |||
|
|||
// 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[PMD Java] Avoid unused method parameters such as 'aaa'. (view)
Rule | Ruleset | Priority |
---|---|---|
UnusedFormalParameter |
Best Practices | 3 |
References:
You can close this issue if no need to fix it. Learn more.
@@ -65,4 +80,11 @@ | |||
executorService.scheduleAtFixedRate(new FetcherRunnable(store, fetcher), 0, configuration.getRefreshRateMinutes(), TimeUnit.MINUTES); | |||
} | |||
|
|||
// 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[PMD Java] Avoid unused method parameters such as 'bbb'. (view)
Rule | Ruleset | Priority |
---|---|---|
UnusedFormalParameter |
Best Practices | 3 |
References:
You can close this issue if no need to fix it. Learn more.
@@ -65,4 +80,11 @@ | |||
executorService.scheduleAtFixedRate(new FetcherRunnable(store, fetcher), 0, configuration.getRefreshRateMinutes(), TimeUnit.MINUTES); | |||
} | |||
|
|||
// 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[PMD Java] Avoid unused method parameters such as 'ccc'. (view)
Rule | Ruleset | Priority |
---|---|---|
UnusedFormalParameter |
Best Practices | 3 |
References:
You can close this issue if no need to fix it. Learn more.
@@ -65,4 +80,11 @@ | |||
executorService.scheduleAtFixedRate(new FetcherRunnable(store, fetcher), 0, configuration.getRefreshRateMinutes(), TimeUnit.MINUTES); | |||
} | |||
|
|||
// 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[PMD Java] Avoid unused private methods such as 'createScheduledFetcher2(LeaderBoardServerConfiguration,Environment,GitHubApiFacade,LeaderBoardStore,String,String,String,String)'. (view)
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[PMD Java] Use equals() to compare strings instead of '==' or '!=' (view)
Rule | Ruleset | Priority |
---|---|---|
UseEqualsToCompareStrings |
Error Prone | 3 |
References:
You can close this issue if no need to fix it. Learn more.
@@ -45,7 +45,10 @@ | |||
createScheduledFetcher(configuration, environment, apiFacade, store); | |||
} | |||
|
|||
protected GitHubApiFacade getApiFacade(LeaderBoardServerConfiguration configuration) { | |||
// expect error: bad name | |||
protected GitHubApiFacade GetApiFacade(LeaderBoardServerConfiguration configuration) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Checkstyle] Name 'GetApiFacade' must match pattern '^[a-z][a-zA-Z0-9]*$'. (view)
Rule | Severity |
---|---|
MethodNameCheck |
info |
References:
You can close this issue if no need to fix it. Learn more.
@@ -65,4 +80,11 @@ | |||
executorService.scheduleAtFixedRate(new FetcherRunnable(store, fetcher), 0, configuration.getRefreshRateMinutes(), TimeUnit.MINUTES); | |||
} | |||
|
|||
// 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Checkstyle] More than 7 parameters (found 8). (view)
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Checkstyle] Literal Strings should be compared using equals(), not '=='. (view)
Rule | Severity |
---|---|
StringLiteralEqualityCheck |
info |
References:
You can close this issue if no need to fix it. Learn more.
No description provided.