githooksync

package
v0.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 30, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package githooksync implements MDS048, the git-hook-sync rule. It reports when the pre-merge-commit hook or .gitattributes merge driver assignments do not list the same files that currently contain generated-section directives.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Rule

type Rule struct{}

Rule checks that mdsmith-managed git hooks and .gitattributes are in sync with the files that contain generated-section directives.

The rule is runnable in its zero value: it has no required runtime settings, so users can opt in via the bool form `git-hook-sync: true`. ApplySettings is still implemented to validate unknown keys when the user provides a mapping, but execution does not depend on it being called.

"At most one diagnostic per repository" is enforced via package- level state rather than per-Rule state, because the engine clones Configurable rules per file when the rule is enabled with a settings mapping (even an empty `{}`). With per-instance state, each clone would re-emit the diagnostic for every file in the repo.

func (*Rule) ApplySettings

func (r *Rule) ApplySettings(settings map[string]any) error

ApplySettings implements rule.Configurable. The rule has no runtime settings, so this only rejects unknown keys when a user supplies a mapping. The rule executes regardless of whether ApplySettings is invoked, so a bool-only enable (`git-hook-sync: true`) also works.

func (*Rule) Category

func (r *Rule) Category() string

Category implements rule.Rule.

func (*Rule) Check

func (r *Rule) Check(f *lint.File) []lint.Diagnostic

Check implements rule.Rule.

func (*Rule) DefaultSettings

func (r *Rule) DefaultSettings() map[string]any

DefaultSettings implements rule.Configurable.

func (*Rule) EnabledByDefault

func (r *Rule) EnabledByDefault() bool

EnabledByDefault implements rule.Defaultable.

func (*Rule) ID

func (r *Rule) ID() string

ID implements rule.Rule.

func (*Rule) Name

func (r *Rule) Name() string

Name implements rule.Rule.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL