builder:Application: list rules on startup

This commit is contained in:
Paul Campbell 2017-01-04 20:45:18 +00:00
parent 81bb3c02c4
commit d52b630db5

View file

@ -1,8 +1,10 @@
package net.kemitix.checkstyle.ruleset.builder; package net.kemitix.checkstyle.ruleset.builder;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
/** /**
* Creates the checkstyle ruleset files. * Creates the checkstyle ruleset files.
@ -19,4 +21,13 @@ public class CheckstyleRulesetBuilderApplication {
public static void main(final String[] args) { public static void main(final String[] args) {
SpringApplication.run(CheckstyleRulesetBuilderApplication.class, args); SpringApplication.run(CheckstyleRulesetBuilderApplication.class, args);
} }
@Bean
public CommandLineRunner listRules(final RulesProperties rulesProperties) {
return args -> rulesProperties.getRules()
.stream()
.map(Rule::getName)
.map(name -> String.format("- %s", name))
.forEach(System.out::println);
}
} }