Skip to main content

Linting rules for dashboard YAML configurations

Project description

kb-dashboard-lint

Linting rules for Kibana dashboard YAML configurations.

Overview

This package provides a configurable linting system that flags potentially problematic dashboard configurations based on best practices and style guidelines. It works with validated Pydantic models from kb-dashboard-core.

Installation

pip install kb-dashboard-lint

Or with uv:

uv add kb-dashboard-lint

Usage

CLI

# Check dashboards in a directory
kb-dashboard-lint check --input-dir ./inputs

# Check a single file
kb-dashboard-lint check --input-file dashboard.yaml

# Use custom configuration
kb-dashboard-lint check --config .dashboard-lint.yaml

# Only fail on errors (not warnings)
kb-dashboard-lint check --severity-threshold error

Programmatic API

from kb_dashboard_lint import check_dashboards
from kb_dashboard_core import load

# Load dashboards
dashboards = load('inputs/')

# Run linting
violations = check_dashboards(dashboards)

for violation in violations:
    print(f"{violation.severity}: {violation.rule_id} - {violation.message}")

Built-in Rules

Dashboard Rules

Rule ID Description Default
dashboard-dataset-filter Dashboard should have a data_stream.dataset filter warning
dashboard-missing-description Dashboards should have a description for discoverability info
datatable-at-bottom Data table panels should be positioned at the bottom of the dashboard info
markdown-at-top Markdown panels with navigation content should be at the top of the dashboard info
metric-excessive-count Dashboards should not have excessive metric panels (style guide recommends 0-4) info

Panel Rules

Rule ID Description Default
markdown-header-height Markdown panels with headers must have height >= 3 warning
panel-min-width Panels should have minimum width for readability warning
panel-description-recommended Panels should have descriptions for accessibility info
panel-title-redundant-prefix Panel titles should not start with redundant prefixes like "Chart of" info

Chart Rules

Rule ID Description Default
gauge-goal-without-max Gauge charts with goals should define maximum values warning
metric-multiple-metrics-width Metric panels with multiple metrics should have adequate width warning
metric-redundant-label Metric primary label matching title should use hide_title: true warning
narrow-xy-chart-side-legend Narrow XY charts should use bottom legends instead of side legends warning
panel-height-for-content Panels should have minimum height for their chart type warning
esql-field-escaping ES|QL field names with numeric suffixes need backtick escaping warning
esql-group-by-syntax ES|QL uses BY within STATS, not GROUP BY warning
esql-missing-sort-after-bucket ES|QL time series queries with BUCKET should end with SORT for proper ordering warning
esql-sql-syntax ES|QL queries should not use SQL syntax warning
datatable-row-density Large datatables should consider compact density info
dimension-missing-label Dimensions should have explicit labels info
esql-dimension-missing-label ES|QL datatable dimensions should have explicit labels info
esql-dynamic-time-bucket ES|QL queries should use dynamic time bucketing info
esql-metric-missing-label ES|QL datatable metrics should have explicit labels info
esql-missing-limit ES|QL queries with SORT DESC should have explicit LIMIT for top-N results info
esql-where-clause ES|QL queries should include a WHERE clause info
pie-chart-dimension-count Pie charts with multiple dimensions may be hard to read info
pie-missing-limit Pie charts should limit slices shown (recommend 5-10 categories) info

Configuration

Create a .dashboard-lint.yaml file:

extends: default

rules:
  markdown-header-height:
    severity: error
  esql-where-clause:
    enabled: false

Development

# Install dependencies
make install

# Run CI checks
make ci

# Run tests
make test

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kb_dashboard_lint-0.2.7.tar.gz (34.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kb_dashboard_lint-0.2.7-py3-none-any.whl (62.9 kB view details)

Uploaded Python 3

File details

Details for the file kb_dashboard_lint-0.2.7.tar.gz.

File metadata

  • Download URL: kb_dashboard_lint-0.2.7.tar.gz
  • Upload date:
  • Size: 34.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.27 {"installer":{"name":"uv","version":"0.9.27","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for kb_dashboard_lint-0.2.7.tar.gz
Algorithm Hash digest
SHA256 42f4272c89ce95379cd8098b500e30e53ef968ef3a895d4b7097d2a364ecceea
MD5 cdbb3b9741e660f39b844cdc26e15ab2
BLAKE2b-256 7ad038606cdc1960d625109e8cc556e3376b52369d3a94a736687a32653bf6c0

See more details on using hashes here.

File details

Details for the file kb_dashboard_lint-0.2.7-py3-none-any.whl.

File metadata

  • Download URL: kb_dashboard_lint-0.2.7-py3-none-any.whl
  • Upload date:
  • Size: 62.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.27 {"installer":{"name":"uv","version":"0.9.27","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for kb_dashboard_lint-0.2.7-py3-none-any.whl
Algorithm Hash digest
SHA256 eb5385a40836a70481ea999585a1753f4d085a28e5a1069df0b831bdfeaf7524
MD5 f732384ec2c154df600cba17fc4b68fa
BLAKE2b-256 a841763e883a02c075e23b81151290b1231cd96f83233eabdc1207e721800912

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page