You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add a new flag to the api-linter CLI that allows specifying custom rule plugins.
This is the first step toward supporting a plugin ecosystem for custom rules.
Changes:
- Added RulePluginPaths field to the cli struct to store plugin file paths
- Added --rule-plugin flag that can be used multiple times for multiple plugins
- Updated tests to verify the flag works correctly
The flag follows the pattern of other path-related flags in the CLI:
- Uses StringArrayVar to support multiple values
- Consistent naming with other flags (kebab-case)
- Clear documentation in the help text
This is part of the implementation for issue googleapis#1485, enabling organization-specific
custom rules through plugins rather than requiring users to fork the repository.
References:
- Issue discussion: googleapis#1485
- Go plugin docs: https://pkg.go.dev/plugin
fs.BoolVar(&listRulesFlag, "list-rules", false, "Print the rules and exit. Honors the output-format flag.")
83
85
fs.BoolVar(&debugFlag, "debug", false, "Run in debug mode. Panics will print stack.")
84
86
fs.BoolVar(&ignoreCommentDisablesFlag, "ignore-comment-disables", false, "If set to true, disable comments will be ignored.\nThis is helpful when strict enforcement of AIPs are necessary and\nproto definitions should not be able to disable checks.")
87
+
fs.StringArrayVar(&rulePluginFlag, "rule-plugin", nil, "The path to a custom rule plugin (.so file).\nMay be specified multiple times.")
0 commit comments