sizelint

Crates.iosizelint
lib.rssizelint
version0.1.3
created_at2025-07-16 23:52:54.428858+00
updated_at2025-07-23 17:51:47.601974+00
descriptionLint your working tree based on file size
homepagehttps://github.com/documentation/sizelint
repositoryhttps://github.com/documentation/sizelint
max_upload_size
id1756817
size139,774
kenji (a-kenji)

documentation

https://github.com/a-kenji/sizelint

README

$ sizelint - lint your working tree based on file sizes

Built with Nix Crates

Overview

sizelint is a fast, configurable file size linter that helps prevent large files from entering your Git repository. It can be used as a standalone tool, pre-commit hook, or as part of your CI/CD pipeline.

$ sizelint - usage

Lint your working tree based on file size

Usage: sizelint [OPTIONS] <COMMAND>

Commands:
  check        Check files for size violations
  init         Initialize sizelint configuration
  rules        Rule management
  completions  Generate shell completions
  help         Print this message or the help of the given subcommand(s)

Options:
  -c, --config <FILE>
          Configuration file path

  -v, --verbose
          Verbose output

      --log-level <LOG_LEVEL>
          Log level
          
          [default: info]

          Possible values:
          - trace: Trace level logging
          - debug: Debug level logging
          - info:  Info level logging
          - warn:  Warning level logging
          - error: Error level logging

  -h, --help
          Print help (see a summary with '-h')

  -V, --version
          Print version

$ sizelint check

Check files for size violations

Usage: sizelint check [OPTIONS] [PATHS]...

Arguments:
  [PATHS]...
          Paths to check

Options:
  -f, --format <FORMAT>
          Output format
          
          [default: human]

          Possible values:
          - human:   Human-readable output
          - json:    JSON output
          - summary: Summary only

      --staged
          Check only staged files (git diff --staged)

      --working-tree
          Check working tree files

  -q, --quiet
          Quiet mode (only show violations)

      --fail-on-warn
          Treat warnings as errors

  -h, --help
          Print help (see a summary with '-h')

$ sizelint rules

Rule management

Usage: sizelint rules <COMMAND>

Commands:
  list      List available rules
  describe  Show rule documentation
  help      Print this message or the help of the given subcommand(s)

Options:
  -h, --help  Print help

$ sizelint init

Initialize sizelint configuration

Usage: sizelint init [OPTIONS]

Options:
  -f, --force   Force overwrite existing configuration
      --stdout  Print the default configuration to stdout
      --edit    Open configuration file in editor after creation
  -h, --help    Print help

Quick Start

Installation

cargo install sizelint --locked

Basic Usage

# Initialize configuration
sizelint init

# Check all files
sizelint check

# Check specific files
sizelint check src/main.rs README.md

Configuration

sizelint uses TOML configuration files.

Run sizelint init to create a default configuration:

[sizelint]
max_file_size = "10MB"
warn_file_size = "5MB"
excludes = []
check_staged = false
check_working_tree = false
respect_gitignore = true
fail_on_warn = false

[rules.medium_files]
enabled = true
description = "Base rule that fits many normal repos"
priority = 50
max_size = "5MB"
warn_size = "2MB"
includes = []
excludes = []

[rules.no_images]
enabled = false
description = "Warn about image files that might be better handled with LFS"
priority = 80
includes = ["*.png", "*.jpg", "*.jpeg", "*.gif", "*.bmp"]
excludes = []
warn_on_match = true

Documentation

Development

Development Shell

nix develop

Building

cargo build --release

Testing

cargo test
cargo clippy

License

MIT License - see LICENSE file for details.

Commit count: 0

cargo fmt