mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-12-01 02:12:19 +00:00
unidiff 1.0.1 changed how a "---" header is handled inside a "diff --git" block (matiasb/python-unidiff#144, which fixed #143): it no longer starts a new file while a git header is being processed. The fixture test_data/sample.diff ends with a second "diff --git a/setup.py b/setup.py" header whose "---"/"+++" pair names .secrets.baseline, so the parser still has setup.py open when it reaches "+++ b/.secrets.baseline" and raises UnidiffParseError("Target without source") from the long-standing target check in patch.py. unidiff 1.0.0 parsed the same fixture as five files. That fails two tests: tests/core/secrets_collection_test.py::TestScanDiff::test_filename_filters_are_invoked_first tests/core/secrets_collection_test.py::TestScanDiff::test_success and with them every package that depends on python3Packages.bc-detect-secrets, checkov among them ("1 dependency failed"). Both tests were already disabled on Darwin (nixpkgs#578390); disable them unconditionally instead. Assisted-by: pi:Qwen3.8-Flash-Yamz
80 lines
1.9 KiB
Nix
80 lines
1.9 KiB
Nix
{
|
|
lib,
|
|
buildPythonPackage,
|
|
fetchFromGitHub,
|
|
gibberish-detector,
|
|
mock,
|
|
pkgs,
|
|
pyahocorasick,
|
|
pytestCheckHook,
|
|
pyyaml,
|
|
requests,
|
|
responses,
|
|
setuptools,
|
|
unidiff,
|
|
writableTmpDirAsHomeHook,
|
|
}:
|
|
|
|
buildPythonPackage (finalAttrs: {
|
|
pname = "bc-detect-secrets";
|
|
version = "1.5.52";
|
|
pyproject = true;
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "bridgecrewio";
|
|
repo = "detect-secrets";
|
|
tag = finalAttrs.version;
|
|
hash = "sha256-QCC7Psto8xIy7d2U56a5b4PTG2u9efnHtHhLQQbJkBQ=";
|
|
};
|
|
|
|
build-system = [ setuptools ];
|
|
|
|
dependencies = [
|
|
pyyaml
|
|
requests
|
|
unidiff
|
|
];
|
|
|
|
optional-dependencies = {
|
|
word_list = [ pyahocorasick ];
|
|
gibberish = [ gibberish-detector ];
|
|
};
|
|
|
|
nativeCheckInputs = [
|
|
mock
|
|
pkgs.gitMinimal
|
|
pytestCheckHook
|
|
responses
|
|
writableTmpDirAsHomeHook
|
|
]
|
|
++ lib.flatten (builtins.attrValues finalAttrs.passthru.optional-dependencies);
|
|
|
|
disabledTests = [
|
|
# Tests are failing for various reasons (missing git repo, missing test data, etc.)
|
|
"test_baseline_filters_out_known_secrets"
|
|
"test_make_decisions"
|
|
"test_saves_to_baseline"
|
|
"test_start_halfway"
|
|
"TestCreate"
|
|
"TestDiff"
|
|
"TestGetFilesToScan"
|
|
"TestLineNumberChanges"
|
|
"TestModifiesBaselineFromVersionChange"
|
|
# unidiff 1.0.1 stopped starting a new file at a "---" header inside an
|
|
# open "diff --git" block (matiasb/python-unidiff#144), so the parser is
|
|
# still on setup.py when this fixture's last block targets
|
|
# .secrets.baseline, and parsing the fixture raises UnidiffParseError.
|
|
"test_filename_filters_are_invoked_first"
|
|
"test_success"
|
|
];
|
|
|
|
pythonImportsCheck = [ "detect_secrets" ];
|
|
|
|
meta = {
|
|
description = "Tool to detect secrets in the code";
|
|
homepage = "https://github.com/bridgecrewio/detect-secrets";
|
|
license = lib.licenses.asl20;
|
|
maintainers = with lib.maintainers; [ fab ];
|
|
};
|
|
})
|