glint
Installation
SKILL.md
glint is Gram's package of custom go/analysis analyzers, and gcl is the golangci-lint custom-build configuration that loads glint as a plugin. Together they automate enforcement of project coding conventions and bug-prevention rules so the same feedback isn't re-litigated in PR review.
- Plugin entry point: glint/plugin.go — registers the plugin via
register.Plugin("glint", New), defines thesettings/ruleSettingsstructs, and lists every analyzer inBuildAnalyzers. - gcl wiring: server/.custom-gcl.yml — declares
github.com/speakeasy-api/gram/glintas the imported plugin module for the custom golangci-lint binary.
The current set of analyzers and their rule keys is the source of truth in BuildAnalyzers. Read that function before adding a new one.
Quick start
When adding a new analyzer:
- Pick a kebab-case rule key and a matching
snake_case.gofile name inglint/. See Naming conventions. - Define
<rule>SettingswithDisabled bool. Add nothing else unless there's a concrete user-facing reason. See Settings and ignore mechanisms. - Implement detection in
new<Rule>Analyzer(rule <rule>Settings) *analysis.Analyzer. Prefer type-based checks over AST shape, and AST shape over string matching. See Detection methodology. - Write the diagnostic with imperative tone and the offending identifier inlined via
%q. See Diagnostic message style. - Wire the rule into glint/plugin.go: add a
ruleSettingsfield with the kebab-case JSON tag, then anif !p.settings.Rules.<X>.Disabledblock inBuildAnalyzers. - Add
<rule>_test.gowithanalysistest.Run(...)and a fixture underglint/testdata/src/<fixture>/. UpdatedisabledAllRulesPlugin()and the count inTestBuildAnalyzersAllEnabledin glint/plugin_test.go. See Testing.