1{
2 lib,
3 aws-sam-translator,
4 buildPythonPackage,
5 defusedxml,
6 fetchFromGitHub,
7 jschema-to-python,
8 jsonpatch,
9 jsonschema,
10 junit-xml,
11 mock,
12 networkx,
13 pydot,
14 pytestCheckHook,
15 pythonOlder,
16 pyyaml,
17 regex,
18 sarif-om,
19 setuptools,
20 sympy,
21}:
22
23buildPythonPackage rec {
24 pname = "cfn-lint";
25 version = "1.18.1";
26 pyproject = true;
27
28 disabled = pythonOlder "3.8";
29
30 src = fetchFromGitHub {
31 owner = "aws-cloudformation";
32 repo = "cfn-lint";
33 rev = "refs/tags/v${version}";
34 hash = "sha256-e06ytX1scIsmw/SezIVVnGn0day1l6kQ/wb05E8O7h0=";
35 };
36
37 build-system = [ setuptools ];
38
39 dependencies = [
40 aws-sam-translator
41 jschema-to-python
42 jsonpatch
43 jsonschema
44 junit-xml
45 networkx
46 networkx
47 pyyaml
48 regex
49 sarif-om
50 sympy
51 ];
52
53 optional-dependencies = {
54 graph = [ pydot ];
55 junit = [ junit-xml ];
56 sarif = [
57 jschema-to-python
58 sarif-om
59 ];
60 full = [
61 jschema-to-python
62 junit-xml
63 pydot
64 sarif-om
65 ];
66 };
67
68 nativeCheckInputs = [
69 defusedxml
70 mock
71 pytestCheckHook
72 ] ++ lib.flatten (builtins.attrValues optional-dependencies);
73
74 preCheck = ''
75 export PATH=$out/bin:$PATH
76 '';
77
78 disabledTests = [
79 # Requires git directory
80 "test_update_docs"
81 # Tests depend on network access (fails in getaddrinfo)
82 "test_update_resource_specs_python_2"
83 "test_update_resource_specs_python_3"
84 "test_sarif_formatter"
85 # Some CLI tests fails
86 "test_bad_config"
87 "test_override_parameters"
88 "test_positional_template_parameters"
89 "test_template_config"
90 # Assertion error
91 "test_build_graph"
92 ];
93
94 pythonImportsCheck = [ "cfnlint" ];
95
96 meta = with lib; {
97 description = "Checks cloudformation for practices and behaviour that could potentially be improved";
98 mainProgram = "cfn-lint";
99 homepage = "https://github.com/aws-cloudformation/cfn-lint";
100 changelog = "https://github.com/aws-cloudformation/cfn-lint/blob/v${version}/CHANGELOG.md";
101 license = licenses.mit;
102 maintainers = [ ];
103 };
104}