-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgendocs.carp
More file actions
57 lines (47 loc) · 2.35 KB
/
gendocs.carp
File metadata and controls
57 lines (47 loc) · 2.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
(load "angler.carp")
(Project.config "title" "angler")
(Project.config "docs-directory" "./docs/")
(Project.config "docs-logo" "")
(Project.config "docs-url" "https://github.com/carpentry-org/angler")
(Project.config "docs-styling" "../style.css")
(Project.config "docs-prelude" "A pluggable linter for Carp source.
Built on
[`carpentry-org/carp-reader`](https://github.com/carpentry-org/carp-reader)
and
[`carpentry-org/parsec`](https://github.com/carpentry-org/parsec).
Most users invoke `angler` as a CLI (`angler FILE…`). The library
surface is documented here for plugin authors and programmatic
consumers. See
[the documentation on writing rules](https://github.com/carpentry-org/angler/blob/main/docs/WRITING-RULES.md).
```
(load \"git@github.com:carpentry-org/angler@0.1.0\")
(match (Lint.lint-source \"(do x)\")
(Result.Success diags) (for [i 0 (Array.length &diags)]
(IO.println &(Diagnostic.str (Array.unsafe-nth &diags i))))
(Result.Error e) (IO.errorln &(Parser.format-error &e)))
```
### Modules
- [`Lint`](./Lint.html), the rule registry, walker, and public entry points (`lint`, `lint-with`, `lint-source`, `lint-source-with`, `register-rule!`, `list-rules`).
- [`Diagnostic`](./Diagnostic.html), one finding's data and renderer (`line:col: [rule] message`).
- [`Rule`](./Rule.html), the registry entry: name, description, and matcher function.
### Built-in rules
- `lonely-do`, on `(do x)`.
- `empty-do`, on `(do)`.
- `if-with-do`, on `(if c (do …) ())` and `(if c () (do …))`.
- `if-one-branch-empty`, on `(if c x ())` and `(if c () x)` (non-do bodies).
- `form-with-do`, on `(let / while / when / unless ... (do …))`.
- `when-with-not`, on `(when (not c) x)` and `(unless (not c) x)`.
- `not-equal`, on `(not (= a b))`.
- `double-not`, on `(not (not x))`.
- `set-self`, on `(set! x x)`.
- `try-around-atomic`, on `(Parser.try (Parser.string/byte …))`.
- `non-kebab-case-defn`, on `(defn FooBar …)`.
- `non-pascal-case-defmodule`, on `(defmodule my-thing …)`.
### CLI
- `angler FILE [FILE…]`, lints every file with every registered rule.
- `--only RULES`, comma-separated allow-list.
- `--disable RULES`, comma-separated deny-list.
- `--list-rules`, prints the registry and exits.
- `-h`, `--help`, prints usage.")
(save-docs Lint Diagnostic Rule)
(defn main [] (System.system "mv ./docs/angler_index.html ./docs/index.html"))