rokucommunity / brighterscript

A superset of Roku's BrightScript language
MIT License
160 stars 46 forks source link

Refine Diagnostic Filters and adds human-readable diagnostic names #1241

Open markwpearce opened 3 months ago

markwpearce commented 3 months ago

Addresses #1060

Array<string | number | { files?: string | Array<string | { src: string } | { dest: string }>; codes?: Array<number | string> }>;

In more detail:

{
"diagnosticFilters": [
    123,   // numbers are applied to diagnostic code or legacyCode against all files
    "some-diagnostic-name", // strings are applied to diagnostic code (or legacyCode) against all files
    { "codes": ["code-1", "code-2"]}, // an object is allowed with a list of codes to applied against all files
    { "files": "some/glob/**" }, // a file list will suppress all diagnostics in matched files
    { "files": "other/glob/**", "codes": ["some-code"]}, //suppress specific codes in matched files
    { "files": [              //files can be an array of globs
            "other/glob/**",
            "other2/glob/**"
       ],
       "codes": ["some-code"]
    },
    { "files": [{ "src": "yet/another/glob/**"}] }, //file listings in an array can be a object that references src path
    { "files": [{ "dest": "yet/another/glob/**"}] } //file listings in an array can be a object that references dest path
]}

Additionally, I went through all the diagnostics and assigned a human-readable code property to them, which can also be used for any diagnostic filtering. The previous (numerical) code property was renamed to legacyCode

markwpearce commented 3 months ago

@josephjunker Please take a look at this PR -- you did a lot of work on DiagnosticFiltering and I hope that's respected here.

josephjunker commented 3 months ago

@markwpearce Looks good to me!