Cargo.toml

[package]
# The package and the command share one name, so that `uvx xpd` runs it.
name = "xpd"
version = "0.31.0"
edition = "2024"
rust-version = "1.99"
description = "Fast, opinionated linter for Python library habits, starting with pandas, NumPy, SciPy and scikit-learn, for humans and coding agents"
license = "MIT AND Apache-2.0 AND BSD-3-Clause AND NCSA AND MPL-2.0 AND ISC AND MIT-0"
repository = "https://github.com/bjoernaagaard/xpd"
homepage = "https://bjoernaagaard.github.io/xpd/"
readme = "README.md"
keywords = ["pandas", "python", "linter", "ast-grep", "agents"]
categories = ["command-line-utilities", "development-tools"]
# Only what the build needs; samples/ and the dev tool configs stay out of the package.
include = ["/src", "/.cargo/config.toml", "/indexes", "/licenses", "/python/**/*.py", "/rules", "/py", "/build.rs", "/docs/rules.md", "/skills", "/plugin.json", "/mcp.json", "/LICENSE-*", "/README.md", "/pyproject.toml"]

[[bin]]
name = "xpd"
path = "src/main.rs"

[dependencies]
anyhow = "1.0.104"
ast-grep = "0.51.3"
ast-grep-config = "0.51.3"
ast-grep-core = "0.51.3"
ast-grep-language = "0.51.3"
ast-grep-outline = "0.51.3"
clap = { version = "4.6.7", features = ["derive"] }
clap_complete = "4.6.3"
# ast-grep-config already builds globset, so this adds no package to the build.
globset = "0.4.21"
ignore = "0.4.34"
# `xpd new` asks with the prompts that `ast-grep new` uses, so this adds no package to the build.
inquire = "0.9.5"
llama-cpp-2 = { version = "0.1.161", default-features = false }
# `xpd lsp`. lsp-server is the synchronous scaffold of rust-analyzer: its messages travel over
# channels and need no async runtime. xpd reads and writes them on its own two threads, in
# src/lsp/transport.rs. lsp-types holds the protocol's types.
lsp-server = "0.10.0"
lsp-types = "0.97.0"
rayon = "1.12.0"
regex = "1.13.1"
# ast-grep-config already builds serde with derive, so this adds no package to the build.
serde = { version = "1.0.229", features = ["derive"] }
serde-saphyr = "2.1.1"
serde_json = "1.0.154"
similar = "3.2.1"

[build-dependencies]
anyhow = "1.0.104"
serde_json = "1.0.154"

[lints.rust]
unsafe_op_in_unsafe_fn = "warn"          # each unsafe op needs its own unsafe block
missing_debug_implementations = "warn"   # every public type implements Debug
unreachable_pub = "warn"                 # pub items that aren't actually exported
rust_2018_idioms = { level = "warn", priority = -1 } # 2018-edition idioms, e.g. Formatter<'_>

[lints.clippy]
# Groups first, at lower priority so the individual settings below win.
all = { level = "warn", priority = -1 }
pedantic = { level = "warn", priority = -1 }

# Panics: return errors, and give every intentional panic a reason.
unwrap_used = "warn"                     # use ?, or expect("why this cannot fail")
expect_used = "allow"                    # expect with a reason is the sanctioned form
panic_in_result_fn = "warn"              # a fn returning Result shouldn't also panic
missing_assert_message = "warn"          # assert! says what went wrong (quiet inside #[test])

# Suppressions must explain themselves and expire when no longer needed.
allow_attributes = "warn"                # prefer #[expect] over #[allow] (needs rust-version 1.81+)
allow_attributes_without_reason = "warn" # every suppression says why (needs rust-version 1.81+)

# Unsafe must be justified.
undocumented_unsafe_blocks = "warn"      # // SAFETY: comment on every unsafe block
multiple_unsafe_ops_per_block = "warn"   # one unsafe operation per block

# API shape.
fn_params_excessive_bools = "warn"       # bool parameters: use an enum or two methods
struct_excessive_bools = "warn"          # many bool fields: use an enum or bitflags
clone_on_ref_ptr = "warn"                # write Rc::clone(&x) so cheap clones are visible
redundant_clone = "warn"                 # a clone whose original is never used again
rc_buffer = "warn"                       # Rc<String> / Rc<Vec<T>>: use Rc<str> / Rc<[T]>

# Idioms.
string_add = "warn"                      # build strings with format! or push_str, not +
wildcard_imports = "warn"                # no glob imports (use super::* in tests is allowed)

# Output and debugging leftovers.
dbg_macro = "warn"
todo = "warn"

# Casts that silently lose information.
as_conversions = "warn"                  # prefer From / TryFrom
cast_possible_truncation = "warn"
cast_sign_loss = "warn"

# Pedantic lints that are mostly noise in practice, or that the skill disagrees with.
module_name_repetitions = "allow"
must_use_candidate = "allow"
module_inception = "allow"               # a leaf module named after its main item is fine
enum_glob_use = "allow"                  # use Enum::* inside a function that matches on it

# Whole-program optimisation: 8.3 MB to 5.1 MB, and faster startup on the hook's hot path.
[profile.release]
opt-level = "s"
lto = true
codegen-units = 1
strip = true