feat(lint): add linter rules for migration and naming conventions
* Implement migration safety rules: - MIG001: Warn on CREATE INDEX without CONCURRENT. - MIG002: Warn on ALTER TABLE ADD COLUMN NOT NULL without DEFAULT. - MIG003: Warn on ALTER TABLE ADD CONSTRAINT without NOT VALID. * Implement naming conventions rules: - NAM001: Warn on non-snake_case table names. - NAM002: Warn on non-snake_case column names in CREATE TABLE. - NAM003: Warn on non-snake_case function names. * Add test fixtures for all new rules.
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
// Package diagnostics defines the shared Diagnostic type emitted by the linter
|
||||
// (and, later, the LSP). Both the CLI and the language server import this
|
||||
// package to avoid a circular dependency between pkg/lint and pkg/lsp.
|
||||
package diagnostics
|
||||
|
||||
// Severity is the urgency of a diagnostic.
|
||||
type Severity string
|
||||
|
||||
const (
|
||||
SeverityError Severity = "error"
|
||||
SeverityWarning Severity = "warning"
|
||||
SeverityHint Severity = "hint"
|
||||
)
|
||||
|
||||
// Diagnostic is a single lint finding.
|
||||
type Diagnostic struct {
|
||||
// RuleID is the stable identifier for the rule that produced this finding
|
||||
// (e.g. "MIG001").
|
||||
RuleID string
|
||||
// Severity is the urgency level.
|
||||
Severity Severity
|
||||
// Message is a human-readable description of the finding.
|
||||
Message string
|
||||
// File is the path to the source file, or "" for stdin.
|
||||
File string
|
||||
// Line is the 1-based line number of the finding.
|
||||
Line int
|
||||
// Col is the 1-based column number of the finding.
|
||||
Col int
|
||||
}
|
||||
Reference in New Issue
Block a user