na4zagin3 / satyrographos

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

Add problem classes for squelch warnings/errors #215

Closed na4zagin3 closed 4 years ago

na4zagin3 commented 4 years ago

This PR adds problem classes in order to squelch warnings/errors.

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:

This is the command line option for https://github.com/na4zagin3/satyrographos/issues/166