Skip to content

Commit

Permalink
fix: remove cfn lint (#1034)
Browse files Browse the repository at this point in the history
  • Loading branch information
keetonian authored and praneetap committed Jul 26, 2019
1 parent 990c7f6 commit af20fb5
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 52 deletions.
1 change: 0 additions & 1 deletion requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ pyyaml>=4.2b1
pytest>=3.0.7
mock>=2.0.0
parameterized>=0.6.1
cfn-lint>=0.18.1

# Requirements for examples
requests>=2.20.0
Expand Down
51 changes: 0 additions & 51 deletions tests/translator/test_translator.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import json
import cfnlint.core
from cfnlint import Runner
import itertools
import os.path
import hashlib
Expand Down Expand Up @@ -36,21 +34,6 @@
INPUT_FOLDER = os.path.join(BASE_PATH, 'input')
OUTPUT_FOLDER = os.path.join(BASE_PATH, 'output')

LINT_IGNORE_WARNINGS = [
'W2001', # unused parameters. Sometimes, SAM uses parameters and removes the param reference from the output template, but the parameter stays in the parameters section.
'W1001', # Ref/GetAtt with conditions. This incorrectly flags resources since it can't map conditions fully.
'E3001', # Check for resource availability in a region.
'W7001', # Check if mappings are used. Serverless::Application uses mappings, the output CFN doesn't use them anymore.
'W1020', # Sub isn't needed if it doesn't have a variable defined. SAM leaves `!Sub` in even if it tries to resolve variables.
'E2531', # we don't care if a runtime has been deprecated in our tests.
'E3038', # Serverless resources- test for invalid resources.
]

LINT_IGNORE_TESTS = [
'function_with_resource_refs', # Tests functionality of the translator in ways that result in improper GetAtt calls on CFN resources.
'api_with_canary_setting', # Has stage variable overrides for nonexistent stage variables.
]


def deep_sort_lists(value):
"""
Expand Down Expand Up @@ -300,29 +283,12 @@ def test_transform_success(self, testcase, partition_with_region):

print(json.dumps(output_fragment, indent=2))

# Run cfn-lint on translator test output files.
rules = cfnlint.core.get_rules([], LINT_IGNORE_WARNINGS, [])

# Only update the deployment Logical Id hash in Py3.
if sys.version_info.major >= 3:
self._update_logical_id_hash(expected)
self._update_logical_id_hash(output_fragment)
output_template = cfnlint.decode.cfn_json.load(expected_filepath)
else: # deprecation warning catching in py2
import warnings
with warnings.catch_warnings():
warnings.filterwarnings("ignore",category=DeprecationWarning)
output_template = cfnlint.decode.cfn_json.load(expected_filepath)
runner = cfnlint.Runner(rules, expected_filepath, output_template, [region])
matches = []

# Only run linter on normal/gov partitions. It errors on china regions
if testcase not in LINT_IGNORE_TESTS and partition != 'aws-cn':
matches = runner.run()
print('cfn-lint ({}): {}'.format(expected_filepath, matches))

assert deep_sort_lists(output_fragment) == deep_sort_lists(expected)
assert len(matches) == 0

@parameterized.expand(
itertools.product([
Expand Down Expand Up @@ -373,29 +339,12 @@ def test_transform_success_openapi3(self, testcase, partition_with_region):

print(json.dumps(output_fragment, indent=2))

# Run cfn-lint on translator test output files.
rules = cfnlint.core.get_rules([], LINT_IGNORE_WARNINGS, [])

# Only update the deployment Logical Id hash in Py3.
if sys.version_info.major >= 3:
self._update_logical_id_hash(expected)
self._update_logical_id_hash(output_fragment)
output_template = cfnlint.decode.cfn_json.load(expected_filepath)
else: # deprecation warning catching in py2
import warnings
with warnings.catch_warnings():
warnings.filterwarnings("ignore",category=DeprecationWarning)
output_template = cfnlint.decode.cfn_json.load(expected_filepath)
runner = cfnlint.Runner(rules, expected_filepath, output_template, [region])
matches = []

# Only run linter on normal/gov partitions. It errors on china regions
if testcase not in LINT_IGNORE_TESTS and partition != 'aws-cn':
matches = runner.run()
print('cfn-lint ({}): {}'.format(expected_filepath, matches))

assert deep_sort_lists(output_fragment) == deep_sort_lists(expected)
assert len(matches) == 0

def _update_logical_id_hash(self, resources):
"""
Expand Down

0 comments on commit af20fb5

Please sign in to comment.