Module Opam_ci_check_lint

module Opam_helpers : sig ... end
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. | DuneIsBuild
  9. | BadDuneConstraint of string * string
  10. | NoPackageSources
  11. | UnexpectedFile of string
  12. | ForbiddenPerm of string
  13. | OpamLint of int * [ `Warning | `Error ] * string
  14. | MaintainerWithoutContact of string list
  15. | NameCollision of string
  16. | WeakChecksum of string
  17. | PinDepends
  18. | ExtraFiles
  19. | RestrictedPrefix of string
  20. | PrefixConflictClassMismatch of prefix_conflict_class_mismatch
  21. | DefaultTagsPresent of string list
  22. | MissingUpperBound of string
  23. | InvalidReasonForArchiving
  24. | InvalidOpamRepositoryCommitHash
  25. | InvalidConfPackage of [ `Conf_prefix | `Depext | `Conf_flag ] list

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