compiler/ast/linter

  Source   Edit

This module implements the style checker.

Directionally, style will become part of the language, think go fmt where violations are errors.

Currently focused on names, but should cover spacing, and more.

General rules of style:

  • Saem decides style matters
  • lower/upper camel case good; snake case bad
  • lower camel case for most things
  • upper camel case for non-runtime things (types, some consts)
  • single letter names are ok, should be lower; tolerate upper
  • all-caps snake case is occassionally tolerated

Consts

Letters = {'a'..'z', 'A'..'Z', '0'..'9', '\x80'..'\xFF', '_'}
  Source   Edit

Procs

proc checkPragmaUse(conf: ConfigRef; info: TLineInfo; w: TSpecialWord;
                    pragmaName: string) {.
    ...raises: [Exception, ERecoverableError], tags: [RootEffect].}
  Source   Edit
proc identLen(line: string; start: int): int {....raises: [], tags: [].}
  Source   Edit
proc styleCheckUse(conf: ConfigRef; info: TLineInfo; s: PSym) {.
    ...raises: [Exception, ERecoverableError], tags: [ReadIOEffect, RootEffect].}
  Source   Edit

Templates

template styleCheckDef(conf: ConfigRef; info: TLineInfo; s: PSym)
  Source   Edit
template styleCheckDef(conf: ConfigRef; info: TLineInfo; s: PSym; k: TSymKind)
  Source   Edit
template styleCheckDef(conf: ConfigRef; s: PSym)
  Source   Edit