Skip to content

Commit

Permalink
Use ruff python linter
Browse files Browse the repository at this point in the history
Signed-off-by: Henri Rosten <henri.rosten@unikie.com>
  • Loading branch information
henrirosten committed Jan 3, 2025
1 parent 62412bb commit 619cd22
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 19 deletions.
7 changes: 0 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,6 @@ test: ## Run tests
pytest -vx tests/
$(call target_success,$@)

format: clean ## Reformat with black
@for py in $(PYTHON_TARGETS); \
do echo "$$py:"; \
black -q $$py; \
done
$(call target_success,$@)

release-asset: clean ## Build release asset
mkdir -p build/
nix run --extra-experimental-features 'flakes nix-command' .#sbomnix -- . \
Expand Down
10 changes: 0 additions & 10 deletions nix/checks.nix
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,6 @@
reuse lint
touch $out
'';
pycodestyle =
pkgs.runCommandLocal "pycodestyle"
{
nativeBuildInputs = [ pkgs.python3.pkgs.pycodestyle ];
}
''
cd ${self.outPath}
pycodestyle --max-line-length 90 $(find . -name "*.py")
touch $out
'';
pylint =
pkgs.runCommandLocal "pylint"
{
Expand Down
2 changes: 1 addition & 1 deletion nix/devshell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
name = "sbomnix-devshell";
packages = with self'.packages; [
pkgs.python3.pkgs.pylint # for running pylint manually in devshell
pkgs.black # for running black manually in devshell
pkgs.ruff # for running ruff manually in devshell
pkgs.isort # for running isort manually in devshell
sbomnix.propagatedBuildInputs
sbomnix.nativeBuildInputs
Expand Down
3 changes: 2 additions & 1 deletion nix/treefmt.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@
inherit (config.flake-root) projectRootFile;

programs = {
black.enable = true; # lints python https://github.com/psf/black
deadnix.enable = true; # removes dead nix code https://github.com/astro/deadnix
isort.enable = true; # sort python imports https://github.com/PyCQA/isort
shellcheck.enable = true; # lints shell scripts https://github.com/koalaman/shellcheck
nixfmt.enable = true; # nix formatter https://github.com/NixOS/nixfmt
nixfmt.package = pkgs.nixfmt-rfc-style; # rfc-166 formatting conform version
ruff-check.enable = true; # lints python https://github.com/astral-sh/ruff
ruff-format.enable = true; # format python https://github.com/astral-sh/ruff
statix.enable = true; # prevents use of nix anti-patterns https://github.com/nerdypepper/statix
};
};
Expand Down

0 comments on commit 619cd22

Please sign in to comment.