Skip to content

Commit

Permalink
Merge pull request #30 from avioconsulting/feature/MIP-431
Browse files Browse the repository at this point in the history
Ignore apikit flows for flow naming rule.
  • Loading branch information
kkingavio authored Jul 17, 2020
2 parents 6e19a6f + 72f1c72 commit 30533b7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package com.avioconsulting.mule.linter.rule.configuration
import com.avioconsulting.mule.linter.model.Application
import com.avioconsulting.mule.linter.model.CaseNaming
import com.avioconsulting.mule.linter.model.ConfigurationFile
import com.avioconsulting.mule.linter.model.configuration.MuleComponent
import com.avioconsulting.mule.linter.model.rule.Rule
import com.avioconsulting.mule.linter.model.rule.RuleViolation

Expand All @@ -26,19 +25,10 @@ class FlowSubflowNamingRule extends Rule {
List<RuleViolation> execute(Application app) {
List<RuleViolation> violations = []

app.configurationFiles.each {
configFile ->
flowSubFlowComponent.each {
element->
List<MuleComponent> flowsSubflows = configFile.findComponents(element.key,element.value)
flowsSubflows.each {
flowSubflow ->
String flowSubflowName = flowSubflow.getAttributeValue('name')
if (!caseNaming.isValidFormat(flowSubflowName)) {
violations.add(new RuleViolation(this, configFile.path,
flowSubflow.getLineNumber(), RULE_VIOLATION_MESSAGE + flowSubflowName))
}
}
app.allFlows.each { flow ->
if ( !flow.isApiKitFlow() && !caseNaming.isValidFormat(flow.name) ) {
violations.add(new RuleViolation(this, flow.file.path,
flow.lineNumber, RULE_VIOLATION_MESSAGE + flow.name))
}
}
return violations
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@ class FlowSubflowNamingRuleTest extends Specification {
}

private static final String FLOWS = '''
\t<flow name="get:\\user\\(id)\\roles:application\\json:my-api-config" doc:id="bcadf69e-4504-4654-9c7a-38971a01ed11" >
\t\t<logger level="INFO" doc:name="Logger" doc:id="6a676a90-4f3a-48c5-90af-358e8c1c298a" />
\t\t<flow-ref doc:name="Flow Reference" doc:id="4bc8fa65-90c4-454f-b5b7-c1c318f3a1cb" name="business-subflow-two"/>
\t</flow>
\t<sub-flow name="cameCaseFlowName">
\t\t<logger level="DEBUG" doc:name="Log Start" message="Starting" category="com.avioconsulting.mulelinter"/>
\t</sub-flow>
Expand Down

0 comments on commit 30533b7

Please sign in to comment.