Tanguv0.35.0
110 rules9 categories
Raw Markdown

Static lint rules

Run `tangu lint` or `tangu fix` across any `.tan`, `.data.tan`, `#shtml`, or `#css` workspace. Suppress a rule on the following form using `; #allow(<code>)`.

filter_list110

deep-nesting#

complexity

Warns when code exceeds the recommended nesting depth threshold.

; #allow(deep-nesting)

too-many-parameters#

complexity

Warns when functions exceed the recommended parameter count threshold.

; #allow(too-many-parameters)

cond-unreachable-clauses#

correctnessautofix

Detects unreachable clauses in `cond` and `when` expressions.

; #allow(cond-unreachable-clauses)

discarded-continue-value#

correctnessautofix

Warns when `(continue val)` passes a value inside a loop that discards it.

; #allow(discarded-continue-value)

division-by-zero#

correctness

Detects division or modulo by constant zero literals.

; #allow(division-by-zero)

duplicate-cond-predicate#

correctness

Detects duplicated predicates in `cond` branches.

; #allow(duplicate-cond-predicate)

duplicate-def-in-block#

correctness

Detects duplicate `def` declarations and `def`/`let` collisions within the same block scope.

; #allow(duplicate-def-in-block)

duplicate-map-keys#

correctness

Detects duplicate keys in Map literals.

; #allow(duplicate-map-keys)

duplicate-set-entries#

correctness

Detects duplicate entries in Set literals.

; #allow(duplicate-set-entries)

duplicate-when-patterns#

correctnessautofix

Detects duplicate `when` patterns or unreachable branches.

; #allow(duplicate-when-patterns)

for-in-value-position#

correctnessautofix

Warns when `(for ...)` is used in a value-producing position where `for->seq` is required.

; #allow(for-in-value-position)

hardcoded-secret#

correctness

Warns when credential-named variables or map keys are assigned hardcoded string literals.

; #allow(hardcoded-secret)

i18n-bundle-parity#

correctness

Validates key, plural `:other`, and `{placeholder}` parity across locales in `Bundle`.

; #allow(i18n-bundle-parity)

impossible-branch#

correctness

Detects conditional branches that can never execute.

; #allow(impossible-branch)

ineffective-none-guard#

correctness

Detects None checks that fail to guard against nil dereferences.

; #allow(ineffective-none-guard)

invalid-struct-field-constraint#

correctness

Warns about invalid, contradictory, or type-mismatched struct field constraints.

; #allow(invalid-struct-field-constraint)

invalid-struct-literal-value#

correctness

Warns about literal struct arguments that violate field constraint annotations.

; #allow(invalid-struct-literal-value)

missing-else-wrapper#

correctnessautofix

Detects 3-argument `(if cond then else)` expressions where the 2nd branch is missing `(else ...)`.

; #allow(missing-else-wrapper)

shell-injection#

correctness

Warns when interpolating or concatenating dynamic values into shell command strings passed to `process/exec` or `process/shell`.

; #allow(shell-injection)

suspicious-equality#

correctness

Warns when equality checks compare incompatible types.

; #allow(suspicious-equality)

suspicious-try#

correctness

Detects `(try ...)` on optional lookups where `()` early-returns prematurely.

; #allow(suspicious-try)

tautological-boolean#

correctnessautofix

Detects tautological or contradictory boolean expressions (e.g. `(and a a)`).

; #allow(tautological-boolean)

test-assertions#

correctnessautofix

Detects unasserted comparison expressions in `#test` functions and test functions with zero assertions.

; #allow(test-assertions)

css-empty-rule#

css

Detects empty CSS rules with no declarations and no nested child rules.

; #allow(css-empty-rule)

css-shorthand-override#

css

Detects CSS shorthand properties declared after their constituent longhand properties in the same rule.

; #allow(css-shorthand-override)

css-unknown-custom-property#

css

Warns when `var(--token)` references a CSS custom property not defined locally or in workspace CSS tokens.

; #allow(css-unknown-custom-property)

css-zero-length-unit#

cssautofix

