-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgleam.toml
More file actions
132 lines (127 loc) · 5.54 KB
/
Copy pathgleam.toml
File metadata and controls
132 lines (127 loc) · 5.54 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
name = "metamon"
version = "0.9.0"
description = "Property-based testing and metamorphic testing combinator library for Gleam"
licences = ["MIT"]
repository = { type = "github", user = "nao1215", repo = "metamon" }
[dependencies]
gleam_stdlib = ">= 0.44.0 and < 2.0.0"
gleam_json = ">= 3.0.0 and < 4.0.0"
simplifile = ">= 2.0.0 and < 3.0.0"
[dev-dependencies]
gleeunit = ">= 1.0.0 and < 2.0.0"
glinter = ">= 2.14.0 and < 3.0.0"
[tools.glinter]
warnings_as_errors = true
include = ["src/", "test/"]
[tools.glinter.rules]
assert_ok_pattern = "error"
# Runner / stateful / generator modules deliberately panic with
# structured messages on failed properties — this is the entire
# failure-report delivery channel and panic is the only signal
# gleeunit reads. The rule stays on globally so accidental panics
# in non-runner code still fail the build; the runner / stateful /
# generator modules waive it via the per-file ignore list below.
avoid_panic = "error"
avoid_todo = "error"
deep_nesting = "error"
# `Result` discarding is unavoidable in defensive paths
# (`simplifile.write` for the regression file, `dict.upsert`
# returning an unchanged value, `int.parse` in lenient parsers).
# The signal-to-noise on a property-testing library is too low for
# this rule.
discarded_result = "off"
division_by_zero = "error"
duplicate_import = "error"
echo = "error"
error_context_lost = "error"
# The metamon FFI seam (process state, microsecond clock,
# panic capture) is centralised in `src/metamon_ffi.{erl,mjs}`
# and the modules that wrap it.
ffi_usage = "error"
function_complexity = "error"
# Labelled-argument adoption is a follow-up project that touches
# every public function. Disabled globally for the v0.x line; the
# ratchet flips back on once the labelled-argument refactor lands.
label_possible = "off"
missing_labels = "error"
missing_type_annotation = "error"
module_complexity = "error"
panic_without_message = "error"
# Style rule that forces `use <- bool.guard` over `case True/False`.
# Both shapes read fine; the choice is local to each call site.
prefer_guard_clause = "off"
redundant_case = "error"
short_variable_name = "error"
# `string.inspect` is the failure-report renderer's only safe way
# to display values of unknown types. Disabled globally for the
# library; consumer code is welcome to flip it back on locally.
string_inspect = "off"
stringly_typed_error = "error"
# Defensive `Result` patterns return a default value for malformed
# input (regression file parser, coverage state coercion, dict
# lookups). Propagating the error would tear down the property run;
# silently falling back is the documented behaviour.
thrown_away_error = "off"
todo_without_message = "error"
trailing_underscore = "error"
unnecessary_string_concatenation = "error"
unnecessary_variable = "error"
unqualified_import = "error"
# `unused_exports` is a false-positive on a public-facing library:
# every API function is unused inside the library, by definition.
# The rule is fine for application codebases but useless here.
unused_exports = "off"
unwrap_used = "error"
[tools.glinter.ignore]
# gleeunit auto-discovers `pub fn ..._test` so all of those
# functions look unused, none have explicit `-> Nil`, and
# tests routinely use one-letter binders for compactness. These
# rule waivers are mechanical; production code keeps the ratchet
# tight.
"test/**/*.gleam" = [
"unused_exports",
"missing_type_annotation",
"short_variable_name",
"assert_ok_pattern",
"label_possible",
"discarded_result",
"thrown_away_error",
"prefer_guard_clause",
"redundant_case",
]
# Runner is the panic delivery mechanism; generator panics on a
# stuck `filter`; stateful panics on a failing command. Range
# constructors panic on inverted bounds (lo > hi) — an inverted
# pair is almost always a bug, and matching the project's existing
# "fail visibly on misconfiguration" stance is preferable to silent
# normalisation.
"src/metamon/internal/runner.gleam" = ["avoid_panic"]
"src/metamon/stateful.gleam" = ["avoid_panic"]
"src/metamon/generator.gleam" = ["avoid_panic", "assert_ok_pattern"]
"src/metamon/generator/range.gleam" = ["avoid_panic"]
# `relation.approximately(epsilon)` rejects a negative epsilon at
# construction time with a structured panic. The "always false"
# relation a negative epsilon would silently produce is never the
# user's intent, so we fail visibly on the sign mistake.
"src/metamon/relation.gleam" = ["avoid_panic"]
# `_or_panic` config-builder variants intentionally panic with a
# structured message so test code does not need `let assert Ok(c)`
# for statically-known literals.
"src/metamon/config.gleam" = ["avoid_panic"]
# `coverage.cover` / `cover_at_least` panic on a malformed target
# (target_pct outside [0.0, 100.0] or NaN, min_hits < 0) — the same
# "fail visibly on misconfiguration" stance as relation.approximately
# (negative epsilon) and Range constructors (inverted bounds).
"src/metamon/coverage.gleam" = ["avoid_panic"]
# Process-dictionary FFI shims (BEAM + JS) intentionally form the
# metamon-FFI seam.
"src/metamon/internal/process_state.gleam" = ["ffi_usage"]
# IEEE 754 special-value constructors (NaN, ±Infinity, smallest
# denormal, largest finite) cannot be built portably from pure Gleam
# — Erlang arithmetic raises badarith for non-finite results, so the
# FFI constructs them via binary syntax. JS uses Number.* constants.
"src/metamon/internal/float_special.gleam" = ["ffi_usage"]
# The JS FFI module imports `Ok` / `Error` constructors from
# `gleam.mjs` to interop with Gleam-shaped Results. There is no
# stable replacement for this on the JS target.
"src/metamon_ffi.mjs" = ["ffi_usage"]