Documentation
¶
Index ¶
- Constants
- Variables
- func ApplySyntaxHighlightingToLine(line string, isYAML bool) string
- func BuildOverlayActionsTable(actions []*highoverlay.Action, warnings []*overlay.Warning, overlayPath string, ...) ([]table.Column, []table.Row)
- func BuildResultTableData(results []*model.RuleFunctionResult, fileName string, terminalWidth int, ...) ([]table.Column, []table.Row)
- func ConvertHugoShortcodesToMarkdown(content string) string
- func ConvertHugoShortcodesToMarkdownWithCustomHandlers(content string, customHandlers []ShortcodeHandler) string
- func CountOverlayActionTypes(actions []*highoverlay.Action) (updates, removes int)
- func FormatOverlaySummary(actions []*highoverlay.Action, warningCount int) string
- func HighlightJSONLine(line string) string
- func HighlightYAMLComment(line string, isYAML bool) (string, bool)
- func HighlightYAMLKeyValue(line string) (string, bool)
- func HighlightYAMLListItem(line string) (string, bool)
- func HighlightYAMLRefLine(line string) (string, bool)
- func HighlightYAMLValue(value string) string
- func InitSyntaxStyles()
- func RenderError(err error)
- func RenderErrorString(format string, args ...interface{})
- func RenderInfo(format string, args ...interface{})
- func RenderMarkdownTable(headers []string, rows [][]string) string
- func RenderStyledBox(message string, boxType BoxType, noStyle bool)
- func RenderSuccess(format string, args ...interface{})
- func RenderWarning(format string, args ...interface{})
- func ShowViolationTableView(results []*model.RuleFunctionResult, fileName string, specContent []byte, ...) error
- type BoxType
- type DocsState
- type FilterState
- type ModalType
- type SeverityInfo
- type ShortcodeHandler
- type ShortcodeParser
- type UIState
- type ViewMode
- type ViolationResultTableModel
- func (m *ViolationResultTableModel) ApplyFilter()
- func (m *ViolationResultTableModel) BuildCodeView() string
- func (m *ViolationResultTableModel) BuildDetailsView() string
- func (m *ViolationResultTableModel) CloseActiveModal()
- func (m *ViolationResultTableModel) ExtractCodeSnippet(result *model.RuleFunctionResult, contextLines int) (string, int)
- func (m *ViolationResultTableModel) FetchOrLoadDocumentation() tea.Cmd
- func (m *ViolationResultTableModel) FormatCodeWithHighlight(targetLine int, maxWidth int) string
- func (m *ViolationResultTableModel) HandleCodeViewKeys(key string) (bool, tea.Cmd)
- func (m *ViolationResultTableModel) HandleDocsMessages(msg tea.Msg) (bool, tea.Cmd)
- func (m *ViolationResultTableModel) HandleDocsModalKeys(key string) (bool, tea.Cmd)
- func (m *ViolationResultTableModel) HandleEscapeKey() (tea.Model, tea.Cmd)
- func (m *ViolationResultTableModel) HandleFilterKeys(key string) (bool, tea.Cmd)
- func (m *ViolationResultTableModel) HandleToggleKeys(key string) (bool, tea.Cmd)
- func (m *ViolationResultTableModel) HandleWindowResize(msg tea.WindowSizeMsg) tea.Cmd
- func (m *ViolationResultTableModel) Init() tea.Cmd
- func (m *ViolationResultTableModel) OpenModal(modal ModalType)
- func (m *ViolationResultTableModel) PrepareCodeViewport()
- func (m *ViolationResultTableModel) ReCenterCodeView()
- func (m *ViolationResultTableModel) TogglePathColumn()
- func (m *ViolationResultTableModel) ToggleSplitView()
- func (m *ViolationResultTableModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (m *ViolationResultTableModel) UpdateCategoryFilter(category string)
- func (m *ViolationResultTableModel) UpdateDetailsViewContent()
- func (m *ViolationResultTableModel) UpdateFilterState(filter FilterState)
- func (m *ViolationResultTableModel) UpdateRuleFilter(rule string)
- func (m *ViolationResultTableModel) View() string
- type WatchConfig
- type WatchState
Constants ¶
const ( DefaultTerminalWidth = 180 DefaultTerminalHeight = 40 MinTableHeight = 10 ModalWidthReduction = 40 // How much to reduce width for modal ModalHeightMargin = 5 // Margin from bottom for modal SplitViewHeight = 15 // Fixed height for detail view SplitViewMargin = 4 // Margin for split view SplitContentHeight = 11 // Fixed content height inside detail view DetailsColumnPercent = 30 // 30% for details column HowToFixColumnPercent = 30 // 30% for how-to-fix column SeverityColumnWidth = 10 CodeWindowSize = 3000 // Max lines to show above/below target line ViewportPadding = 4 ContentHeightMargin = 4 )
layout constants
Variables ¶
var ( SyntaxKeyStyle lipgloss.Style SyntaxStringStyle lipgloss.Style SyntaxNumberStyle lipgloss.Style SyntaxBoolStyle lipgloss.Style SyntaxCommentStyle lipgloss.Style SyntaxDashStyle lipgloss.Style SyntaxRefStyle lipgloss.Style SyntaxDefaultStyle lipgloss.Style SyntaxSingleQuoteStyle lipgloss.Style SyntaxStylesInit bool )
Functions ¶
func ApplySyntaxHighlightingToLine ¶
ApplySyntaxHighlightingToLine applies syntax highlighting to a single line
func BuildOverlayActionsTable ¶ added in v0.23.0
func BuildOverlayActionsTable(actions []*highoverlay.Action, warnings []*overlay.Warning, overlayPath string, terminalWidth int) ([]table.Column, []table.Row)
BuildOverlayActionsTable builds the overlay actions table with responsive column widths
func BuildResultTableData ¶
func BuildResultTableData(results []*model.RuleFunctionResult, fileName string, terminalWidth int, showPath bool) ([]table.Column, []table.Row)
BuildResultTableData builds the violation table data, calculating column widths based on terminal size and content.
func ConvertHugoShortcodesToMarkdown ¶
ConvertHugoShortcodesToMarkdown is a convenience function that converts Hugo shortcodes to markdown with highlight syntax using the default parser configuration
func ConvertHugoShortcodesToMarkdownWithCustomHandlers ¶
func ConvertHugoShortcodesToMarkdownWithCustomHandlers(content string, customHandlers []ShortcodeHandler) string
ConvertHugoShortcodesToMarkdownWithCustomHandlers allows adding custom handlers before parsing
func CountOverlayActionTypes ¶ added in v0.23.0
func CountOverlayActionTypes(actions []*highoverlay.Action) (updates, removes int)
CountOverlayActionTypes counts the number of update and remove actions
func FormatOverlaySummary ¶ added in v0.23.0
func FormatOverlaySummary(actions []*highoverlay.Action, warningCount int) string
FormatOverlaySummary formats the summary line for overlay actions
func HighlightJSONLine ¶
HighlightJSONLine handles JSON syntax highlighting
func HighlightYAMLComment ¶
HighlightYAMLComment handles comment highlighting for YAML
func HighlightYAMLKeyValue ¶
HighlightYAMLKeyValue handles key-value pair highlighting for YAML
func HighlightYAMLListItem ¶
HighlightYAMLListItem handles list item highlighting for YAML
func HighlightYAMLRefLine ¶
HighlightYAMLRefLine handles special highlighting for $ref lines
func HighlightYAMLValue ¶
HighlightYAMLValue applies appropriate styling to a YAML value
func InitSyntaxStyles ¶
func InitSyntaxStyles()
InitSyntaxStyles initializes the syntax highlighting styles once Now uses centralized styles from styles.go
func RenderError ¶
func RenderError(err error)
func RenderErrorString ¶
func RenderErrorString(format string, args ...interface{})
func RenderInfo ¶
func RenderInfo(format string, args ...interface{})
func RenderMarkdownTable ¶
func RenderStyledBox ¶
func RenderSuccess ¶
func RenderSuccess(format string, args ...interface{})
func RenderWarning ¶
func RenderWarning(format string, args ...interface{})
func ShowViolationTableView ¶
func ShowViolationTableView(results []*model.RuleFunctionResult, fileName string, specContent []byte, watchConfig *WatchConfig, changeStats *utils.ChangeStats, filterStats *utils.ChangeFilterStats) error
ShowViolationTableView displays results in an interactive console table (legacy) If changeStats is non-nil, the dashboard will display "what-changed mode" indicator
Types ¶
type FilterState ¶
type FilterState int
const ( FilterAll FilterState = iota // Show all results FilterErrors // Show only errors FilterWarnings // Show only warnings FilterInfo // Show only info messages )
const ( AllSeverity FilterState = iota ErrorSeverity WarningSeverity InfoSeverity )
func (FilterState) String ¶
func (f FilterState) String() string
String returns the string representation of the FilterState
type SeverityInfo ¶
type SeverityInfo struct {
Icon string
Text string
IconStyle lipgloss.Style
TextStyle lipgloss.Style
}
SeverityInfo contains all the display information for a severity level
func GetSeverityInfo ¶
func GetSeverityInfo(severity string) SeverityInfo
GetSeverityInfo returns display information for a given severity
func GetSeverityInfoFromText ¶
func GetSeverityInfoFromText(severityText string) SeverityInfo
GetSeverityInfoFromText returns display information for severity text like "✗ error"
type ShortcodeHandler ¶
type ShortcodeHandler struct {
// Pattern is the regex pattern to match the shortcode
Pattern *regexp.Regexp
// Transform is the function that converts matched shortcode to markdown
Transform func(matches []string) string
}
ShortcodeHandler defines how to transform a shortcode into markdown
type ShortcodeParser ¶
type ShortcodeParser struct {
// contains filtered or unexported fields
}
ShortcodeParser holds the configuration for parsing shortcodes
func NewShortcodeParser ¶
func NewShortcodeParser() *ShortcodeParser
NewShortcodeParser creates a new shortcode parser with default handlers
func (*ShortcodeParser) AddHandler ¶
func (p *ShortcodeParser) AddHandler(pattern *regexp.Regexp, transform func([]string) string)
AddHandler adds a custom shortcode handler to the parser
func (*ShortcodeParser) Parse ¶
func (p *ShortcodeParser) Parse(input string) string
Parse processes the input text and replaces all shortcodes with their markdown equivalents
type UIState ¶
type UIState struct {
ViewMode ViewMode
ActiveModal ModalType
ShowPath bool
FilterState FilterState
CategoryFilter string
RuleFilter string
}
UIState encapsulates all UI state
type ViolationResultTableModel ¶
type ViolationResultTableModel struct {
// contains filtered or unexported fields
}
ViolationResultTableModel holds the state for the interactive table view
func (*ViolationResultTableModel) ApplyFilter ¶
func (m *ViolationResultTableModel) ApplyFilter()
func (*ViolationResultTableModel) BuildCodeView ¶
func (m *ViolationResultTableModel) BuildCodeView() string
BuildCodeView builds the expanded code view modal
func (*ViolationResultTableModel) BuildDetailsView ¶
func (m *ViolationResultTableModel) BuildDetailsView() string
BuildDetailsView builds the details view for a violation when a user presses enter or return on a row.
func (*ViolationResultTableModel) CloseActiveModal ¶
func (m *ViolationResultTableModel) CloseActiveModal()
CloseActiveModal closes the currently open modal
func (*ViolationResultTableModel) ExtractCodeSnippet ¶
func (m *ViolationResultTableModel) ExtractCodeSnippet(result *model.RuleFunctionResult, contextLines int) (string, int)
ExtractCodeSnippet extracts lines around the issue with context
func (*ViolationResultTableModel) FetchOrLoadDocumentation ¶
func (m *ViolationResultTableModel) FetchOrLoadDocumentation() tea.Cmd
FetchOrLoadDocumentation loads documentation from cache or fetches it
func (*ViolationResultTableModel) FormatCodeWithHighlight ¶
func (m *ViolationResultTableModel) FormatCodeWithHighlight(targetLine int, maxWidth int) string
FormatCodeWithHighlight formats the spec content with line numbers and highlights the error line
func (*ViolationResultTableModel) HandleCodeViewKeys ¶
func (m *ViolationResultTableModel) HandleCodeViewKeys(key string) (bool, tea.Cmd)
HandleCodeViewKeys handles keyboard input when code view is open
func (*ViolationResultTableModel) HandleDocsMessages ¶
HandleDocsMessages processes documentation-related messages
func (*ViolationResultTableModel) HandleDocsModalKeys ¶
func (m *ViolationResultTableModel) HandleDocsModalKeys(key string) (bool, tea.Cmd)
HandleDocsModalKeys handles keyboard input when modal is open
func (*ViolationResultTableModel) HandleEscapeKey ¶
func (m *ViolationResultTableModel) HandleEscapeKey() (tea.Model, tea.Cmd)
HandleEscapeKey handles the escape key with context-aware behavior
func (*ViolationResultTableModel) HandleFilterKeys ¶
func (m *ViolationResultTableModel) HandleFilterKeys(key string) (bool, tea.Cmd)
HandleFilterKeys handles filter-related keyboard shortcuts
func (*ViolationResultTableModel) HandleToggleKeys ¶
func (m *ViolationResultTableModel) HandleToggleKeys(key string) (bool, tea.Cmd)
HandleToggleKeys handles view toggle keyboard shortcuts
func (*ViolationResultTableModel) HandleWindowResize ¶
func (m *ViolationResultTableModel) HandleWindowResize(msg tea.WindowSizeMsg) tea.Cmd
HandleWindowResize handles terminal resize events
func (*ViolationResultTableModel) Init ¶
func (m *ViolationResultTableModel) Init() tea.Cmd
func (*ViolationResultTableModel) OpenModal ¶
func (m *ViolationResultTableModel) OpenModal(modal ModalType)
OpenModal opens a modal and closes any existing modal
func (*ViolationResultTableModel) PrepareCodeViewport ¶
func (m *ViolationResultTableModel) PrepareCodeViewport()
PrepareCodeViewport prepares the code viewport with the full spec and highlights the error line
func (*ViolationResultTableModel) ReCenterCodeView ¶
func (m *ViolationResultTableModel) ReCenterCodeView()
ReCenterCodeView re-centers the viewport on the highlighted error line
func (*ViolationResultTableModel) TogglePathColumn ¶
func (m *ViolationResultTableModel) TogglePathColumn()
TogglePathColumn toggles the path column visibility with viewport preservation
func (*ViolationResultTableModel) ToggleSplitView ¶
func (m *ViolationResultTableModel) ToggleSplitView()
ToggleSplitView toggles between table and table with split view
func (*ViolationResultTableModel) UpdateCategoryFilter ¶
func (m *ViolationResultTableModel) UpdateCategoryFilter(category string)
UpdateCategoryFilter updates category filter
func (*ViolationResultTableModel) UpdateDetailsViewContent ¶
func (m *ViolationResultTableModel) UpdateDetailsViewContent()
UpdateDetailsViewContent updates split view content when cursor changes
func (*ViolationResultTableModel) UpdateFilterState ¶
func (m *ViolationResultTableModel) UpdateFilterState(filter FilterState)
UpdateFilterState updates filter state
func (*ViolationResultTableModel) UpdateRuleFilter ¶
func (m *ViolationResultTableModel) UpdateRuleFilter(rule string)
UpdateRuleFilter updates rule filter
func (*ViolationResultTableModel) View ¶
func (m *ViolationResultTableModel) View() string
type WatchConfig ¶
type WatchConfig struct {
Enabled bool
BaseFlag string
SkipCheckFlag bool
TimeoutFlag int
HardModeFlag bool
RemoteFlag bool
IgnoreFile string
FunctionsFlag string
RulesetFlag string
CertFile string
KeyFile string
CAFile string
Insecure bool
Silent bool
CustomFunctions map[string]model.RuleFunction // Pre-loaded custom functions
OriginalSpecPath string // Path to original spec for what-changed mode (--original)
ChangesReportPath string // Path to JSON change report for what-changed mode (--changes)
}
WatchConfig holds configuration for file watching
type WatchState ¶
type WatchState int
const ( WatchStateIdle WatchState = iota WatchStateProcessing WatchStateError WatchDebounceDelay = 200 * time.Millisecond )
Source Files
¶
- documentation_api.go
- hugo_shortcodes.go
- lint_code_view.go
- lint_dashboard.go
- lint_details_table_data.go
- lint_details_table_render.go
- lint_details_view.go
- lint_filewatcher.go
- lint_filter.go
- lint_filters.go
- lint_navbar.go
- lint_syntax_highlighter.go
- markdown_table.go
- message_renderer.go
- overlay_table_data.go
- styled_box.go
- text_utilities.go