Lint
A versatile linting tool with multiple interfaces: CLI, MCP (Model Context Protocol), and library.
Features
- CLI Interface: Run linting from the command line
- MCP Server: Expose linting capabilities via MCP protocol
- Library API: Use linting functionality in your Rust projects
Installation
Usage
CLI
Lint files or directories:
# Lint current directory
# Lint specific files
# Specify output format (text, json, markdown)
# Set maximum line length
# Enable specific rules
# List available rules
# Show version
MCP Server
Run the MCP server:
The server exposes the following tools:
lint_files: Lint specified files and return issueslist_rules: List all available linting rules
Library
Use as a library in your Rust project:
use ;
Available Rules
All violations include fix suggestions to help resolve issues. Use --output text to see → help: messages, or --output markdown for **Fix**: blocks.
Universal Rules
line-length: Lines exceeding max length → break line, extract variable, or use continuationtrailing-whitespace: Trailing spaces/tabs → removeno-todo: TODO/FIXME comments → address or create tracking issue
JavaScript/TypeScript Rules
no-console-log: console.log/warn/error → use loggerno-var: var usage → use let/constmissing-semicolon: Missing semicolons
Python Rules
no-print: print() → use logging modulepython-style: PEP 8 (PascalCase classes, snake_case functions)
Go Rules
go-style: Exported functions need documentation
Java Rules
java-style: PascalCase classes, no System.out → use SLF4Jmissing-semicolon: Missing semicolons
Rust Rules
no-unwrap: .unwrap() → use ? or matchno-expect: .expect() → use ? or matchmissing-semicolon: Missing semicolons
Ruby Rules
no-puts: puts → use Loggerruby-style: CamelCase classes, attr_writer for setters
PHP Rules
no-echo: echo → use error_log or return JSON
Swift Rules
no-swift-print: print() → use OSLog
Kotlin Rules
kotlin-style: PascalCase classes, println → use slf4j
Dart Rules
no-dart-print: print() → use debugPrint or logging package
C# Rules
no-csharp-console: Console.WriteLine → use ILoggercsharp-style: PascalCase classes
Shell Rules
shell-echo-quote: Unquoted variables in echo → quote with"$VAR"
SQL Rules
sql-no-select-star: SELECT * → list explicit columns
Lua Rules
no-lua-print: print() → use logging or remove
Scala Rules
no-scala-println: println() → use slf4j
R Rules
no-r-print: print() → use message() or cat()
Zig Rules
no-zig-debug-print: std.debug.print → remove or use std.log
HTML Rules
html-no-inline-style: Inline style= → move to CSS classhtml-img-alt: img without alt → add alt for accessibility
CSS Rules
css-avoid-important: !important → increase selector specificity
Configuration
Create a custom configuration:
let config = new
.paths
.ignore_patterns
.max_line_length
.enabled_rules
.custom_rules
.output_format
.build;
Supported File Extensions
- Rust:
.rs - JavaScript/TypeScript:
.js,.ts,.jsx,.tsx - Python:
.py - Java:
.java - Go:
.go - C/C++:
.c,.cpp,.h,.hpp - Ruby:
.rb - PHP:
.php - Swift:
.swift - Kotlin:
.kt - Dart:
.dart - C#:
.cs - Shell:
.sh,.bash - SQL:
.sql - Lua:
.lua - Scala:
.scala - R:
.r - Zig:
.zig - HTML:
.html,.htm - CSS:
.css,.scss,.sass
Output Formats
- Text: Human-readable output (default)
- Json: Machine-readable JSON format
- Markdown: Markdown-formatted output
Contributing
If you find this project helpful, please consider giving it a star ⭐️
Feedback, issues, and pull requests are welcome! Feel free to open an issue for bug reports, feature requests, or questions.
License
Apache-2.0