Skip to content

objectionary/wpa

Repository files navigation

Whole-Program Analyzers for EO

EO principles respected here We recommend IntelliJ IDEA

mvn PDD status Maven Central Javadoc License

This Java package is a collection of whole-program analyzers (a.k.a. WPA lints) for XMIR — an intermediate representation of EO objects. WPA lints analyze a set of XMIR files together, rather than one file at a time.

Single-file lints live in a separate package, org.eolang:lints, which this library builds upon.

Add it to your project:

<dependency>
  <groupId>org.eolang</groupId>
  <artifactId>wpa</artifactId>
  <version>1.0-SNAPSHOT</version>
</dependency>

Then, run a whole-program analysis of XMIR files using the Program class:

import java.nio.file.Paths;
import org.eolang.lints.Program;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

final class Foo {
    @Test
    void testProgram() {
        Assertions.assertTrue(
            new Program(
                Paths.get("xmir-files")
            ).defects().isEmpty()
        );
    }
}

You can disable any particular linter with the help of the +unlint meta in your XMIR source.

Design of This Library

The library is designed as a set of Lint<Map<String, XML>> implementations. The Program class is the public entry point — it discovers .xmir files in a directory, runs all WPA lints, and returns the collected defects.

Classes exposed to users of the library:

  • Program — checker of a set of XMIR
  • Defect — a single defect discovered (from org.eolang:lints)
  • Severity — severity of a defect (from org.eolang:lints)

How to Contribute

Fork the repository, make changes, and send us a pull request. We will review your changes and apply them to the master branch shortly, provided they don't violate our quality standards. To avoid frustration, before sending us your pull request please run a full Maven build:

mvn clean install -Pqulice

You will need Maven 3.8+ and Java 11+.

About

Whole Program Analysis (WPA) linters for EO code

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Contributors