Char Sniffer

Maven plugin to check char codes of text files

License

License

Categories

Categories

ORM Data
GroupId

GroupId

com.igormaznitsa
ArtifactId

ArtifactId

char-sniffer
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

maven-plugin
Description

Description

Char Sniffer
Maven plugin to check char codes of text files
Project URL

Project URL

https://github.com/raydac/char-sniffer
Project Organization

Project Organization

Igor Maznitsa
Source Code Management

Source Code Management

https://github.com/raydac/char-sniffer

Download char-sniffer

How to add to project

<plugin>
    <groupId>com.igormaznitsa</groupId>
    <artifactId>char-sniffer</artifactId>
    <version>1.0.0</version>
</plugin>

Dependencies

compile (6)

Group / Artifact Type Version
org.apache.maven : maven-plugin-api jar 2.0
commons-io : commons-io jar 2.5
commons-lang : commons-lang jar 2.6
org.codehaus.plexus : plexus-utils jar 3.0.8
com.igormaznitsa : meta-annotations jar 1.1.2
com.igormaznitsa : meta-utils jar 1.1.2

provided (1)

Group / Artifact Type Version
org.apache.maven.plugin-tools : maven-plugin-annotations jar 3.2

test (1)

Group / Artifact Type Version
junit : junit jar 4.12

Project Modules

There are no modules declared in this project.

License Apache 2.0 Java 6.0+ Maven central Maven 3.0.3+ PayPal donation Yandex.Money donation

Char Sniffer

A Small easy Maven plugin to check char codes in text files.

How to use?

For instance to restrict char codes (0-255) in text file License.txt situated in the root project folder, you can use such configuration

<plugin>
  <groupId>com.igormaznitsa</groupId>
  <artifactId>char-sniffer</artifactId>
  <version>1.0.0</version>
  <executions>
    <execution>
      <goals>
        <goal>sniff</goal>
      </goals>
      <configuration>
        <files>
          <file>${basedir}/License.txt</file>
        </files>
        <failForEmptyFile>true</failForEmptyFile>
        <minCharCode>0</minCharCode>
        <maxCharCode>255</maxCharCode>
      </configuration>
    </execution>
  </executions>
</plugin>

Also it is possible to define chars which will be only allowed in text files

<plugin>
  <groupId>com.igormaznitsa</groupId>
  <artifactId>char-sniffer</artifactId>
  <version>1.0.0</version>
  <executions>
    <execution>
      <goals>
        <goal>sniff</goal>
      </goals>
      <configuration>
         <files>
            <file>${basedir}/License.txt</file>
         </files>
         <abc>ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ,.'":;/@[]()-=*%0123456789Ü</abc>
      </configuration>
    </execution>
  </executions>
</plugin>

It is possible to disable some chars in text files. For instance below described how to disable © and ™ in text files.

<plugin>
  <groupId>com.igormaznitsa</groupId>
  <artifactId>char-sniffer</artifactId>
  <version>1.0.0</version>
  <executions>
    <execution>
      <goals>
        <goal>sniff</goal>
      </goals>
      <configuration>
         <files>
            <file>${basedir}/License.txt</file>
         </files>
         <noAbc>&#8482;&#9400;</noAbc>
      </configuration>
    </execution>
  </executions>
</plugin>

To be sure that UTF-8 codes of text files are ok, it is possible to use special flag validateUtf8, it will check that all UTF-8 chars have normal codes and there is not any broken char.

<plugin>
  <groupId>com.igormaznitsa</groupId>
  <artifactId>char-sniffer</artifactId>
  <version>1.0.0</version>
  <executions>
    <execution>
      <goals>
        <goal>sniff</goal>
      </goals>
      <configuration>
         <files>
            <file>${basedir}/License.txt</file>
         </files>
         <validateUtf8>true</validateUtf8>
      </configuration>
    </execution>
  </executions>
</plugin>

Versions

Version
1.0.0