2020-04-24 23:36:52 +00:00
|
|
|
{ lib
|
|
|
|
, buildPythonPackage
|
2020-09-25 04:45:31 +00:00
|
|
|
, fetchFromGitHub
|
2020-04-24 23:36:52 +00:00
|
|
|
, pythonOlder
|
|
|
|
, aws-sam-translator
|
2021-12-26 17:43:05 +00:00
|
|
|
, jschema-to-python
|
2020-04-24 23:36:52 +00:00
|
|
|
, jsonpatch
|
|
|
|
, jsonschema
|
2020-06-15 15:56:04 +00:00
|
|
|
, junit-xml
|
|
|
|
, networkx
|
2020-09-25 04:45:31 +00:00
|
|
|
, pyyaml
|
2021-12-26 17:43:05 +00:00
|
|
|
, sarif-om
|
2020-09-25 04:45:31 +00:00
|
|
|
, setuptools
|
|
|
|
, six
|
|
|
|
, mock
|
|
|
|
, pydot
|
2021-01-05 17:05:55 +00:00
|
|
|
, pytestCheckHook
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "cfn-lint";
|
2022-08-12 12:06:08 +00:00
|
|
|
version = "0.61.2";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-09-25 04:45:31 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "aws-cloudformation";
|
2021-01-05 17:05:55 +00:00
|
|
|
repo = "cfn-python-lint";
|
2022-08-12 12:06:08 +00:00
|
|
|
rev = "refs/tags/v${version}";
|
|
|
|
sha256 = "sha256-282h1fBWhAfwqCuP+dU3ajn0gQtmOcPNTMKZ0a2+vHU=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2020-09-25 04:45:31 +00:00
|
|
|
postPatch = ''
|
2021-01-05 17:05:55 +00:00
|
|
|
substituteInPlace setup.py \
|
2022-02-10 20:34:41 +00:00
|
|
|
--replace "jsonschema~=3.0" "jsonschema>=3.0"
|
2020-09-25 04:45:31 +00:00
|
|
|
'';
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
aws-sam-translator
|
2021-12-26 17:43:05 +00:00
|
|
|
jschema-to-python
|
2020-04-24 23:36:52 +00:00
|
|
|
jsonpatch
|
|
|
|
jsonschema
|
2020-06-15 15:56:04 +00:00
|
|
|
junit-xml
|
|
|
|
networkx
|
2020-09-25 04:45:31 +00:00
|
|
|
pyyaml
|
2021-12-26 17:43:05 +00:00
|
|
|
sarif-om
|
2020-09-25 04:45:31 +00:00
|
|
|
six
|
2022-02-10 20:34:41 +00:00
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-01-05 17:05:55 +00:00
|
|
|
checkInputs = [
|
|
|
|
mock
|
|
|
|
pydot
|
|
|
|
pytestCheckHook
|
|
|
|
];
|
|
|
|
|
|
|
|
preCheck = ''
|
|
|
|
export PATH=$out/bin:$PATH
|
|
|
|
'';
|
|
|
|
|
|
|
|
disabledTests = [
|
2021-01-09 10:05:03 +00:00
|
|
|
# These tests depend on the current date, for example because of issues like this.
|
|
|
|
# This makes it possible for them to succeed on hydra and then begin to fail without
|
|
|
|
# any code changes.
|
|
|
|
# https://github.com/aws-cloudformation/cfn-python-lint/issues/1705
|
|
|
|
# See also: https://github.com/NixOS/nixpkgs/issues/108076
|
|
|
|
"TestQuickStartTemplates"
|
2021-01-05 17:05:55 +00:00
|
|
|
# requires git directory
|
|
|
|
"test_update_docs"
|
2021-04-26 19:14:03 +00:00
|
|
|
# Tests depend on network access (fails in getaddrinfo)
|
|
|
|
"test_update_resource_specs_python_2"
|
|
|
|
"test_update_resource_specs_python_3"
|
2021-12-26 17:43:05 +00:00
|
|
|
"test_sarif_formatter"
|
2021-01-05 17:05:55 +00:00
|
|
|
];
|
|
|
|
|
2020-09-25 04:45:31 +00:00
|
|
|
pythonImportsCheck = [
|
|
|
|
"cfnlint"
|
|
|
|
"cfnlint.conditions"
|
|
|
|
"cfnlint.core"
|
|
|
|
"cfnlint.decode.node"
|
|
|
|
"cfnlint.decode.cfn_yaml"
|
|
|
|
"cfnlint.decode.cfn_json"
|
|
|
|
"cfnlint.decorators.refactored"
|
|
|
|
"cfnlint.graph"
|
|
|
|
"cfnlint.helpers"
|
|
|
|
"cfnlint.rules"
|
|
|
|
"cfnlint.runner"
|
|
|
|
"cfnlint.template"
|
|
|
|
"cfnlint.transform"
|
|
|
|
];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "Checks cloudformation for practices and behaviour that could potentially be improved";
|
|
|
|
homepage = "https://github.com/aws-cloudformation/cfn-python-lint";
|
2020-09-25 04:45:31 +00:00
|
|
|
changelog = "https://github.com/aws-cloudformation/cfn-python-lint/blob/master/CHANGELOG.md";
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.mit;
|
|
|
|
};
|
|
|
|
}
|