emacs-elsa / Elsa

Emacs Lisp Static Analyzer and gradual type system.
GNU General Public License v3.0
643 stars 27 forks source link

Refactor checks and messages to be centered around code #211

Open Fuco1 opened 1 year ago

Fuco1 commented 1 year ago

All error messages should have a code. This way we can selectively ignore them with annotations or disable checks alltogether.

In general, there is a bigger refactoring necessary:

  1. Each check should be its own class, including the "internal" checks, not only the rules from "rulesets". They do not have to be registered as-such, but should follow the same framework.
  2. Each check should have richer metadata structure, similar to eslint:
    • code => short descriptive code in lisp-naming-style-with-dashes
    • level => notice, warning, error
    • description => Human readable description, i.e. docstring
    • messages => all the messages this check can produce. It's an alist from "code" to a format string. Format string should look like "The form ${form} can not accept type ${type}" (like s-lex-format). The placeholders will be extracted and supplied as plist values: pseudo code (make-message this form :id bla :form ... :name ...), where this is the check instance (maybe could be omited).
    • schema: configuration schema. We should provide way to configure rules similar to eslint... but this is next step.