~/bend-docscommunity

src/noqa.bend checks

raw source on the hub · import 0x582b4b0fdf3dafdeecc8c3bfddc5e4db/src/noqa.bend as Noqa

src/noqa: # noqa: CODE comments, and the filter they make, after ruff. A comment token (the lexer's, so never a string's contents) whose text is #, any spaces, then noqa is a mark. A : right after noqa opens its codes: runs of ASCII letters and digits, split by commas with spaces around them allowed, the list ending at anything else, so free text may follow (# noqa: L001 IO entry point). noqa at the comment's end, or followed by a space, names no code: a bare mark. Codes are case-sensitive and are src/codes.bend's (L001, U002). A finding is silenced when a mark of its own file, on its own line, names its code.

No rule reads this: the planner (lint/plan.bend) and the language server run keep over the graded findings once every rule has run, the project rules included, and then noqa (rules/style/noqa.bend) over what the marks silenced. Pure (GPU-safe).

6 imports
import Base
import ./lazy/lazy.bend as Lazy
import ./syntax/lex.bend as Lex
import ./finding.bend as F
import ./codes.bend as Codes
import ./src.bend as Src

Types

type Mark source · line 24 · raw

Data

one noqa comment: its line and column (0-based) and width, and the codes it names, none for a bare one

type Marks source · line 28 · raw

Data

a file's noqa comments

type Cls source · line 36 · raw

Data

what a char is to the code list: a space, a comma, a letter or digit, or anything else

type Phase source · line 50 · raw

Data

where the code list reader stands: before a code (spaces allowed), inside one, after one (spaces, then a comma or the list's end), or past the list

type Rd source · line 58 · raw

Data

the reader: where it stands, the code it is reading (its chars, the last first), and the codes read (the last first)

Definitions

def cls source · line 43 · raw

@+cc:Char -> Cls

a char's class

def word source · line 62 · raw

@buf:List<&2, Char> -> String

the chars read, the last first, as a code

def step.before source · line 67 · raw

@kk:Cls -> @+cc:Char -> @+acc:List<&2, String> -> Rd

before a code: a space waits, a letter or digit starts one, anything else ends the list

def step.inside source · line 80 · raw

@kk:Cls -> @+cc:Char -> @+buf:List<&2, Char> -> @+acc:List<&2, String> -> Rd

inside a code: a letter or digit extends it; a space, a comma or anything else ends it, and a comma expects the next

def step.after source · line 93 · raw

@kk:Cls -> @+acc:List<&2, String> -> Rd

after a code: a space waits, a comma expects the next, anything else ends the list

def step.at source · line 105 · raw

@ph:Phase -> @+cc:Char -> @+buf:List<&2, Char> -> @+acc:List<&2, String> -> Rd

the reader after one more char

def step source · line 117 · raw

@+cc:Char -> @rd:Rd -> Rd

the reader after one more char

def run source · line 122 · raw

@tt:String -> @rd:Rd -> Rd

the reader after the text

def finish.at source · line 130 · raw

@ph:Phase -> @+buf:List<&2, Char> -> @+acc:List<&2, String> -> List<&2, String>

the codes read, in order, the one still being read included

def finish source · line 142 · raw

@rd:Rd -> List<&2, String>

the codes read, in order

def codes source · line 147 · raw

@tt:String -> List<&2, String>

the codes a text after noqa: names

def lead source · line 151 · raw

@tt:String -> String

the text after its leading spaces

def mark.rest source · line 160 · raw

@+line:U32 -> @+col:U32 -> @+len:U32 -> @tt:String -> List<&2, Mark>

a comment's text past noqa: a mark naming the codes after a :, a bare one at the end or before a space, and none for anything else (noqas)

def mark.word source · line 172 · raw

@+line:U32 -> @+col:U32 -> @+len:U32 -> @tt:String -> List<&2, Mark>

a comment's text past # and its spaces: a mark when it opens with noqa

def mark.text source · line 180 · raw

@+line:U32 -> @+col:U32 -> @+len:U32 -> @tt:String -> List<&2, Mark>

a comment's text: a mark when it is #, any spaces, then noqa

def mark.of source · line 188 · raw

@tk:0x582b4b0fdf3dafdeecc8c3bfddc5e4db/src/syntax/lex.Tok -> List<&2, Mark>

a comment token's mark, when it is one; any other token has none

def marks source · line 196 · raw

@toks:List<&2, 0x582b4b0fdf3dafdeecc8c3bfddc5e4db/src/syntax/lex.Tok> -> List<&2, Mark>

the marks among the tokens, in order

def file source · line 204 · raw

@path:String -> @toks:List<&2, 0x582b4b0fdf3dafdeecc8c3bfddc5e4db/src/syntax/lex.Tok> -> Marks

a file's marks, from its tokens

def of_srcs source · line 208 · raw

@ss:List<&2, 0x582b4b0fdf3dafdeecc8c3bfddc5e4db/src/src.Src> -> List<&2, Marks>

each source's marks, in order

def named source · line 219 · raw

@cs:List<&2, String> -> @+code:String -> Bool

the codes include this one

def on_line source · line 227 · raw

@mks:List<&2, Mark> -> @+line:U32 -> @+code:String -> Bool

a mark on the line names the code

def silenced source · line 235 · raw

@ms:List<&2, Marks> -> @+path:String -> @+line:U32 -> @+code:String -> Bool

a mark of the file at the path, on the line, names the code

def keep source · line 244 · raw

@+ms:List<&2, Marks> -> @gs:List<&2, 0x582b4b0fdf3dafdeecc8c3bfddc5e4db/src/finding.Graded> -> List<&2, 0x582b4b0fdf3dafdeecc8c3bfddc5e4db/src/finding.Graded>

the graded findings no mark silences, in order