Browse Source

first commit

pull/16/head
zapashcanon 3 years ago
commit
ce128cf886
Signed by: zapashcanon GPG Key ID: 8981C3C62D1D28F1
  1. 2
      .gitignore
  2. 61
      .ocamlformat
  3. 4
      CHANGES.md
  4. 8
      LICENSE.md
  5. 19
      README.md
  6. 24
      dune-project
  7. 26
      orel.opam
  8. 4
      src/dune
  9. 34
      src/orel.ml

2
.gitignore

@ -0,0 +1,2 @@
_build
_coverage

61
.ocamlformat

@ -0,0 +1,61 @@
version=0.18.0
align-cases=false
align-constructors-decl=false
align-variants-decl=false
assignment-operator=end-line
break-before-in=fit-or-vertical
break-cases=all
break-collection-expressions=fit-or-vertical
break-fun-decl=wrap
break-fun-sig=wrap
break-infix=wrap
break-infix-before-func=false
break-separators=before
break-sequences=true
break-string-literals=auto
break-struct=force
cases-exp-indent=2
cases-matching-exp-indent=normal
disambiguate-non-breaking-match=false
doc-comments=before
doc-comments-padding=2
doc-comments-tag-only=default
dock-collection-brackets=false
exp-grouping=preserve
extension-indent=2
field-space=loose
function-indent=2
function-indent-nested=never
if-then-else=k-r
indent-after-in=0
indicate-multiline-delimiters=space
indicate-nested-or-patterns=unsafe-no
infix-precedence=indent
leading-nested-match-parens=false
let-and=sparse
let-binding-indent=2
let-binding-spacing=compact
let-module=compact
margin=80
match-indent=0
match-indent-nested=never
max-indent=68
module-item-spacing=sparse
nested-match=wrap
ocp-indent-compat=false
parens-ite=false
parens-tuple=always
parens-tuple-patterns=multi-line-only
parse-docstrings=true
sequence-blank-line=preserve-one
sequence-style=terminator
single-case=compact
space-around-arrays=true
space-around-lists=true
space-around-records=true
space-around-variants=true
stritem-extension-indent=0
type-decl=sparse
type-decl-indent=2
wrap-comments=false
wrap-fun-args=true

4
CHANGES.md

@ -0,0 +1,4 @@
## Unreleased
- first release

8
LICENSE.md

@ -0,0 +1,8 @@
The ISC License (ISC)
=====================
Copyright © 2021, OCamlPro
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

19
README.md

@ -0,0 +1,19 @@
# orel
Orel is a linter for [OCaml] repositories.
## Quickstart
```sh
orel yourgitrepository
```
## About
- [LICENSE]
- [CHANGELOG]
[CHANGELOG]: ./CHANGES.md
[LICENSE]: ./LICENSE.md
[OCaml]: https://ocaml.org

24
dune-project

@ -0,0 +1,24 @@
(lang dune 2.8)
(name orel)
(license ISC)
(generate_opam_files true)
(package
(name orel)
(synopsis "OCaml repository linter")
(description "OCaml repository linter")
(depends
(ocaml
(>= 4.05))
(dune
(>= 2.8))
(bos
(>= 0.2))
(bisect_ppx
(and
:with-test
(>= "2.6")
:dev))))

26
orel.opam

@ -0,0 +1,26 @@
# This file is generated by dune, edit dune-project instead
opam-version: "2.0"
synopsis: "OCaml repository linter"
description: "OCaml repository linter"
license: "ISC"
depends: [
"ocaml" {>= "4.05"}
"dune" {>= "2.8" & >= "2.8"}
"bos" {>= "0.2"}
"bisect_ppx" {with-test & >= "2.6" & dev}
"odoc" {with-doc}
]
build: [
["dune" "subst"] {dev}
[
"dune"
"build"
"-p"
name
"-j"
jobs
"@install"
"@runtest" {with-test}
"@doc" {with-doc}
]
]

4
src/dune

@ -0,0 +1,4 @@
(executable
(name orel)
(modules orel)
(libraries bos))

34
src/orel.ml

@ -0,0 +1,34 @@
let error msg =
Format.eprintf "ERROR: %s@." msg;
exit 1
let () =
if Array.length Sys.argv <> 2 then
error (Format.sprintf "usage: %s yourgitrepository" Sys.argv.(0));
let repo = Sys.argv.(1) in
let tmp_dir =
match Bos.OS.Dir.tmp "orel_%s" with
| Ok x -> x
| Error _e -> error "can't create tmp_dir"
in
let tmp_dir_s = Fpath.to_string tmp_dir in
Format.printf "cloning your repository `%s` into `%s`@." repo tmp_dir_s;
let clone_repo = Bos.Cmd.(v "git" % "clone" % repo % tmp_dir_s) in
( match Bos.OS.Cmd.run_status ~quiet:true clone_repo with
| Ok _res -> ()
| Error _e -> error "can't clone repository" );
Format.printf "listing your repository content@.";
let contents = Bos.OS.Dir.contents ~dotfiles:true ~rel:true tmp_dir in
match contents with
| Ok contents ->
List.iter (fun p -> Format.printf "--- %s@." (Fpath.to_string p)) contents
| Error _e -> error "can't get your repository content@."
Loading…
Cancel
Save