How to CheckStyle a specific string in a filetype

266 Views Asked by At

I am currently figuring out a way on how to add a CheckStyle for Cucumber's Feature file. Tried searching but I couldn't find an answer.

Essentially what I want to accomplish is

  1. Search for a tag/string called @develop for every .feature file.
  2. If this tag is found, return the CheckStyle error.

As of now what I have is ( doesn't work ):

<?xml version="1.0"?>
<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.3//EN"  "http://checkstyle.sourceforge.net/dtds/configuration_1_3.dtd">
<module name="Checker">
    <property name="fileExtensions" value="feature"/>
    <module name="RegexpSingleline">
        <property name="format" value="@develop"/>
        <property name="minimum" value="0"/>
        <property name="maximum" value="0"/>
        <property name="message" value="Line has a @develop tag."/>
    </module>
</module>

When I tried :

<module name="Checker">
    <module name="Regexp">
        <property name="format" value="(@develop)"/>
    </module>
</module>

IntelliJ stated I can't add RegEx under Checker.

Here's my POM for the CheckStyle plugin

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <version>3.0.0</version>
                <configuration>
                    <skip>${skipStaticAnalysis}</skip>
                    <consoleOutput>true</consoleOutput>
                    <configLocation>build_config/checkstyle.xml</configLocation>
                    <propertyExpansion>basedir=${project.basedir}</propertyExpansion>
                    <violationSeverity>info</violationSeverity>
                    <includeTestSourceDirectory>true</includeTestSourceDirectory>
                    <sourceDirectories>
                        <sourceDirectory>${project.build.sourceDirectory}</sourceDirectory>
                    </sourceDirectories>
                </configuration>
                <executions>
                    <execution>
                        <phase>verify</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
0

There are 0 best solutions below