-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fixing log levels analyzer Updating substring comment to show on what method it should be applied Udating hardcoded message check, so first converts the string to lowercase * Renaming parameter from onMethod to inMethod * Updating substring comment used to v2
- Loading branch information
1 parent
dffc75f
commit addcf0c
Showing
12 changed files
with
81 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
14 changes: 14 additions & 0 deletions
14
...rces/analyzer/AnalyzerIntegrationTest.loglevels.HardCodingLogLevelsUpperCase.approved.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"comments": [ | ||
{ | ||
"comment": "java.general.avoid_hard_coded_test_cases", | ||
"params": {}, | ||
"type": "essential" | ||
}, | ||
{ | ||
"comment": "java.general.feedback_request", | ||
"params": {}, | ||
"type": "informative" | ||
} | ||
] | ||
} |
13 changes: 11 additions & 2 deletions
13
...es/analyzer/AnalyzerIntegrationTest.loglevels.NotUsingSubstringOnBothMethods.approved.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 4 additions & 2 deletions
6
...urces/analyzer/AnalyzerIntegrationTest.loglevels.NotUsingSubstringOnLogLevel.approved.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 4 additions & 2 deletions
6
...ources/analyzer/AnalyzerIntegrationTest.loglevels.NotUsingSubstringOnMessage.approved.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
src/test/resources/scenarios/log-levels/HardCodingLogLevelsLowerCase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package scenarios.loglevels; | ||
|
||
public class LogLevels { | ||
public static String message(String logLine) { | ||
return logLine.substring(logLine.indexOf(":") + 1).trim(); | ||
} | ||
|
||
public static String logLevel(String logLine) { | ||
if (logLine.toLowerCase().contains("info")) | ||
return "info"; | ||
if (logLine.toLowerCase().contains("warning")) | ||
return "warning"; | ||
|
||
return "error"; | ||
} | ||
|
||
public static String reformat(String logLine) { | ||
return message(logLine) + " (" + logLevel(logLine) + ")"; | ||
} | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
tests/log-levels/no-substring-used/src/main/java/LogLevels.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters