{"repo":"nix-community/nixpkgs-lint","free":true,"listed":false,"github":"https://github.com/nix-community/nixpkgs-lint","clone":"git clone https://github.com/nix-community/nixpkgs-lint.git","description":"A fast semantic linter for Nix using tree-sitter 🌳 + ❄️. [maintainers=@Artturin,@siraben]","language":"Rust","stars":175,"topics":["nix","linter","tree-sitter"],"license":"MIT","category":"dev-tools","readme_excerpt":"Semantic linter for Nixpkgs using tree-sitter 🌳 + ❄️ This is a semantic linter for Nixpkgs that uses tree-sitter. Currently we have the following detections: - [x] cmake , makeWrapper , pkg-config in buildInputs - [x] redundant packages from stdenv in nativeBuildInputs Features - Fast : lints all of Nixpkgs in under 3 seconds - Semantic linting : forget about hacking up regexes, we run queries directly on parse trees created by tree-sitter - Syntax-aware : nixpkgs-lint can easily handle multi-line expressions, eliminates false-positives from strings and comments and gives exact spans for matches - Robust : lint Nix files even in the presence of syntax errors - Hackable : create your own lints by writing queries or Rust code Usage To use without installing, run nix run github:nix-community/nixpkgs-lint . The tool will recurse through every .nix file in the provided path(,s). Motivation Why another linter? My motivation for this was spawned after doing a series of treewide PRs such as moving cmake to buildInputs. The strategy was similar each time; write some shell one-liner to go through every file (27,000+ of them) in Nixpkgs and find some anti-pattern to fix. However, this is quickly problematic for multiple reasons: - it is hard to account for multi-line expressions - it is hard to filter out false positives - it is hard to query for more complex features In general discussions on IRC and Matrix, a more AST-aware approach to linting was viewed favorably but not many people","default_branch":null,"files":null,"tree":[],"storefront":"/r/nix-community","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/nix-community/nixpkgs-lint/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}