na4zagin3 / satyrographos

Package manager for SATySFi
GNU Lesser General Public License v3.0
44 stars 13 forks source link

Lint: Ignore specified warnings #166

Closed na4zagin3 closed 3 years ago

na4zagin3 commented 3 years ago

We need to allow users to ignore warnings/errors specified in the command line or Satyristes.

Problem class

Each problem is classified one problem class. For example, the following problems belong to lib/version problem class.

Each OPAM Lint error/warning is considered as problem class opam-file/lint/<opam-warning-no>. For example, an empty synopsis field causes opam-file/lint/47.

-W option

-W option is added to disable warnings/errors being reported by lint subcommand. For example,

# Disable OPAM Lint Warnings 47, 48, and 50; and library version warnings
satyrographos lint -W 'opam-file/lint/{-47..50,+49},lib/version'

For now, -W option can disable not only warning but also errors. This behavior should be revised when lint subcommand is stable enough since errors should not be turned off.

-W option takes a warning expression. The grammar is following.

main ::=
  | exprs

exprs ::=
  | expr ( "," expr )*
    -- List of exprs
  | ( atom "/" )* "{" exprs "}"
    -- Common prefix for the exprs

expr ::=
  | ( "+" | "-" ) glob
    -- Enable or disable warnings matching the glob

glob ::=
  | "*"
  | atom
  | atom "/" glob
  | "{" globList "}"
    -- Alternative choose

globList ::=
  | glob
  | glob "," globList

atom ::=
  | id
  | range

id ::=
  | idCharFirst idChar

idCharFirst ::=
  | alphaNum

idChar ::=
  | idCharFirst
  | "_" | "-" | "."

range ::=
  | digit ".." digit

Examples:

Satyristes

(lang "0.1")

(warnings "-1") ; <-- applied globally

(library
  (name abc)
  (warnings "+1") ; <-- applied to the library `abc`
)

See also