Skip to content
This repository has been archived by the owner on May 11, 2023. It is now read-only.

jqassistant-archive/jqassistant-hcl-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

73 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jQAssistant HCL Plugin

This project provides a jQAssistant plugin to analyze HCL language.

Usage

Prerequisites

  • Java 8 or higher

  • Maven 3.2.5 or higher

  • jQAssistant 1.8.0 or higher (see below)

Setup

The plugin can be enabled in Maven based project by adding it as a dependency to the jQAssistant Maven plugin:

pom.xml
<build>
    <plugins>
        <plugin>
            <groupId>com.buschmais.jqassistant</groupId>
            <artifactId>jqassistant-maven-plugin</artifactId>
            <version>${jqassistant.version}</version>
            <executions>
                <execution>
                    <id>default-cli</id>
                    <goals>
                        <goal>scan</goal>
                        <goal>analyze</goal>
                    </goals>
                    <configuration>
                        <concepts>
                            <concept>hcl:RootModule</concept>                               <!--(1)-->
                        </concepts>
                        <groups>
                            <group>hcl:Naming</group>
                            <group>hcl:Bugs</group>
                        </groups>
                    </configuration>
                </execution>
            </executions>
            <dependencies>
                <dependency>                                                                <!--(2)-->
                    <groupId>org.jqassistant.contrib.plugin</groupId>
                    <artifactId>jqassistant-hcl-plugin</artifactId>
                    <version>0.1.0</version>
                </dependency>
                <dependency>                                                                <!--(3)-->
                    <groupId>my.company</groupId>
                    <artifactId>my.rule.plugin</artifactId>
                    <version>1.0.0-SNAPSHOT</version>
                </dependency>
            </dependencies>
        </plugin>
    </plugins>
</build>
  1. Configure wanted concepts of the plugin.

  2. Declares the plugin as dependency of jQAssistant

  3. Add your company rules for terraform as a jQAssistant plugin (if needed)

HCL Grammar

Download the grammar and put the file into src/main/antlr4/prg/jqassistant/contrib/plugin/hcl/grammar/

Concepts to apply to Terraform files

hcl:RootModule

Identifies the root module. Makes further analysis simpler.

Rules/Contraint to apply to Terraform files

hcl:Naming

  • validates object names

  • ensures that input, output and local variables are defined in separate files

hcl:Bugs

Rules which prohibit the use of some terraform directives as they do not work.

Feedback

Please report any issues.

Acknowledgements

This plugin could not provide its functionality without the support of the following open source projects: