Skip to content
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

Add rule to limit excessive use of sequential loggers #56

Merged
merged 17 commits into from
Oct 13, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Change constructor to use EnumMap rather than Map
  • Loading branch information
MrMcCartney committed Oct 13, 2020
commit a8f32974000424e5ea2178d9fa99fb97ff7f7994
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,16 @@ class ExcessiveLoggersRule extends Rule {
ExcessiveLoggersRule() {}

ExcessiveLoggersRule(Integer excessiveLoggers) {
this([(LoggerComponent.LogLevel.TRACE): excessiveLoggers,
this.ruleId = RULE_ID
this.ruleName = RULE_NAME
this.excessiveLoggers.putAll([(LoggerComponent.LogLevel.TRACE): excessiveLoggers,
(LoggerComponent.LogLevel.DEBUG): excessiveLoggers,
(LoggerComponent.LogLevel.INFO): excessiveLoggers,
(LoggerComponent.LogLevel.WARN): excessiveLoggers,
(LoggerComponent.LogLevel.ERROR): excessiveLoggers]
)
(LoggerComponent.LogLevel.ERROR): excessiveLoggers])
}

ExcessiveLoggersRule(Map<LoggerComponent.LogLevel, Integer> excessiveLoggers) {
ExcessiveLoggersRule(EnumMap<LoggerComponent.LogLevel, Integer> excessiveLoggers) {
this.ruleId = RULE_ID
this.ruleName = RULE_NAME
this.excessiveLoggers.putAll excessiveLoggers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ class ExcessiveLoggersRuleTest extends Specification{

def 'Custom excessive loggers rule fails no flows'() {
given:
Rule rule = new ExcessiveLoggersRule([(LoggerComponent.LogLevel.TRACE): 2,
(LoggerComponent.LogLevel.DEBUG): 3,
(LoggerComponent.LogLevel.INFO): 3,
(LoggerComponent.LogLevel.WARN): 2,
(LoggerComponent.LogLevel.ERROR): 4])

EnumMap<LoggerComponent.LogLevel, Integer> excessiveLoggers = [(LoggerComponent.LogLevel.TRACE): 2,
(LoggerComponent.LogLevel.DEBUG): 3,
(LoggerComponent.LogLevel.INFO): 3,
(LoggerComponent.LogLevel.WARN): 2,
(LoggerComponent.LogLevel.ERROR): 4]
Rule rule = new ExcessiveLoggersRule(excessiveLoggers)

when:
Application app = new Application(testApp.appDir)
Expand Down