Skip to content

feat: Add plugin system for gdlint#415

Draft
naxa1ka wants to merge 35 commits intoScony:masterfrom
Mimyr-Games-LTD:feat/plugin-system
Draft

feat: Add plugin system for gdlint#415
naxa1ka wants to merge 35 commits intoScony:masterfrom
Mimyr-Games-LTD:feat/plugin-system

Conversation

@naxa1ka
Copy link
Copy Markdown

@naxa1ka naxa1ka commented Mar 26, 2026

Summary

Adds a plugin system to gdlint that allows loading external lint rules from Python packages.

Motivation

Currently, adding custom lint checks requires forking the toolkit. This makes it hard to maintain project-specific rules (e.g. async naming conventions, custom annotations) alongside upstream updates.

With this change, teams can distribute custom lint rules as pip-installable Python packages and load them via the plugins config key — no fork needed.

How it works

Add a plugins key to your gdlintrc with a list of Python module paths:

[gdlint]
plugins=my_custom_checks,another_plugin.rules

Each plugin is a Python module that exposes a lint(parse_tree, config) function:

from typing import List
from gdtoolkit.linter.problem import Problem

def lint(parse_tree, config) -> List[Problem]:
    problems = []
    # inspect parse_tree, append Problem instances
    return problems

Plugins are loaded via importlib.import_module() at lint time. Missing or failing plugins are logged as warnings and skipped — they never crash the linter.

Changes

  • gdtoolkit/linter/__init__.py — added importlib/logging imports, "plugins": [] config key, and plugin loading loop
  • tests/linter/test_plugins.py — 4 tests covering valid/missing/empty/no-plugins-key scenarios
  • tests/linter/common.py — added multiple_nok_check test helper for multi-error assertions
  • README.md — documented plugin usage under the Linter section
  • .gitignore — added .venv/, .idea/, .claude/

Test results

All existing tests pass with no regressions:

1087 passed, 343 skipped in 14.37s

naxa1ka added 30 commits October 2, 2025 14:16
…-linter

Feature/await cancellation linter
feat: add missing-ct-param check; simplify checks
# Conflicts:
#	gdtoolkit/linter/__init__.py
@naxa1ka naxa1ka marked this pull request as draft March 26, 2026 09:57
@naxa1ka naxa1ka force-pushed the feat/plugin-system branch 10 times, most recently from 0542fdc to e95d751 Compare March 26, 2026 10:49
Adds support for loading external linter plugins via the `plugins`
config key in gdlintrc. Plugins are Python modules that expose a
`lint(parse_tree, config)` function, loaded via importlib at lint time.
Missing or failing plugins are logged as warnings and skipped gracefully.

Also adds `multiple_nok_check` test helper for checking multiple lint
errors at specified lines.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@naxa1ka naxa1ka force-pushed the feat/plugin-system branch from e95d751 to 2fd6c9d Compare March 26, 2026 10:53
@naxa1ka naxa1ka force-pushed the feat/plugin-system branch 4 times, most recently from 9be68b9 to 8ff3f5e Compare March 26, 2026 11:20
Adds support for loading external linter plugins via the `plugins`
config key in gdlintrc. Plugins are Python modules that expose a
`lint(parse_tree, config)` function, loaded via importlib at lint time.
Missing or failing plugins are logged as warnings and skipped gracefully.

Also adds `multiple_nok_check` test helper for checking multiple lint
errors at specified lines.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@naxa1ka naxa1ka force-pushed the feat/plugin-system branch from 8ff3f5e to cee1061 Compare March 26, 2026 11:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant