## Built-in rules

Available built-in rules:

Name | Rationale | Description
--- | --- | ---
aliasesShouldBeListedInDictionary | Consistency | Checks that every alias is referenced in a given dictionary file.
aliasesShouldBeUnique | Consistency | Checks that aliases are not declared more than once. They can of course be used several times in many relationships but only once as entities.
aliasesShouldFollowStandardConvention | Maintainability | Checks that the aliases comply to a given regular expression.
noDuplicateRelationships | Consistency | Checks that relationships are not declared more than once.
noOrphanAliasInBoundaries | Consistency | Checks that the aliases used in a boundary are declared in the same source file as part of any entity.
noOrphanAliasInLayouts | Consistency | Checks that the aliases used in a layout are declared in the same source file as part of any entity.
noOrphanAliasInRelationships | Consistency | Checks that the aliases used in a relationship are declared in the same source file as part of any entity.

### Rule details

#### aliasesShouldBeListedInDictionary

Checks that every alias is referenced in a given dictionary file. Please note that if the `<aliasDictionaryFilename>` is left empty, then the rule won’t run. A warning message will be displayed but the no violation will be reported. You can disable the rule or provide a valid dictionary file to get rid of that warning.

##### Rationale behind the rule

Information consistency. We believe that it can useful to list every declared alias in a project in a flat file, especially if you want to match the declared aliases with product keys imported from your enterprise architecture repository.

##### Parameters

Name | Type | Since | Description
--- | --- | --- | ---
<aliasDictionaryFilename> | `String` | `1.0.0` | Sets the name of the dictionary file to use. If no value is set or if it is left empty, then the rule won’t run and a warning message will be displayed. Required: `No`. Default value: empty
<isActivated> | `boolean` | `1.0.0` | Disables the rule when set to `false`. Required: `No`. Default value: `true`

The following disables the rule:

    <build>
        <plugins>
            <plugin>
                <groupId>org.thewonderlemming.c4plantuml</groupId>
                <artifactId>c4plantuml-maven-plugin</artifactId>
                <version>1.0.0-RC1</version>
                <executions>
                    <execution>
                        <id>linting-c4-files</id>
                        <goals>
                            <goal>lint</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <aliasesShouldBeListedInDictionary>
                                    <isActivated>false</isActivated>
                                </aliasesShouldBeListedInDictionary>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

The following provides a dictionary filename:

    <build>
        <plugins>
            <plugin>
                <groupId>org.thewonderlemming.c4plantuml</groupId>
                <artifactId>c4plantuml-maven-plugin</artifactId>
                <version>1.0.0-RC1</version>
                <executions>
                    <execution>
                        <id>linting-c4-files</id>
                        <goals>
                            <goal>lint</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <aliasesShouldBeListedInDictionary>
                                    <aliasDictionaryFilename>/absolute/path/to/my-dictionary.txt</aliasDictionaryFilename>
                                </aliasesShouldBeListedInDictionary>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

#### aliasesShouldBeUnique

Checks that aliases are not declared more than once. They can of course be used several times in many relationships but only once as entities.

##### Rationale behind the rule

Information consistency. Having multiple C4 entities identified by the same alias means that we are overriding the definitions and hence that the last defined entity will be the one to appear, discarding the others. This usually means that there is a typo.

##### Parameters

Name | Type | Since | Description
--- | --- | --- | ---
<isActivated> | `boolean` | `1.0.0` | Disables the rule when set to `false`. Required: `No`. Default value: `true`

The following disables the rule:

    <build>
        <plugins>
            <plugin>
                <groupId>org.thewonderlemming.c4plantuml</groupId>
                <artifactId>c4plantuml-maven-plugin</artifactId>
                <version>1.0.0-RC1</version>
                <executions>
                    <execution>
                        <id>linting-c4-files</id>
                        <goals>
                            <goal>lint</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <aliasesShouldBeUnique>
                                    <isActivated>false</isActivated>
                                </aliasesShouldBeUnique>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

#### aliasesShouldFollowStandardConvention

Checks that the aliases comply to a given regular expression. The default regular expression is `^[a-zA-Z_-]+$`.

##### Rationale behind the rule

Maintainability. It is way easier to change a diagram when you already which conventions are being used.

##### Parameters

Name | Type | Since | Description
--- | --- | --- | ---
<aliasDefaultFormatRegex> | `String` | `1.0.0` | Sets the regular expression to use when verifying aliases format. Please note that the given value needs to be a subset of `^[a-zA-Z\d_-]+$`, as it is how aliases are defined in the grammar. Required: `No`. Default value: `^[a-zA-Z_-]+$`
<isActivated> | `boolean` | `1.0.0` | Disables the rule when set to `false`. Required: `No`. Default value: `true`

##### Example

The following sample configures the rule to check aliases against the `^[a-zA-Z]+$` regular expression instead of using the default one:

    <build>
        <plugins>
            <plugin>
                <groupId>org.thewonderlemming.c4plantuml</groupId>
                <artifactId>c4plantuml-maven-plugin</artifactId>
                <version>1.0.0-RC1</version>
                <executions>
                    <execution>
                        <id>linting-c4-files</id>
                        <goals>
                            <goal>lint</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <aliasesShouldFollowStandardConvention>
                                    <aliasDefaultFormatRegex>^[a-zA-Z]+$</aliasDefaultFormatRegex>
                                </aliasesShouldFollowStandardConvention>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

#### noDuplicateRelationships

Checks that the declared relationships are not declared more than once.

Relationships are considered identical is they share the same source alias, target alias and label.

##### Rationale behind the rule

Information consistency. PlantUML won’t complain if you declare a relationship multiple times but will use the last one, which makes it difficult to read and maintain a source file, as some changes might not be propagated.

##### Parameters

Name | Type | Since | Description
--- | --- | --- | ---
<isActivated> | `boolean` | `1.0.0` | Disables the rule when set to `false`. Required: `No`. Default value: `true`

The following disables the rule:

    <build>
        <plugins>
            <plugin>
                <groupId>org.thewonderlemming.c4plantuml</groupId>
                <artifactId>c4plantuml-maven-plugin</artifactId>
                <version>1.0.0-RC1</version>
                <executions>
                    <execution>
                        <id>linting-c4-files</id>
                        <goals>
                            <goal>lint</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <noDuplicateRelationships>
                                    <isActivated>false</isActivated>
                                </noDuplicateRelationships>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

#### noOrphanAliasInBoundaries

Checks that the aliases used in a boundary are declared in the same source file as part of any entity.

##### Rationale behind the rule

Information consistency. An orphan alias in a boundary means that the element identified by the alias won’t be categorized as a C4 entity but will be left as default PlantUML element instead. This usually means that the there is a typo.

##### Parameters

Name | Type | Since | Description
--- | --- | --- | ---
<isActivated> | `boolean` | `1.0.0` | Disables the rule when set to `false`. Required: `No`. Default value: `true`

The following disables the rule:

    <build>
        <plugins>
            <plugin>
                <groupId>org.thewonderlemming.c4plantuml</groupId>
                <artifactId>c4plantuml-maven-plugin</artifactId>
                <version>1.0.0-RC1</version>
                <executions>
                    <execution>
                        <id>linting-c4-files</id>
                        <goals>
                            <goal>lint</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <noOrphanAliasInBoundaries>
                                    <isActivated>false</isActivated>
                                </noOrphanAliasInBoundaries>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

#### noOrphanAliasInLayouts

Checks that the aliases used in a layout are declared in the same source file as part of any entity.

##### Rationale behind the rule

Information consistency. An orphan alias in a layout means that the element identified by the alias won’t be categorized as a C4 entity but will be left as default PlantUML element instead. This usually means that the there is a typo.

##### Parameters

Name | Type | Since | Description
--- | --- | --- | ---
<isActivated> | `boolean` | `1.0.0` | Disables the rule when set to `false`. Required: `No`. Default value: `true`

The following disables the rule:

    <build>
        <plugins>
            <plugin>
                <groupId>org.thewonderlemming.c4plantuml</groupId>
                <artifactId>c4plantuml-maven-plugin</artifactId>
                <version>1.0.0-RC1</version>
                <executions>
                    <execution>
                        <id>linting-c4-files</id>
                        <goals>
                            <goal>lint</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <noOrphanAliasInLayouts>
                                    <isActivated>false</isActivated>
                                </noOrphanAliasInLayouts>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

#### noOrphanAliasInRelationships

Checks that the aliases used in a relationship are declared in the same source file as part of any entity.

##### Rationale behind the rule

Information consistency. An orphan alias in a relationship means that the element identified by the alias won’t be categorized as a C4 entity but will be left as default PlantUML element instead. This usually means that the there is a typo.

##### Parameters

Name | Type | Since | Description
--- | --- | --- | ---
<isActivated> | `boolean` | `1.0.0` | Disables the rule when set to `false`. Required: `No`. Default value: `true`

The following disables the rule:

    <build>
        <plugins>
            <plugin>
                <groupId>org.thewonderlemming.c4plantuml</groupId>
                <artifactId>c4plantuml-maven-plugin</artifactId>
                <version>1.0.0-RC1</version>
                <executions>
                    <execution>
                        <id>linting-c4-files</id>
                        <goals>
                            <goal>lint</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <noOrphanAliasInRelationships>
                                    <isActivated>false</isActivated>
                                </noOrphanAliasInRelationships>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>