feat: Add plugin system for gdlint#415
Draft
naxa1ka wants to merge 35 commits intoScony:masterfrom
Draft
Conversation
…-linter Feature/await cancellation linter
feat: ct argument
fix: missing ct
fix: false erros
fix: await var statement
feat: async method convention
feat: add missing-ct-param check; simplify checks
# Conflicts: # gdtoolkit/linter/__init__.py
0542fdc to
e95d751
Compare
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>
e95d751 to
2fd6c9d
Compare
Add plugin system for external lint rule modules
9be68b9 to
8ff3f5e
Compare
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>
8ff3f5e to
cee1061
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
pluginsconfig key — no fork needed.How it works
Add a
pluginskey to yourgdlintrcwith a list of Python module paths:Each plugin is a Python module that exposes a
lint(parse_tree, config)function: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— addedimportlib/loggingimports,"plugins": []config key, and plugin loading looptests/linter/test_plugins.py— 4 tests covering valid/missing/empty/no-plugins-key scenariostests/linter/common.py— addedmultiple_nok_checktest helper for multi-error assertionsREADME.md— documented plugin usage under the Linter section.gitignore— added.venv/,.idea/,.claude/Test results
All existing tests pass with no regressions: