-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Updating dependencies and gradle build configuration * Implemented initial RuleExecuter * Implemented 4 initial POM rules with spock tests Co-authored-by: Kevin King <kking@avioconsulting.com> Co-authored-by: Nisarg Pansuria <npansuria@avioconsulting.com> Co-authored-by: Adam DesJardin <adesjardin@avioconsulting.com>
- Loading branch information
1 parent
8e59f14
commit 9595a18
Showing
33 changed files
with
1,607 additions
and
143 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,3 +28,4 @@ hs_err_pid* | |
.gradle/ | ||
|
||
build/ | ||
out/ |
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 |
---|---|---|
@@ -1,2 +1,11 @@ | ||
# mule-linter | ||
Mule Linter Tool | ||
#Mule Linter Tool | ||
A linter is a tool that analyzes source code looking for patterns that don’t follow convention. Linting helps prevent errors and improve the overall quality of the code by following best practices. Lint tools are a form of static code analyzers. Some common code analyzers for Java are Checkstyle, FindBugs, and PMD. | ||
|
||
The Mule Linter will enforce that all Mule projects are developed with a baseline set of rules. Some basic examples of rules that will be enforced, are the proper usage of property and pom files, useful logging messages, and standard project structure. | ||
|
||
## Mule Application Design | ||
![Mermaid Design](config/mermaid/mule-application-diagram.png) | ||
|
||
|
||
## Code Coverage | ||
[CodeNarc](https://codenarc.github.io/CodeNarc/) is used to ensure quality in groovy code. The configuration file is located [here.](config/codenarc/codenarc.xml) To execute run ```gradle check```, and an output [report](build/reports/codenarc/main.html) will be generated. |
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
Large diffs are not rendered by default.
Oops, something went wrong.
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,54 @@ | ||
<ruleset xmlns="http://codenarc.org/ruleset/1.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://codenarc.org/ruleset/1.0 http://codenarc.org/ruleset-schema.xsd" | ||
xsi:noNamespaceSchemaLocation="http://codenarc.org/ruleset-schema.xsd"> | ||
|
||
<description> | ||
Basic rule set. | ||
These rules are intended to be broadly (if not universally) applicable. | ||
</description> | ||
|
||
<rule class='org.codenarc.rule.basic.AssertWithinFinallyBlockRule'/> | ||
<rule class='org.codenarc.rule.basic.AssignmentInConditionalRule'/> | ||
<rule class='org.codenarc.rule.basic.BigDecimalInstantiationRule'/> | ||
<rule class='org.codenarc.rule.basic.BitwiseOperatorInConditionalRule'/> | ||
<rule class='org.codenarc.rule.basic.BooleanGetBooleanRule'/> | ||
<rule class='org.codenarc.rule.basic.BrokenNullCheckRule'/> | ||
<rule class='org.codenarc.rule.basic.BrokenOddnessCheckRule'/> | ||
<rule class='org.codenarc.rule.basic.ClassForNameRule'/> | ||
<rule class='org.codenarc.rule.basic.ComparisonOfTwoConstantsRule'/> | ||
<rule class='org.codenarc.rule.basic.ComparisonWithSelfRule'/> | ||
<rule class='org.codenarc.rule.basic.ConstantAssertExpressionRule'/> | ||
<rule class='org.codenarc.rule.basic.ConstantTernaryExpressionRule'/> | ||
<rule class='org.codenarc.rule.basic.ConstantIfExpressionRule'/> | ||
<rule class='org.codenarc.rule.basic.DeadCodeRule'/> | ||
<rule class='org.codenarc.rule.basic.DoubleNegativeRule'/> | ||
<rule class='org.codenarc.rule.basic.DuplicateCaseStatementRule'/> | ||
<rule class='org.codenarc.rule.basic.DuplicateMapKeyRule'/> | ||
<rule class='org.codenarc.rule.basic.DuplicateSetValueRule'/> | ||
<rule class='org.codenarc.rule.basic.EmptyCatchBlockRule'/> | ||
<rule class='org.codenarc.rule.basic.EmptyClassRule'/> | ||
<rule class='org.codenarc.rule.basic.EmptyElseBlockRule'/> | ||
<rule class='org.codenarc.rule.basic.EmptyFinallyBlockRule'/> | ||
<rule class='org.codenarc.rule.basic.EmptyForStatementRule'/> | ||
<rule class='org.codenarc.rule.basic.EmptyIfStatementRule'/> | ||
<rule class='org.codenarc.rule.basic.EmptySwitchStatementRule'/> | ||
<rule class='org.codenarc.rule.basic.EmptySynchronizedStatementRule'/> | ||
<rule class='org.codenarc.rule.basic.EmptyStaticInitializerRule'/> | ||
<rule class='org.codenarc.rule.basic.EmptyTryBlockRule'/> | ||
<rule class='org.codenarc.rule.basic.EmptyWhileStatementRule'/> | ||
<rule class='org.codenarc.rule.basic.EmptyInstanceInitializerRule'/> | ||
<rule class='org.codenarc.rule.basic.EmptyMethodRule'/> | ||
<rule class='org.codenarc.rule.basic.EqualsAndHashCodeRule'/> | ||
<rule class='org.codenarc.rule.basic.EqualsOverloadedRule'/> | ||
<rule class='org.codenarc.rule.basic.ExplicitGarbageCollectionRule'/> | ||
<rule class='org.codenarc.rule.basic.ForLoopShouldBeWhileLoopRule'/> | ||
<rule class='org.codenarc.rule.basic.HardCodedWindowsFileSeparatorRule'/> | ||
<rule class='org.codenarc.rule.basic.HardCodedWindowsRootDirectoryRule'/> | ||
<rule class='org.codenarc.rule.basic.IntegerGetIntegerRule'/> | ||
<rule class='org.codenarc.rule.basic.MultipleUnaryOperatorsRule'/> | ||
<rule class='org.codenarc.rule.basic.RandomDoubleCoercedToZeroRule'/> | ||
<rule class='org.codenarc.rule.basic.RemoveAllOnSelfRule'/> | ||
<rule class='org.codenarc.rule.basic.ReturnFromFinallyBlockRule'/> | ||
<rule class='org.codenarc.rule.basic.ThrowExceptionFromFinallyBlockRule'/> | ||
</ruleset> |
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,93 @@ | ||
classDiagram | ||
class Application{ | ||
+File applicationPath | ||
+String name | ||
+Map<String, ProjectFile> files | ||
+hasFile(name) | ||
+getFilesByType(type) | ||
+getPomFile() | ||
+getPropertyFiles() | ||
+getMuleConfigs() | ||
+getMuleArtifactJson() | ||
} | ||
Application "1" --> "*" ProjectFile | ||
class ProjectFile{ | ||
+String name | ||
+String type | ||
+String File | ||
} | ||
ProjectFile <|-- Pom | ||
class Pom { | ||
+hasProperty(name) | ||
+getMuleMavenVersion() | ||
+getMunitVersion() | ||
+getMuleVersion() | ||
} | ||
ProjectFile <|-- PropertyFile | ||
class PropertyFile { | ||
+hasProperty(propName) | ||
+isSecure(propName) | ||
} | ||
ProjectFile <|-- MuleArtifactJson | ||
class MuleArtifactJson { | ||
+hasSecureProperty(name) | ||
} | ||
ProjectFile <|-- GitIgnore | ||
class GitIgnore { | ||
+hasEntry(name) | ||
} | ||
|
||
ProjectFile <|-- MuleConfig | ||
class MuleConfig{ | ||
+MuleComponent[] components | ||
+hasGlobals() | ||
} | ||
|
||
MuleConfig "1" --> "*" MuleComponent | ||
class MuleComponent{ | ||
+String type | ||
+String name | ||
+Integer lineNumber | ||
+Map[] attributes | ||
+MuleComponent[] contains | ||
+hasComponent() | ||
+getComponent(name) | ||
+hasAttribute() | ||
+getAttribute(name) | ||
} | ||
MuleComponent <|-- MuleFlow | ||
class MuleFlow{ | ||
|
||
} | ||
MuleComponent <|-- MuleLogger | ||
class MuleLogger{ | ||
+hasMessage() | ||
+hasCategory() | ||
} | ||
MuleFlow "0" --> "*" MuleLogger | ||
class RuleExecuter { | ||
+Rule[] rules | ||
+executeRules() | ||
} | ||
RuleExecuter "1" --> "*" Rule | ||
class Rule{ | ||
+String ruleId | ||
+String ruleName | ||
+String severity | ||
+ProjectFile file | ||
+RuleResult result | ||
+execute() | ||
+raiseIssue() | ||
} | ||
Rule --> RuleResult | ||
class RuleResult{ | ||
+Boolean success | ||
+Integer lineNumber | ||
+String file | ||
+String severity | ||
+String message | ||
} | ||
Rule <|-- ASpecificRule | ||
class ASpecificRule { | ||
|
||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
#Mon Jun 29 21:21:08 CDT 2020 | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.2.1-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists | ||
zipStoreBase=GRADLE_USER_HOME |
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
Oops, something went wrong.