lint

Run cargo clippy, cargo fmt CHECK=1, and license-header checks for Rust projects.

6.2k|590|Updated May 5, 2016
One-click install
npx skills add https://github.com/RediSearch/RediSearch --skill lint-redisearch
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: lint
Source: https://github.com/RediSearch/RediSearch/tree/main/.skills/lint
Command: npx skills add https://github.com/RediSearch/RediSearch --skill lint-redisearch

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps developers enforce code quality and formatting before commits, reducing bugs and review time.

Core Features & Use Cases

  • Lint checks: Run static analysis for Rust projects using cargo clippy to catch common mistakes.
  • Formatting checks: Enforce consistent code style with cargo fmt CHECK=1.
  • License headers: Ensure license headers are present in source files.
  • CI / pre-commit: Integrate into pre-commit hooks or CI pipelines to catch issues early.

Quick Start

Run the lint checks locally to identify and fix issues before committing:

  • make lint
  • If clippy reports warnings or errors, fix them before proceeding
  • Check formatting:
  • make fmt CHECK=1
  • If formatting check fails, apply formatting:
  • make fmt
  • If license headers are missing, add them:
  • cd src/redisearch_rs && cargo license-fix

Frequently Asked Questions about lint

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I enforce code quality checks before committing Rust code?

Enforce code quality checks by running cargo clippy for linting, cargo fmt CHECK=1 for formatting validation, and cargo license-fix for license headers. Integrate these into pre-commit hooks or CI pipelines to catch issues before code is committed, reducing bugs and review time.

Can I use cargo clippy and formatting checks in a pre-commit workflow?

Yes. This Skill integrates cargo clippy, cargo fmt, and license-header checks into pre-commit hooks and CI pipelines. Run make lint to execute static analysis, make fmt CHECK=1 to validate formatting consistency, and cargo license-fix to ensure license headers are present in source files.

What's the best way to fix code formatting issues in a Rust project?

Run make fmt CHECK=1 to detect formatting violations, then execute make fmt to apply corrections automatically. This enforces consistent code style across your Rust project before committing, integrating with pre-commit and CI workflows.

How do I add license headers to Rust source files automatically?

Use cargo license-fix from within your src directory to automatically add missing license headers to source files. This ensures compliance and consistency across your Rust project when integrated into pre-commit or CI pipelines.

Why should I run linting checks before committing code?

Linting with cargo clippy catches common mistakes and potential bugs early in development. Running checks before commits reduces bugs reaching review, shortens feedback cycles, and maintains code quality standards across your Rust project.

Do I need all three checks—clippy, formatting, and license headers—in my workflow?

No. This Skill supports linting, formatting, and license-header checks as independent or combined steps. Choose which checks suit your project requirements and integrate them selectively into pre-commit hooks or CI pipelines based on your team's standards.