Skip to main content

Crate clippier

Crate clippier 

Source
Expand description

Rust workspace analysis and automation tool for managing multi-package projects.

Clippier provides utilities for analyzing Rust workspaces and automating development tasks with a focus on CI/CD pipeline generation, dependency analysis, and feature management.

§Core Features

  • CI/CD Pipeline Generation - Generate feature matrices for comprehensive testing
  • Dependency Analysis - Analyze workspace dependencies and relationships
  • Feature Management - Generate and validate feature combinations
  • Feature Propagation Validation - Ensure features propagate correctly across workspace dependencies
  • Change Impact Analysis - Determine which packages are affected by file changes
  • Docker Integration - Generate optimized Dockerfiles for workspace packages
  • External Dependency Tracking - Detect changes in external dependencies via git diff

§Basic Usage

The primary entry point is the command-line tool, but the library also exports core functionality for programmatic use:

use clippier::{FeatureValidator, ValidatorConfig, OutputType};

type BoxError = Box<dyn std::error::Error + Send + Sync>;
// Validate feature propagation across workspace
let config = ValidatorConfig {
    features: Some(vec!["fail-on-warnings".to_string()]),
    output_format: OutputType::Json,
    ..Default::default()
};

let validator = FeatureValidator::new(None, config)?;
let result = validator.validate()?;

println!("Validated {} packages", result.total_packages);

§Optional Features

  • git-diff (default) - Enhanced change analysis using git diff to detect external dependency changes
  • test-utils - Utilities for testing (automatically enabled when running tests)
  • fail-on-warnings - Fail build on compiler warnings

Re-exports§

pub use feature_validator::FeatureValidator;
pub use feature_validator::ValidationResult;
pub use feature_validator::ValidatorConfig;
pub use feature_validator::print_github_output;
pub use feature_validator::print_human_output;
pub use publish::PublishConfig;
pub use publish::handle_publish_command;

Modules§

feature_validator
Feature propagation validation for workspace dependencies.
git_diff
Git diff analysis for detecting external dependency changes.
package_filter
Package filtering based on Cargo.toml properties.
publish
Cargo workspace publishing support. Cargo workspace publishing support.
tools
Tool detection and execution infrastructure for linting and formatting.
transforms
Matrix transformation system with Lua scripting support.
versioning
Cargo workspace version bumping support. Cargo workspace version bumping support.
workspace
Generic workspace abstraction for monorepo support.

Structs§

AffectedPackageInfo
Information about a package affected by changes
AffectedPackagesResult
Result structure for affected packages command
CargoLock
Representation of a Cargo.lock file
CargoLockPackage
A package entry in a Cargo.lock file
ClippierConf
Root configuration structure for clippier.toml files
ClippierConfiguration
Configuration for a single platform/OS in clippier.toml
NodeConfig
Node.js-specific configuration options.
PackageInfo
Information about a workspace package
ParallelizationConfig
Configuration for parallelization settings
PropagatedConfig
Configuration that propagates from workspace dependencies
RustConfig
Rust-specific configuration options.
SinglePackageResult
Result structure for single package analysis
SplitIter
Iterator that yields chunks from a slice
Step
A build or dependency step in CI configuration
WorkspaceClippierConf
Workspace-level configuration (root clippier.toml)
WorkspaceContext
Context for workspace member resolution and caching
WorkspaceDepsResult
Result structure for workspace dependencies command
WorkspaceToolchains
Aggregated toolchain information for workspace-level CI setup

Enums§

ClippierEnv
Environment variable configuration that can be filtered by features
ColorMode
Color mode for tool output forwarding
FeaturesList
List of features that may be chunked for parallel processing
OutputType
Output format for CLI commands
VecOrItem
Helper type that accepts either a single item or a vector of items

Functions§

apply_max_parallel_rechunking
Handle chunking and max_parallel re-chunking by combining packages
collect_environment_variables
Collects environment variables for a target package
collect_system_dependencies
Collects system dependencies for a target package
create_map
Creates a JSON map from a configuration
expand_active_package_features
Expands requested package features to include all transitively activated package features.
expand_features_from_cargo_toml
Expands wildcard patterns in a feature list against available features from Cargo.toml.
expand_pattern_list
Expands wildcard patterns in a list to match against available items.
fetch_features
Fetches and filters features from a Cargo.toml file
find_affected_packages
Finds packages that are affected by changed files
find_affected_packages_with_reasoning
Finds packages that are affected by changed files with reasoning
find_workspace_dependencies
Finds workspace dependencies for a target package
generate_dockerfile
Generates a Dockerfile for a target package
generate_dockerfile_content
Generates Dockerfile content for a workspace package.
generate_dockerfile_content_from_git
Generates Dockerfile content for a package built from a git repository.
generate_dockerfile_from_git
Generates a Dockerfile for a target package from a git URL
generate_dockerignore_content
Generates the content of a .dockerignore file for a target package
generate_dockerignore_content_for_git
Generates .dockerignore file content for git-based builds.
get_binary_name
Gets the binary name for a package, using override if provided or reading from Cargo.toml
get_dependency_default_features
Gets the default-features setting for a dependency
get_feature_dependencies
Extracts feature-activated dependencies from a Cargo.toml file
handle_affected_packages_command
Handles the affected packages command
handle_check_command
Handles the check command (run linters and format checkers)
handle_ci_steps_command
Handles the CI steps command
handle_dependencies_command
Handles the dependencies command
handle_environment_command
Handles the environment command
handle_features_command
Generates a feature matrix for workspace packages.
handle_fmt_command
Handles the fmt command (run formatters)
handle_generate_dockerfile_command
Handles the generate dockerfile command
handle_packages_command
Errors
handle_validate_feature_propagation_command
Handles the validate feature propagation command
handle_workspace_deps_command
Handles the workspace deps command
handle_workspace_toolchains_command
Aggregates all toolchains and dependencies from workspace packages for CI setup.
is_git_url
Determines if a path string is a git URL
is_workspace_dependency
Checks if a dependency uses workspace inheritance
is_workspace_dependency_with_features
Checks if a dependency uses workspace inheritance with features
matches_pattern
Checks if an item matches a pattern (supports wildcards and exact matches).
parse_dependency_name
Parses a dependency line to extract the package name
process_configs
Processes a Cargo.toml file and returns a list of packages with their features
process_features
Processes a list of features with optional chunking, spreading, and randomization
process_workspace_configs
Processes workspace configurations and returns a list of packages with their dependencies
should_skip_feature
Checks if a feature should be skipped based on patterns.
split
Splits a slice into approximately n equal-sized chunks