Module Opam_ci_check.Lint

type prefix_conflict_class_mismatch =
  1. | WrongPrefix of {
    1. conflict_class : string;
    2. required_prefix : string;
    }
  2. | WrongConflictClass of {
    1. prefix : string;
    2. required_conflict_class : string;
    }

Some package name prefixes must be used along with specific conflict classes

If either a restricted prefix or conflict class exists, then the corresponding other must also exist.

type error =
  1. | UnnecessaryField of string
  2. | UnmatchedName of OpamPackage.Name.t
  3. | UnmatchedVersion of OpamPackage.Version.t
  4. | DubiousDuneSubst
  5. | DuneProjectMissing
  6. | DuneProjectParseError of string
  7. | DuneDependencyMissing
  8. | DuneLowerBoundMissing
  9. | DuneIsBuild
  10. | BadDuneConstraint of string * string
  11. | NoPackageSources
  12. | UnexpectedFile of string
  13. | ForbiddenPerm of string
  14. | OpamLint of int * [ `Warning | `Error ] * string
  15. | MaintainerWithoutContact of string list
  16. | NameCollision of string
  17. | WeakChecksum of string
  18. | PinDepends
  19. | ExtraFiles
  20. | RestrictedPrefix of string
  21. | PrefixConflictClassMismatch of prefix_conflict_class_mismatch
  22. | DefaultTagsPresent of string list
  23. | MissingUpperBound of string
  24. | InvalidReasonForArchiving
  25. | InvalidOpamRepositoryCommitHash

Errors detected during linting.

Use msg_of_error to produce descriptions the errors

val msg_of_error : (OpamPackage.t * error) -> string

msg_of_error (pkg, err) is a string describing a linting err found for the pkg

module Checks : sig ... end
type t

The data describing a package that is needed for linting it.

val v : pkg:OpamPackage.t -> ?newly_published:bool option -> pkg_src_dir:string option -> OpamFile.OPAM.t -> t

Create an object of type t

  • parameter pkg

    Package that is being linted.

  • parameter pkg_src_dir

    The path to a directory containing the package sources.

  • parameter newly_published

    Flag to indicate if the pkg is being newly published to the repository, meaning no previous versions of the package have been published. Some additional checks are run for such packages.

  • parameter opam

    Parsed OPAM metadata for the package.

val lint_packages : ?checks:Checks.kind list -> opam_repo_dir:string -> t list -> ((OpamPackage.t * error) list, string) Stdlib.result

lint_packages ~opam_repo_dir metas is a list of all the errors detected while linting the packages in the metas list in the context of the opam repository located at opam_repo_dir.

  • parameter opam_repo_dir

    The path a local opam repository.

    Examples:

    let passes_all_checks = assert (lint_packages ~opam_repo_dir metas |> Result.get_ok |> List.length = 0)
    let failed_some_checks = assert (lint_packages ~opam_repo_dir metas |> Result.get_ok |> List.length > 0)
    let messages_for_all_failed_checks =
      lint_packages ~opam_repo_dir ~repo_packages metas
      |> Result.get_ok |> List.map msg_of_error