Skip to content

Commit

Permalink
🐛 Fix & Improve python check runner
Browse files Browse the repository at this point in the history
There are cases where TMP env is not set which made some tools not
pick up configuration. Using mktemp and generating a new file every
time instead.

In the case where you were in a shell and changed your directory the
script would also miss the configuration files. Fixed so it always
looks in component dir.
  • Loading branch information
sakarias88 committed May 30, 2024
1 parent 54c4732 commit d4870cb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## Fixed
- Python check runner not finding config when not in root of component.
- Fix some outside tools not getting check configs because TMP is not
always set.

## [4.1.3] - 2024-03-22

## Fixed
Expand Down
6 changes: 3 additions & 3 deletions python/hooks/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ let
executable = true;
text = ''
#!${runtimeShell}
config_file=$TMP/lint-configs/${config}
mkdir -p "$(dirname "$config_file")"
config_file=$(mktemp --tmpdir -d lint-configs-XXXX)/${config}
export PYTHONPATH=''${PYTHONPATH:-}:${py.pkgs.toml}/${py.sitePackages}
${py}/bin/python \
${./config-merger.py} \
--tool "${key}" \
Expand All @@ -66,7 +66,7 @@ let
if builtins.isPath file.path then
"${file.path}=${file.key}"
else
"./${file.path}=${file.key}"
"\"\${componentDir:-.}/${file.path}=${file.key}\""
)
(
builtins.map
Expand Down

0 comments on commit d4870cb

Please sign in to comment.