From 500d90a6c8fd33d32c1d807cc1195f149229dd0b Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Tue, 3 Jan 2017 19:57:43 +0000 Subject: [PATCH] builder: stub application --- .../CheckstyleRulesetBuilderApplication.java | 22 ++++++++ .../ruleset/builder/OutputProperties.java | 52 +++++++++++++++++++ .../checkstyle/ruleset/builder/Rule.java | 38 ++++++++++++++ .../checkstyle/ruleset/builder/RuleLevel.java | 15 ++++++ .../ruleset/builder/RuleParent.java | 12 +++++ .../ruleset/builder/RuleSource.java | 12 +++++ .../ruleset/builder/RulesProperties.java | 25 +++++++++ 7 files changed, 176 insertions(+) create mode 100644 src/builder/java/net/kemitix/checkstyle/ruleset/builder/CheckstyleRulesetBuilderApplication.java create mode 100644 src/builder/java/net/kemitix/checkstyle/ruleset/builder/OutputProperties.java create mode 100644 src/builder/java/net/kemitix/checkstyle/ruleset/builder/Rule.java create mode 100644 src/builder/java/net/kemitix/checkstyle/ruleset/builder/RuleLevel.java create mode 100644 src/builder/java/net/kemitix/checkstyle/ruleset/builder/RuleParent.java create mode 100644 src/builder/java/net/kemitix/checkstyle/ruleset/builder/RuleSource.java create mode 100644 src/builder/java/net/kemitix/checkstyle/ruleset/builder/RulesProperties.java diff --git a/src/builder/java/net/kemitix/checkstyle/ruleset/builder/CheckstyleRulesetBuilderApplication.java b/src/builder/java/net/kemitix/checkstyle/ruleset/builder/CheckstyleRulesetBuilderApplication.java new file mode 100644 index 0000000..4052038 --- /dev/null +++ b/src/builder/java/net/kemitix/checkstyle/ruleset/builder/CheckstyleRulesetBuilderApplication.java @@ -0,0 +1,22 @@ +package net.kemitix.checkstyle.ruleset.builder; + +import lombok.extern.slf4j.Slf4j; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +/** + * Creates the checkstyle ruleset files. + * + *

This application is intended to only to be used by the developer to create the actual checkstyle xml files that + * this module provides.

+ * + * @author Paul Campbell (pcampbell@kemitix.net) + */ +@Slf4j +@SpringBootApplication +public class CheckstyleRulesetBuilderApplication { + + public static void main(final String[] args) { + SpringApplication.run(CheckstyleRulesetBuilderApplication.class, args); + } +} diff --git a/src/builder/java/net/kemitix/checkstyle/ruleset/builder/OutputProperties.java b/src/builder/java/net/kemitix/checkstyle/ruleset/builder/OutputProperties.java new file mode 100644 index 0000000..dffb53f --- /dev/null +++ b/src/builder/java/net/kemitix/checkstyle/ruleset/builder/OutputProperties.java @@ -0,0 +1,52 @@ +package net.kemitix.checkstyle.ruleset.builder; + +import lombok.Getter; +import lombok.Setter; +import lombok.extern.slf4j.Slf4j; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +import java.io.File; + +/** + * Properties defining the output files. + * + * @author Paul Campbell (pcampbell@kemitix.net) + */ +@Slf4j +@Setter +@Getter +@Configuration +@ConfigurationProperties(prefix = "output") +class OutputProperties { + + /** + * The directory to create the output files in. + */ + private File directory; + + /** + * The name of the level 1 ruleset file. + */ + private String level1; + + /** + * The name of the level 2 ruleset file. + */ + private String level2; + + /** + * The name of the level 3 ruleset file. + */ + private String level3; + + /** + * The name of the level 4 ruleset file. + */ + private String level4; + + /** + * The name of the level 5 ruleset file. + */ + private String level5; +} diff --git a/src/builder/java/net/kemitix/checkstyle/ruleset/builder/Rule.java b/src/builder/java/net/kemitix/checkstyle/ruleset/builder/Rule.java new file mode 100644 index 0000000..810e906 --- /dev/null +++ b/src/builder/java/net/kemitix/checkstyle/ruleset/builder/Rule.java @@ -0,0 +1,38 @@ +package net.kemitix.checkstyle.ruleset.builder; + +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +import java.net.URI; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * . + * + * @author Paul Campbell (paul.campbell@hubio.com) + */ +@ToString +@Setter +@Getter +class Rule { + + private String name; + + private RuleParent parent; + + private RuleLevel level; + + private boolean enabled; + + private RuleSource source; + + private URI uri; + + private Map properties = new HashMap<>(); + + private List body = new ArrayList<>(); +} diff --git a/src/builder/java/net/kemitix/checkstyle/ruleset/builder/RuleLevel.java b/src/builder/java/net/kemitix/checkstyle/ruleset/builder/RuleLevel.java new file mode 100644 index 0000000..d9bda0c --- /dev/null +++ b/src/builder/java/net/kemitix/checkstyle/ruleset/builder/RuleLevel.java @@ -0,0 +1,15 @@ +package net.kemitix.checkstyle.ruleset.builder; + +/** + * . + * + * @author Paul Campbell (paul.campbell@hubio.com) + */ +public enum RuleLevel { + + LAYOUT, + NAMING, + JAVADOC, + TWEAKS, + COMPLEXITY; +} diff --git a/src/builder/java/net/kemitix/checkstyle/ruleset/builder/RuleParent.java b/src/builder/java/net/kemitix/checkstyle/ruleset/builder/RuleParent.java new file mode 100644 index 0000000..2928268 --- /dev/null +++ b/src/builder/java/net/kemitix/checkstyle/ruleset/builder/RuleParent.java @@ -0,0 +1,12 @@ +package net.kemitix.checkstyle.ruleset.builder; + +/** + * . + * + * @author Paul Campbell (paul.campbell@hubio.com) + */ +public enum RuleParent { + + CHECKER, + TREEWALKER; +} diff --git a/src/builder/java/net/kemitix/checkstyle/ruleset/builder/RuleSource.java b/src/builder/java/net/kemitix/checkstyle/ruleset/builder/RuleSource.java new file mode 100644 index 0000000..f168ea9 --- /dev/null +++ b/src/builder/java/net/kemitix/checkstyle/ruleset/builder/RuleSource.java @@ -0,0 +1,12 @@ +package net.kemitix.checkstyle.ruleset.builder; + +/** + * . + * + * @author Paul Campbell (paul.campbell@hubio.com) + */ +public enum RuleSource { + + CHECKSTYLE, + SEVNTU; +} diff --git a/src/builder/java/net/kemitix/checkstyle/ruleset/builder/RulesProperties.java b/src/builder/java/net/kemitix/checkstyle/ruleset/builder/RulesProperties.java new file mode 100644 index 0000000..ba37bdc --- /dev/null +++ b/src/builder/java/net/kemitix/checkstyle/ruleset/builder/RulesProperties.java @@ -0,0 +1,25 @@ +package net.kemitix.checkstyle.ruleset.builder; + +import lombok.Getter; +import lombok.Setter; +import lombok.extern.slf4j.Slf4j; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +import java.util.HashSet; +import java.util.Set; + +/** + * Properties defining the enabled rules for each level. + * + * @author Paul Campbell (pcampbell@kemitix.net) + */ +@Slf4j +@Setter +@Getter +@Configuration +@ConfigurationProperties(prefix = "rules") +class RulesProperties { + + public Set rules = new HashSet<>(); +}