1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 gibberish-detector,
6 mock,
7 pkgs,
8 pyahocorasick,
9 pytest7CheckHook,
10 pythonOlder,
11 pyyaml,
12 requests,
13 responses,
14 unidiff,
15}:
16
17buildPythonPackage rec {
18 pname = "detect-secrets";
19 version = "1.5.0";
20 format = "setuptools";
21
22 disabled = pythonOlder "3.7";
23
24 src = fetchFromGitHub {
25 owner = "Yelp";
26 repo = pname;
27 rev = "refs/tags/v${version}";
28 hash = "sha256-pNLAZUJhjZ3b01XaltJUJ9O7Blv6/pHQrRvURe7MJ5A=";
29 leaveDotGit = true;
30 };
31
32 propagatedBuildInputs = [
33 gibberish-detector
34 pyyaml
35 pyahocorasick
36 requests
37 ];
38
39 nativeCheckInputs = [
40 mock
41 pytest7CheckHook
42 responses
43 unidiff
44 pkgs.gitMinimal
45 ];
46
47 preCheck = ''
48 export HOME=$(mktemp -d);
49 '';
50
51 disabledTests = [
52 # Tests are failing for various reasons. Needs to be adjusted with the next update
53 "test_basic"
54 "test_handles_each_path_separately"
55 "test_handles_multiple_directories"
56 "test_load_and_output"
57 "test_make_decisions"
58 "test_restores_line_numbers"
59 "test_saves_to_baseline"
60 "test_scan_all_files"
61 "test_start_halfway"
62 ];
63
64 pythonImportsCheck = [ "detect_secrets" ];
65
66 meta = with lib; {
67 description = "Enterprise friendly way of detecting and preventing secrets in code";
68 homepage = "https://github.com/Yelp/detect-secrets";
69 license = licenses.asl20;
70 maintainers = [ ];
71 };
72}