OxL Справочник OxL
РусскийEnglish

warning lint-plugin

warning Стандарт: [III.4]

Диагностика пользовательского правила анализатора.

What it means#

A user rule listed in [lint] plugins (a comptime function over the read-only AST of std.comptime) reported a problem, with std.comptime.warn(at, message) or by failing with CompileError{ at, message }. The message starts with the rule name in brackets (the plugin's file name without .oxl). The level is set per rule: [lint] my_rule = "warn" | "error" | "off" (D-6560..D-6564; API in docs/analyzer.md).

Example#

oxl
// lints/no_todo.oxl, listed in oxl.toml as  [lint] plugins = ["lints/no_todo.oxl"]
use std.comptime { Decl, warn }

comptime fn check(d: Decl) {
  if d.kind == "fn" && d.name.startsWith("todo") {
    warn(d.span, "unfinished function `{d.name}`")      // <- lint-plugin: [no_todo] unfinished function …
  }
}

How to fix#

Change the code the rule points at, or tune the rule: no_todo = "off" in [lint] turns it off, "error" makes the build fail on it.

See also#

OxL 1.0.0-beta · Версия документации 1.0.0-beta© OxwaldLink · сгенерировано из Стандарта, исходников std и руководства