Skip to content

Configurable lint rules via .winn-lint.json #117

@gregwinn

Description

@gregwinn

Summary

Allow users to configure lint rules via a .winn-lint.json file in the project root. Each rule can be set to false (disabled), "warning" (informational), or "error" (fails CI with exit code 1).

Config Format

{
  "rules": {
    "single_pipe": false,
    "unused_variable": "warning",
    "empty_function_body": "error"
  }
}
  • Only rules that differ from defaults need to be listed
  • Without a config file, all rules default to "warning" (current behavior)
  • Unknown rule names produce a warning on stderr
  • Invalid values fall back to default with a warning

Behavior

Scenario Exit code
No violations 0
Only warnings 0
Any errors 1

This changes the current behavior where all warnings cause exit code 1. With config, "warning" rules become informational only — only "error" rules fail CI.

New: winn lint --init

Generates a default .winn-lint.json with all 10 rules set to "warning" as a starting point.

Implementation

  1. Config loading in winn_lint.erlload_config/0 reads .winn-lint.json, parses with jsone, merges over defaults
  2. Thread config through checkscheck_string/2, check_file/2 accept config; each rule checks its config before emitting
  3. CLI changesrun_lint loads config once, separates error vs warning counts, exits 1 only on errors
  4. --init subcommand — generates default config file
  5. Tests — config loading, rule suppression, severity-based exit codes
  6. Docs — update cli.md, getting-started.md, CHANGELOG.md

Files to Modify

  • apps/winn/src/winn_lint.erl
  • apps/winn/src/winn_cli.erl
  • apps/winn/test/winn_lint_tests.erl
  • docs/cli.md
  • docs/getting-started.md
  • CHANGELOG.md

Part of v0.9.0 — Developer Tooling

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions