Skip to content

Commit

Permalink
Extract lint functionality as a separate library
Browse files Browse the repository at this point in the history
Co-authored-by: Shon Feder <shon.feder@gmail.com>
  • Loading branch information
punchagan and shonfeder committed Jan 28, 2025
1 parent 9f2607d commit 76dd306
Show file tree
Hide file tree
Showing 8 changed files with 63 additions and 5 deletions.
41 changes: 41 additions & 0 deletions opam-ci-check-lint.opam
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
opam-version: "2.0"
synopsis:
"Library to lint opam files submitted to the opam repository"
description:
"opam-ci-check-lint exposes the lint functionality used in the opam repo CI and opam-ci-check. It can be used in other packages such as opam publishing tools to ensure that the published package opam files are correct."
maintainer: [
"Puneeth Chaganti <punchagan@muse-amuse.in>"
"Shon Feder <shon.feder@gmail.com>"
]
authors: [
"Puneeth Chaganti <punchagan@muse-amuse.in>"
"Shon Feder <shon.feder@gmail.com>"
]
license: "Apache-2.0"
tags: ["opam" "ci" "lint"]
homepage: "https://github.com/ocurrent/opam-repo-ci/tree/master/opam-ci-check"
doc: "https://www.ocurrent.org/opam-repo-ci/opam-ci-check-lint/index.html"
bug-reports: "https://github.com/ocurrent/opam-repo-ci/issues"
depends: [
"ocaml" {>= "4.14.0"}
"dune" {>= "3.16"}
"sexplib"
"opam-state" {>= "2.3.0~alpha1"}
"opam-format" {>= "2.3.0~alpha1"}
"odoc" {with-doc}
]
build: [
["dune" "subst"] {dev}
[
"dune"
"build"
"-p"
name
"-j"
jobs
"@install"
"@runtest" {with-test}
"@doc" {with-doc}
]
]
dev-repo: "git+https://github.com/ocurrent/opam-repo-ci.git"
10 changes: 9 additions & 1 deletion opam-ci-check/lib/dune
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,12 @@
(public_name opam-ci-check)
(preprocess
(pps ppx_deriving.std ppx_deriving_yojson))
(libraries opam-client sexplib bos fpath str ocaml-version obuilder-spec))
(libraries
opam-client
sexplib
bos
fpath
str
ocaml-version
obuilder-spec
opam-ci-check-lint))
4 changes: 2 additions & 2 deletions opam-ci-check/lib/opam_ci_check.ml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

module Revdeps = Revdeps
module Test = Test
module Lint = Lint
module Lint = Opam_ci_check_lint
module Opam_helpers = Opam_ci_check_lint.Opam_helpers
module Opam_build = Opam_build
module Variant = Variant
module Opam_version = Opam_version
module Compiler_version = Compiler_version
module Spec = Spec
module Opam_helpers = Opam_helpers
4 changes: 4 additions & 0 deletions opam-ci-check/lint/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
(library
(name opam_ci_check_lint)
(public_name opam-ci-check-lint)
(libraries opam-state opam-format sexplib str))
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
* Copyright (c) 2024 Puneeth Chaganti <punchagan@muse-amuse.in>, Shon Feder <shon.feder@gmail.com>, Tarides <contact@tarides.com>
*)

module O = Opam_helpers
module Opam_helpers = Opam_helpers


let ( // ) = Filename.concat
let get_files dir = dir |> Sys.readdir |> Array.to_list
Expand Down Expand Up @@ -303,7 +304,7 @@ module Checks = struct
| _ -> false

let check_package_dir ~opam_repo_dir ~pkg _opam =
let dir = O.path_from_pkg ~opam_repo_dir pkg in
let dir = Opam_helpers.path_from_pkg ~opam_repo_dir pkg in
let check_file = function
| "opam" ->
let path = dir // "opam" in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
* Copyright (c) 2024 Puneeth Chaganti <punchagan@muse-amuse.in>, Shon Feder <shon.feder@gmail.com>, Tarides <contact@tarides.com>
*)

module Opam_helpers : sig
val path_from_pkg : opam_repo_dir:string -> OpamPackage.t -> string
end

include module type of Lint_error

module Checks : sig
Expand Down
File renamed without changes.

0 comments on commit 76dd306

Please sign in to comment.