Current section
Files
Jump to
Current section
Files
datastream
gleam.toml
gleam.toml
name = "datastream"
version = "0.2.0"
description = "Compositional, resource-safe streams for Gleam — runs on Erlang and JavaScript targets"
licences = ["MIT"]
repository = { type = "github", user = "nao1215", repo = "datastream" }
links = [
{ title = "Repository", href = "https://github.com/nao1215/datastream" },
{ title = "Documentation", href = "https://hexdocs.pm/datastream" },
{ title = "Changelog", href = "https://github.com/nao1215/datastream/blob/main/CHANGELOG.md" },
]
# No `target` key on purpose: this library compiles for both the
# Erlang and JavaScript targets. The cross-target core (`datastream`,
# `datastream/source`, `datastream/stream`, `datastream/fold`,
# `datastream/sink`, `datastream/chunk`, `datastream/text`,
# `datastream/binary`) MUST run on both. The `datastream/erlang/*`
# extension modules are guarded so they only compile on Erlang.
gleam = ">= 1.15.0"
[dependencies]
gleam_stdlib = ">= 0.44.0 and < 2.0.0"
# `gleam_erlang` is required by the BEAM-only modules under
# `datastream/erlang/*` (#18-#21). Every import of it is gated on
# `@target(erlang)` so the JavaScript build never references it.
gleam_erlang = ">= 1.3.0 and < 2.0.0"
[dev-dependencies]
gleeunit = ">= 1.0.0 and < 2.0.0"
glinter = ">= 2.14.0 and < 3.0.0"
# glinter (https://github.com/pairshaped/glinter) configuration. Run
# via `just lint`. `warnings_as_errors = true` makes the run fail on
# any unfixed warning so CI stays honest about the strictness
# contract.
[tools.glinter]
warnings_as_errors = true
include = ["src/", "test/"]
[tools.glinter.rules]
# `label_possible` flags any positional parameter that could carry a
# label. Adopting it across the entire codebase would force a
# labelled call-site rewrite for every helper for cosmetic gain. The
# rest of the label-related rules stay on.
label_possible = "off"
# This is a published library: many `pub fn` and `pub type`
# definitions are intentional API surface even when no in-tree caller
# uses them yet. Flagging them as unused inverts the semantics of
# `pub`.
unused_exports = "off"
# `case True/False` is equivalent to `bool.guard` for control flow;
# both forms read fine in their respective contexts. Keeping the rule
# on would force a single shape everywhere, including places where
# the negative branch is the trivial fallthrough that reads better as
# a `case`.
prefer_guard_clause = "off"
# `Error(_) -> default` is the natural shape for end-of-input
# iterators and best-effort lookups, both of which appear throughout
# pull-based stream code. Errors at system boundaries are routed
# through `Result` regardless.
thrown_away_error = "off"
[tools.glinter.ignore]
# gleeunit auto-discovers test functions by `pub fn ..._test() {}` at
# the module top level, so every test must stay public —
# `unused_exports` would fire on the entire test suite.
# `assert_ok_pattern` is idiomatic in tests where a setup-failure
# should crash loudly. `avoid_panic` is allowed in tests so a fixture
# can `panic` to fail loudly when a precondition is violated.
"test/**/*.gleam" = [
"assert_ok_pattern",
"avoid_panic",
"missing_type_annotation",
"short_variable_name",
"unused_exports",
]
# `binary.length_prefixed` and `binary.fixed_size` reject malformed
# arguments with `panic` at construction time per the spec (#16): the
# only sensible response to a programmer error like `prefix_size = 3`
# is to crash, so callers can't quietly trust a bogus framing.
"src/datastream/binary.gleam" = [
"avoid_panic",
]
# `source.from_bit_array` rejects non-byte-aligned input at
# construction time with `panic` per #144: silently dropping the
# trailing sub-byte tail would be data loss the caller could not
# observe, so a programmer error here must crash.
"src/datastream/source.gleam" = [
"avoid_panic",
]
# `stream.take`, `stream.drop`, and `stream.chunks_of` reject
# nonsensical count / size arguments with `panic` per the
# datastream module-level invalid-argument policy unified in #145
# (negative counts, sub-1 chunk sizes). Silent normalisation hides
# programmer error behind plausible-looking output.
"src/datastream/stream.gleam" = [
"avoid_panic",
]
# `par.map_*` reject `max_workers < 1`, `max_buffer < 1`, and
# `max_buffer < max_workers` for `map_ordered` with `panic` per
# spec #20: the only sensible response to a programmer error like
# `max_workers = 0` is to crash.
"src/datastream/erlang/par.gleam" = [
"avoid_panic",
]