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.
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 XMIRDefect— a single defect discovered (fromorg.eolang:lints)Severity— severity of a defect (fromorg.eolang:lints)
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 -PquliceYou will need Maven 3.8+ and Java 11+.