<commit_before>lantern
======

Maven Plugin for java static analysis

To build
> `mvn package install``

To run with default rule:
> `mvn com.leozc:lantern:blacklist -Dlantern.rulefile="samplerule.json"`

It generates the scan result in latern.blacklist.out, it contains lines of records look like this:
> `commons-lang3-3.1.jar:SystemUtils.java:L0:org/apache/commons/lang3/SystemUtils.getSystemProperty@(Ljava/lang/String;)Ljava/lang/String;:calls java/io/PrintStream.void println(String)`


You can use grep/cut and further process the result.
<commit_msg>Added read me.<commit_after>lantern
======

Maven Plugin for java static analysis

To build
> `mvn package install``

To run with default rule:
> `mvn com.leozc:lantern:blacklist -Dlantern.rulefile="samplerule.json"`

It generates the scan result in latern.blacklist.out, it contains lines of records look like this:
> `commons-lang3-3.1.jar:SystemUtils.java:L0:org/apache/commons/lang3/SystemUtils.getSystemProperty@(Ljava/lang/String;)Ljava/lang/String;:calls java/io/PrintStream.void println(String)`

To include the plugin in you normal maven build process (mvn 3.01+), please put the follow sections in the plugins.<br/>
The first part is the maven dependencies tree, which we need that for actual work, second part is the actual configuration for the plugin.
>`
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <id>copy-dependencies</id>
            <phase>process-test-classes</phase>
            <goals>
              <goal>copy-dependencies</goal>
            </goals>
            <configuration>
              <outputDirectory>${project.build.directory}/dependency</outputDirectory>
              <overWriteReleases>false</overWriteReleases>
              <overWriteSnapshots>false</overWriteSnapshots>
              <overWriteIfNewer>true</overWriteIfNewer>
            </configuration>
          </execution>
        </executions>
      </plugin>
 
      <plugin>
        <groupId>com.leozc</groupId>
        <artifactId>lantern</artifactId>
        <executions>
          <execution>
            <phase>test</phase>
            <goals>
              <goal>findcaller</goal>
            </goals>
            <configuration>
                <!--rulefile>/media/JUNKBOX/leozc/workspace/tools/lantern/blacklist.json</rulefile-->
                <scandependency>true</scandependency>
            </configuration>
          </execution>
        </executions>
      </plugin>
`
You can use grep/cut and further process the result.

{'fraction_non_alphanumeric': 0.11276190476190476, 'fraction_numerical': 0.004952380952380952, 'mean_word_length': 2.861764705882353, 'pattern_counts': {'":': 0, '<': 54, '<?xml version=': 0, '>': 61, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5840284', 'n_tokens_mistral': 799, 'n_tokens_neox': 759, 'n_words': 175}