1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, pythonOlder
5, aws-sam-translator
6, jschema-to-python
7, jsonpatch
8, jsonschema
9, junit-xml
10, networkx
11, pyyaml
12, sarif-om
13, setuptools
14, six
15, mock
16, pydot
17, pytestCheckHook
18}:
19
20buildPythonPackage rec {
21 pname = "cfn-lint";
22 version = "0.73.2";
23
24 src = fetchFromGitHub {
25 owner = "aws-cloudformation";
26 repo = "cfn-python-lint";
27 rev = "refs/tags/v${version}";
28 hash = "sha256-CNB5LrXllGxy99NjCrbjkUXUpJ72U3pUnWqrqkOiCG8=";
29 };
30
31 postPatch = ''
32 substituteInPlace setup.py \
33 --replace "jsonschema~=3.0" "jsonschema>=3.0"
34 '';
35
36 propagatedBuildInputs = [
37 aws-sam-translator
38 jschema-to-python
39 jsonpatch
40 jsonschema
41 junit-xml
42 networkx
43 pyyaml
44 sarif-om
45 six
46 ];
47
48 nativeCheckInputs = [
49 mock
50 pydot
51 pytestCheckHook
52 ];
53
54 preCheck = ''
55 export PATH=$out/bin:$PATH
56 '';
57
58 disabledTests = [
59 # These tests depend on the current date, for example because of issues like this.
60 # This makes it possible for them to succeed on hydra and then begin to fail without
61 # any code changes.
62 # https://github.com/aws-cloudformation/cfn-python-lint/issues/1705
63 # See also: https://github.com/NixOS/nixpkgs/issues/108076
64 "TestQuickStartTemplates"
65 # requires git directory
66 "test_update_docs"
67 # Tests depend on network access (fails in getaddrinfo)
68 "test_update_resource_specs_python_2"
69 "test_update_resource_specs_python_3"
70 "test_sarif_formatter"
71 ];
72
73 pythonImportsCheck = [
74 "cfnlint"
75 "cfnlint.conditions"
76 "cfnlint.core"
77 "cfnlint.decode.node"
78 "cfnlint.decode.cfn_yaml"
79 "cfnlint.decode.cfn_json"
80 "cfnlint.decorators.refactored"
81 "cfnlint.graph"
82 "cfnlint.helpers"
83 "cfnlint.rules"
84 "cfnlint.runner"
85 "cfnlint.template"
86 "cfnlint.transform"
87 ];
88
89 meta = with lib; {
90 description = "Checks cloudformation for practices and behaviour that could potentially be improved";
91 homepage = "https://github.com/aws-cloudformation/cfn-python-lint";
92 changelog = "https://github.com/aws-cloudformation/cfn-python-lint/blob/master/CHANGELOG.md";
93 license = licenses.mit;
94 };
95}