Suggests omitting redundant length units on zero values (e.g. `"0"` instead of `"0px"`).

; #allow(css-zero-length-unit)

html-accessible-name#

html

Ensures interactive elements (<button>, <a>) have accessible text or aria-label.

; #allow(html-accessible-name)

html-anchor-valid-href#

html

Flags anchor tags with missing or dummy href attributes (such as # or javascript:).

; #allow(html-anchor-valid-href)

html-aria-validity#

html

Flags invalid/misspelled ARIA roles and attributes, and redundant roles on semantic HTML tags.

; #allow(html-aria-validity)

html-boolean-attribute-strings#

htmlautofix

Flags boolean attributes assigned string values ("false" or "true") and provides autofix to boolean literals.

; #allow(html-boolean-attribute-strings)

html-button-missing-type#

htmlautofix

Ensures <button> elements explicitly declare a :type attribute ("button", "submit", or "reset").

; #allow(html-button-missing-type)

html-conflicting-id#

html

Detects conflicting element IDs when both a tag shortcut `#id` and an `:id` attribute (or multiple `#id` shortcuts) are specified on the same element.

; #allow(html-conflicting-id)

html-deprecated-elements#

html

Flags obsolete and deprecated HTML tags (e.g. marquee, font, center, strike, tt).

; #allow(html-deprecated-elements)

html-duplicate-class#

htmlautofix

Detects duplicate CSS class names in element tag shortcuts or `:class` attributes.

; #allow(html-duplicate-class)

html-duplicate-id#

html

Flags duplicate static HTML element IDs in the same template tree.

; #allow(html-duplicate-id)

html-img-missing-alt#

html

Requires <img> elements to have an alt attribute.

; #allow(html-img-missing-alt)

html-input-missing-label#

html

Ensures form inputs (<input>, <select>, <textarea>) are associated with a label.

; #allow(html-input-missing-label)

html-invalid-nesting#

html

Detects invalid parent-child element nesting forbidden by HTML5.

; #allow(html-invalid-nesting)

html-no-inline-event-handlers#

html

Disallows inline DOM event handler attributes (e.g. `:onclick`, `:onsubmit`) in favor of `addEventListener` in module scripts.

; #allow(html-no-inline-event-handlers)

html-prefer-semantic-elements#

htmlautofix

Suggests replacing generic <div> elements with native semantic landmark elements (header, nav, main, footer, aside, article).

; #allow(html-prefer-semantic-elements)

html-target-blank-rel#

htmlautofix

Ensures <a> elements with target="_blank" specify rel="noopener noreferrer" to prevent security risks.

; #allow(html-target-blank-rel)

html-unsafe-raw#

html

Warns when unescaped string interpolation or concatenation is used inside `:!raw` or `#html` strings.

; #allow(html-unsafe-raw)

html-void-element-children#

html

Flags void elements containing child elements or text content.

; #allow(html-void-element-children)

deprecated-usage#

imports

Detects usage of functions, modules, or bindings marked with `@deprecated`.

; #allow(deprecated-usage)

duplicate-function-parameter-names#

imports

Detects duplicate parameter names in function signatures.

; #allow(duplicate-function-parameter-names)

duplicate-imports#

importsautofix

Detects duplicate `use` statements importing the same module or symbol.

; #allow(duplicate-imports)

empty-import#

importsautofix

Disallows empty brace imports `(use {} /mod)`; use `(use _ /mod)` for side-effect-only imports.

; #allow(empty-import)

forbidden-dot-imports#

importsautofix

Warns against using forbidden trailing dot imports `(use ... .)`.

; #allow(forbidden-dot-imports)

invalid-lazy-import#

imports

Reports `#lazy` `(use ...)` forms that are unsupported at runtime.

; #allow(invalid-lazy-import)

nonexistent-modules#

imports

Detects `use` statements importing from non-existent modules.

; #allow(nonexistent-modules)

redundant-prelude-imports#

importsautofix

Warns when importing symbols that are already available in the standard prelude.

; #allow(redundant-prelude-imports)

same-directory-use#

importsautofix

Warns about redundant module prefixes when using sibling files.

; #allow(same-directory-use)

shadowing-globals#

imports

Warns when local variables shadow prelude symbols or top-level module definitions.

; #allow(shadowing-globals)

shadowing-imports#

imports

Warns when local definitions shadow imported symbols.

; #allow(shadowing-imports)

undefined-imported-names#

imports

Detects imports of symbols that are not exported by target modules.

; #allow(undefined-imported-names)

undefined-variables#

imports

Detects references to variables that are not defined in the current scope.

; #allow(undefined-variables)

unsorted-imports#

importsautofix

Enforces that top-level (use ...) imports are sorted alphabetically by module path within contiguous import blocks.

; #allow(unsorted-imports)

accumulating-concat-in-loop#

performance

Detects quadratic O(N^2) string or array concatenation reassignment inside a loop body.

; #allow(accumulating-concat-in-loop)

prefer-iter-find-or-any#

performanceautofix

Suggests lazy `(iter/find ...)` or `(iter/any? ...)` instead of materializing `(iter/filter ...)` just to inspect the first element or emptiness.

; #allow(prefer-iter-find-or-any)

collapsible-if#

redundancyautofix

Suggests collapsing nested `if` statements into a single `if` with `and`.

; #allow(collapsible-if)

dead-reassignment#

redundancy

Detects variables reassigned before their previous value was used.

; #allow(dead-reassignment)

discarded-for-seq#

redundancyautofix

Detects `(for->seq ...)` in statement positions where the generated Array is dropped.

; #allow(discarded-for-seq)

needless-return#

redundancyautofix

Suggests removing explicit `(return ...)` from tail expressions or redundant `()` in `(return ())`.

; #allow(needless-return)

prefer-compact#

redundancyautofix

Suggests using `(iter/compact xs)` instead of filtering with `is-some?`.

; #allow(prefer-compact)

prefer-compound-assignment#

redundancyautofix

Suggests using compound assignment operators (+<-, -<-, *<-, /<-) instead of verbose reassignment.

; #allow(prefer-compound-assignment)

redundant-cast#

redundancyautofix

Warns when an explicit `(cast Type expr)` call is redundant because `expr` already has type `Type`.

; #allow(redundant-cast)

redundant-closure#

redundancyautofix

Warns about redundant closures `(Func [x] (f x))` that can be simplified.

; #allow(redundant-closure)

redundant-comparison-with-boolean#

redundancyautofix

Warns about comparing expressions directly with boolean literals.

; #allow(redundant-comparison-with-boolean)

redundant-do#

redundancyautofix

Warns about redundant `(do ...)` expressions inside sequences.

; #allow(redundant-do)

redundant-else#

redundancyautofix

Warns about redundant `else` branches.

; #allow(redundant-else)

redundant-if-boolean#

redundancyautofix

Warns about `(if cond true false)` patterns.

; #allow(redundant-if-boolean)

redundant-optional-field-wrap#

redundancyautofix

Warns about redundant wrapping of optional struct fields.

; #allow(redundant-optional-field-wrap)

redundant-unit#

redundancyautofix

Suggests removing redundant `()` from the end of a function or block when it already returns `()`.

; #allow(redundant-unit)

redundant-var-annotation#

redundancyautofix

Warns about redundant type annotations on variable declarations.

; #allow(redundant-var-annotation)

self-binding#

redundancyautofix

Warns when a variable is bound to itself without transformation.

; #allow(self-binding)

unreachable-code#

redundancy

Detects expressions following unconditional jumps (return, throw).

; #allow(unreachable-code)

unused-function-parameters#

redundancy

Detects function parameters that are never referenced.

; #allow(unused-function-parameters)

unused-imports#

redundancyautofix

Detects imported modules or names that are never referenced.

; #allow(unused-imports)

unused-loop-variable#

redundancyautofix

Detects iteration variables in for or for->seq loops that are never referenced.

; #allow(unused-loop-variable)

unused-values#

redundancy

Detects expressions evaluated in sequence whose results are discarded.

; #allow(unused-values)

unused-variables#

redundancyautofix

Detects variables that are declared with `let` but never referenced.

; #allow(unused-variables)

def-annotation-placement#

styleautofix

Enforces that declaration attributes (#pub, #inline, #test, #(doc ...)) are placed preceding (def ...) rather than inside it.

; #allow(def-annotation-placement)

def-destructuring#

styleautofix

Warns when `def` is used for pattern destructuring instead of `let`.

; #allow(def-destructuring)

func-signature-convention#

styleautofix

Enforces canonical Func parameter syntax: nullary functions use (), single parameters unwrap brackets, and multi-parameters use [a b ...].

; #allow(func-signature-convention)

missing-doc#

style

Warns about missing documentation comments on public functions and types.

; #allow(missing-doc)

names#

style

The symbol naming convention lint (kebab-case, lengths, valid identifiers).

; #allow(names)

predicate-and-boolean-naming#

style

Enforces that predicate functions end with `?`, while variables, parameters, and map keys do not end with `?`.

; #allow(predicate-and-boolean-naming)

prefer-colon-shorthand#

styleautofix

Suggests using colon shorthand syntax for keyword args and properties.

; #allow(prefer-colon-shorthand)

prefer-cond-over-if#

styleautofix

Suggests using `(cond ...)` when multiple nested `if` expressions are chained.

; #allow(prefer-cond-over-if)

prefer-is-a#

styleautofix

Suggests using `(is-a? ...)` for type checking patterns.

; #allow(prefer-is-a)

prefer-is-empty#

styleautofix

Suggests using `(is-empty? ...)` over `(== (count-of ...) 0)`.

; #allow(prefer-is-empty)

prefer-multi-remove#

styleautofix

Suggests using multi-key (remove coll k1 k2 ...) instead of nested (remove (remove coll k1) k2) calls.

; #allow(prefer-multi-remove)

prefer-not-equal#

styleautofix

Suggests using `(!= a b)` instead of `(not (== a b))`.

; #allow(prefer-not-equal)

prefer-optional-key-path#

styleautofix

Suggests using optional key path syntax.

; #allow(prefer-optional-key-path)

prefer-put-all#

styleautofix

Suggests using `put-all` instead of multiple consecutive `put` calls.

; #allow(prefer-put-all)

prefer-range-shorthand#

styleautofix

Suggests using range shorthand syntax `0..10` over `(range 0 10)`.

; #allow(prefer-range-shorthand)

prefer-say#

styleautofix

Suggests using `(say ...)` instead of the legacy `(echo ...)` alias for console output.

; #allow(prefer-say)

prefer-some-or#

styleautofix

Suggests using `(some-or ...)` instead of verbose None checking.

; #allow(prefer-some-or)

prefer-string-interpolation#

styleautofix

Suggests using string template interpolation instead of `concat` / `format`.

; #allow(prefer-string-interpolation)

prefer-unless#

styleautofix

Suggests using `(unless ...)` over `(if (not ...) ...)`.

; #allow(prefer-unless)

prefer-when-over-cond#

styleautofix

Suggests using `(when ...)` for single branch conditions.

; #allow(prefer-when-over-cond)

sql-interpolation#

styleautofix

Warns about improper string interpolation in SQL queries.

; #allow(sql-interpolation)

struct-and-trait-naming#

styleautofix

Enforces capitalized kebab-case for multi-word structs and traits.

; #allow(struct-and-trait-naming)

struct-field-annotation-convention#

styleautofix

Enforces canonical kebab-case naming for struct field annotation keys.

; #allow(struct-field-annotation-convention)

top-level-let-function#

styleautofix

Suggests top-level function definitions.

; #allow(top-level-let-function)

triple-quotes#

style

Suggests using triple-quotes `"""` for multi-line strings.

; #allow(triple-quotes)

missing-trait-bound#

types

Warns about missing trait bounds on generic parameters.

; #allow(missing-trait-bound)

missing-var-annotation#

typesautofix

Warns when variable bindings lack required type annotations.

; #allow(missing-var-annotation)

mut-param-requires-mut#

typesautofix

Warns when a mutable parameter does not have mutable binding.

; #allow(mut-param-requires-mut)