Class PackageLint

java.lang.Object
network.ike.docs.plugin.packages.PackageLint

public final class PackageLint extends Object
The ownership lint of the packages layout (dev-adoc-packages, IKE-Network/ike-issues#1341), the check that makes the layout a guarantee and not a habit. It fails the build with every finding listed:
  • the root holds nothing but dotted-group directories and META-INF: a file at the root, an images directory at the root, or a directory that is not a group is a finding;
  • every package begins with the module's own group, unless ike.adoc.packages declares another prefix on purpose;
  • a topic's directory equals the domain prefix of its :topic-id:, so that a person who knows a topic's id and its owner can write its include line without looking;
  • images are inside packages: an images directory directly under a group that is not itself a package is a finding.

An include or image line that still uses the {topics} alias is reported as a warning naming the file and line, so the alias can be retired once the last one is gone; it does not fail the build.

Since:
136
  • Field Details

  • Method Details

    • lint

      public static PackageLint.Report lint(Path root, String groupId, List<String> declared) throws IOException
      Lint a root.
      Parameters:
      root - the AsciiDoc root
      groupId - the module's group id, which every package begins with
      declared - package names or group prefixes ike.adoc.packages declares on purpose; a package passes the ownership rule when it equals one or begins with one followed by / or .
      Returns:
      the report
      Throws:
      IOException - if the tree cannot be read
    • owned

      public static boolean owned(String name, String groupId, List<String> declared)
      Whether a package passes the ownership rule.
      Parameters:
      name - the package name
      groupId - the module's group id
      declared - the prefixes ike.adoc.packages declares
      Returns:
      true when the package begins with the group or a declared prefix