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