Skip to content

Lint

Overview

clice integrates clang-tidy as a built-in linting engine. Unlike standalone clang-tidy which processes each TU independently, clice's architecture enables cross-TU coordination to eliminate redundant work.

Usage: clice lint (not yet implemented)

Current Status

  • Basic clang-tidy integration (single-TU, in-editor diagnostics)
  • Project-wide lint via CLI (clice lint)
  • Cross-TU header deduplication
  • Incremental re-lint (only changed files)
  • Lint result caching

Cross-TU Optimization

The Problem

clang-tidy processes each translation unit independently. A header included by N source files gets checked N times — multiplicative overhead that makes project-wide linting slow for large codebases.

clice's Approach

As a persistent server with knowledge of the full compilation graph, clice can:

  • Track which headers are shared across TUs
  • Hash declaration contents to skip re-checking identical declarations seen in prior TUs
  • Schedule lint jobs with dependency awareness (lint shared headers once, propagate results)
  • Cache per-header lint results keyed by content hash + check configuration
  • Per-file diagnostic deduplication (basic: remove duplicates within a single TU)
  • Project-wide diagnostic deduplication (advanced: same warning in same header across TUs → show once)

Expected Speedup

For a project with H shared headers and N TUs, standalone clang-tidy does O(N × H) work. With cross-TU dedup, clice is designed for incremental checking — the goal is to check each header once regardless of how many TUs include it.

clang-tidy Integration Quality

Issues that affect the quality of clang-tidy diagnostics within a language server:

  • Suppress clang-tidy warnings from macros in system headers (clangd#1587, clangd#2000)
  • Run checks on preprocessor directives in preamble (header guards, macros) (clangd#2501, clangd#160)
  • Configurable diagnostic severity per check category (clangd#1937)
  • Support loading clang-tidy plugins (clangd#1458)
  • Clang static analyzer support (clangd#905)
  • Clean up replacements when applying clang-tidy fixes (clangd#429)
  • Filter diagnostics by version control diff (clangd#822)
  • NOLINT / NOLINTNEXTLINE / NOLINTBEGIN-END comment suppression
  • Diagnostics.ClangTidy configuration in .clangd config
  • Fast-check filtering for clang-tidy performance
  • Fix-it suggestions from clang-tidy as code actions
  • Diagnostic metadata: check name, documentation URL, source tag

Configuration

Respects standard .clang-tidy configuration files in the project tree.

Changelog

DateChangePR
Stub implementation, dependency graph tracking