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 * OpamPackage.Name.t
  3. | UnmatchedVersion of OpamPackage.Version.t * OpamPackage.Version.t
  4. | DubiousDuneSubst
  5. | DuneIsBuild
  6. | NoPackageSources
  7. | UnexpectedFile of string
  8. | ForbiddenPerm of string
  9. | OpamLint of int * [ `Warning | `Error ] * string
  10. | MaintainerWithoutContact of string list
  11. | NameCollision of string
  12. | WeakChecksum of string
  13. | PinDepends
  14. | ExtraFiles
  15. | RestrictedPrefix of string
  16. | PrefixConflictClassMismatch of prefix_conflict_class_mismatch
  17. | DefaultTagsPresent of string list
  18. | MissingUpperBound of string
  19. | InvalidReasonForArchiving
  20. | InvalidOpamRepositoryCommitHash
  21. | InvalidConfPackage of [ `Conf_prefix | `Depext | `Conf_flag ] list

Errors detected during linting.

Use string_of_error to produce descriptions of the errors

val string_of_error : error -> string

string_of_error returns a string description of an error

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

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

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

msg_of_errors returns a string describing all the linting errors.

errors is a list of pairs of packages and the errors found for them. The function assumes that these list of pairs are ordered by package.

The output is human-friendly, grouping errors by package and adding indentation and newlines for readability. Use msg_of_errors_machine for output that is machine-friendly.

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

msg_of_errors_machine returns a string describing all the linting errors.

The output is a simple list of error messages, one per line. For a more human-friendly output, use msg_of_errors.

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 |> msg_of_errors