cfn-check 0.2.0__tar.gz → 0.2.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of cfn-check might be problematic. Click here for more details.

Files changed (36) hide show
  1. {cfn_check-0.2.0 → cfn_check-0.2.1}/PKG-INFO +2 -2
  2. {cfn_check-0.2.0 → cfn_check-0.2.1}/README.md +1 -1
  3. {cfn_check-0.2.0 → cfn_check-0.2.1}/cfn_check/cli/utils/files.py +50 -2
  4. {cfn_check-0.2.0 → cfn_check-0.2.1}/cfn_check.egg-info/PKG-INFO +2 -2
  5. {cfn_check-0.2.0 → cfn_check-0.2.1}/pyproject.toml +1 -1
  6. {cfn_check-0.2.0 → cfn_check-0.2.1}/LICENSE +0 -0
  7. {cfn_check-0.2.0 → cfn_check-0.2.1}/cfn_check/__init__.py +0 -0
  8. {cfn_check-0.2.0 → cfn_check-0.2.1}/cfn_check/cli/__init__.py +0 -0
  9. {cfn_check-0.2.0 → cfn_check-0.2.1}/cfn_check/cli/root.py +0 -0
  10. {cfn_check-0.2.0 → cfn_check-0.2.1}/cfn_check/cli/utils/__init__.py +0 -0
  11. {cfn_check-0.2.0 → cfn_check-0.2.1}/cfn_check/cli/utils/attributes.py +0 -0
  12. {cfn_check-0.2.0 → cfn_check-0.2.1}/cfn_check/cli/validate.py +0 -0
  13. {cfn_check-0.2.0 → cfn_check-0.2.1}/cfn_check/collection/__init__.py +0 -0
  14. {cfn_check-0.2.0 → cfn_check-0.2.1}/cfn_check/collection/collection.py +0 -0
  15. {cfn_check-0.2.0 → cfn_check-0.2.1}/cfn_check/evaluation/__init__.py +0 -0
  16. {cfn_check-0.2.0 → cfn_check-0.2.1}/cfn_check/evaluation/check.py +0 -0
  17. {cfn_check-0.2.0 → cfn_check-0.2.1}/cfn_check/evaluation/errors.py +0 -0
  18. {cfn_check-0.2.0 → cfn_check-0.2.1}/cfn_check/evaluation/search.py +0 -0
  19. {cfn_check-0.2.0 → cfn_check-0.2.1}/cfn_check/evaluation/validate.py +0 -0
  20. {cfn_check-0.2.0 → cfn_check-0.2.1}/cfn_check/loader/__init__.py +0 -0
  21. {cfn_check-0.2.0 → cfn_check-0.2.1}/cfn_check/loader/loader.py +0 -0
  22. {cfn_check-0.2.0 → cfn_check-0.2.1}/cfn_check/logging/__init__.py +0 -0
  23. {cfn_check-0.2.0 → cfn_check-0.2.1}/cfn_check/logging/models.py +0 -0
  24. {cfn_check-0.2.0 → cfn_check-0.2.1}/cfn_check/rules/__init__.py +0 -0
  25. {cfn_check-0.2.0 → cfn_check-0.2.1}/cfn_check/rules/rule.py +0 -0
  26. {cfn_check-0.2.0 → cfn_check-0.2.1}/cfn_check/shared/__init__.py +0 -0
  27. {cfn_check-0.2.0 → cfn_check-0.2.1}/cfn_check/shared/types.py +0 -0
  28. {cfn_check-0.2.0 → cfn_check-0.2.1}/cfn_check/validation/__init__.py +0 -0
  29. {cfn_check-0.2.0 → cfn_check-0.2.1}/cfn_check/validation/validator.py +0 -0
  30. {cfn_check-0.2.0 → cfn_check-0.2.1}/cfn_check.egg-info/SOURCES.txt +0 -0
  31. {cfn_check-0.2.0 → cfn_check-0.2.1}/cfn_check.egg-info/dependency_links.txt +0 -0
  32. {cfn_check-0.2.0 → cfn_check-0.2.1}/cfn_check.egg-info/entry_points.txt +0 -0
  33. {cfn_check-0.2.0 → cfn_check-0.2.1}/cfn_check.egg-info/requires.txt +0 -0
  34. {cfn_check-0.2.0 → cfn_check-0.2.1}/cfn_check.egg-info/top_level.txt +0 -0
  35. {cfn_check-0.2.0 → cfn_check-0.2.1}/example/rules.py +0 -0
  36. {cfn_check-0.2.0 → cfn_check-0.2.1}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cfn-check
3
- Version: 0.2.0
3
+ Version: 0.2.1
4
4
  Summary: Validate Cloud Formation
5
5
  Author-email: Ada Lundhe <adalundhe@lundhe.audio>
6
6
  License: MIT License
@@ -241,7 +241,7 @@ cfn-lint validate -r rules.py template.yaml
241
241
  which outputs:
242
242
 
243
243
  ```
244
- 2025-09-17T01:46:41.542078+00:00 - INFO - 19783474 - /Users/adalundhe/Documents/Duckbill/cfn-check/cfn_check/cli/validate.py:validate.80 - ✅ 1 validations met for 1 templates
244
+ 2025-09-17T01:46:41.542078+00:00 - INFO - 19783474 - /Users/adalundhe/Documents/adalundhe/cfn-check/cfn_check/cli/validate.py:validate.80 - ✅ 1 validations met for 1 templates
245
245
  ```
246
246
 
247
247
  Congrats! You've just made the cloud a bit better place!
@@ -200,7 +200,7 @@ cfn-lint validate -r rules.py template.yaml
200
200
  which outputs:
201
201
 
202
202
  ```
203
- 2025-09-17T01:46:41.542078+00:00 - INFO - 19783474 - /Users/adalundhe/Documents/Duckbill/cfn-check/cfn_check/cli/validate.py:validate.80 - ✅ 1 validations met for 1 templates
203
+ 2025-09-17T01:46:41.542078+00:00 - INFO - 19783474 - /Users/adalundhe/Documents/adalundhe/cfn-check/cfn_check/cli/validate.py:validate.80 - ✅ 1 validations met for 1 templates
204
204
  ```
205
205
 
206
206
  Congrats! You've just made the cloud a bit better place!
@@ -1,6 +1,7 @@
1
1
 
2
2
  import asyncio
3
3
  import os
4
+ import pathlib
4
5
  import yaml
5
6
  from cfn_check.loader.loader import (
6
7
  Loader,
@@ -9,23 +10,62 @@ from cfn_check.loader.loader import (
9
10
  )
10
11
  from cfn_check.shared.types import YamlObject, Data
11
12
 
12
- def open_template(path: str) -> YamlObject | Exception:
13
+ def open_template(path: str) -> YamlObject | None:
14
+
15
+ if os.path.exists(path) is False:
16
+ return None
17
+
13
18
  try:
14
19
  with open(path, 'r') as f:
15
20
  return yaml.load(f, Loader=Loader)
16
- except (Exception, ) as e:
21
+ except Exception as e:
17
22
  raise e
18
23
 
19
24
  def is_file(path: str) -> bool:
20
25
  return os.path.isdir(path) is False
21
26
 
22
27
 
28
+ async def path_exists(path: str, loop: asyncio.AbstractEventLoop):
29
+ return await loop.run_in_executor(
30
+ None,
31
+ os.path.exists,
32
+ path,
33
+ )
34
+
35
+ async def convert_to_cwd(loop: asyncio.AbstractEventLoop):
36
+ return await loop.run_in_executor(
37
+ None,
38
+ os.getcwd,
39
+ )
40
+
41
+ async def localize_path(path: str, loop: asyncio.AbstractEventLoop):
42
+ localized = path.replace('~/', '')
43
+
44
+ home_directory = await loop.run_in_executor(
45
+ None,
46
+ pathlib.Path.home,
47
+ )
48
+
49
+ return await loop.run_in_executor(
50
+ None,
51
+ os.path.join,
52
+ home_directory,
53
+ localized,
54
+ )
55
+
23
56
  async def load_templates(
24
57
  path: str,
25
58
  tags: list[str],
26
59
  file_pattern: str | None = None,
27
60
  ):
61
+
28
62
  loop = asyncio.get_event_loop()
63
+
64
+ if path == '.':
65
+ path = await convert_to_cwd(loop)
66
+
67
+ elif path.startswith('~/'):
68
+ path = await localize_path(path, loop)
29
69
 
30
70
  if await loop.run_in_executor(
31
71
  None,
@@ -36,6 +76,8 @@ async def load_templates(
36
76
  path,
37
77
  ]
38
78
 
79
+ assert await path_exists(path) is True, f'❌ Template at {path} does not exist'
80
+
39
81
  elif file_pattern:
40
82
 
41
83
  template_filepaths = await loop.run_in_executor(
@@ -65,4 +107,10 @@ async def load_templates(
65
107
  ) for template_path in template_filepaths
66
108
  ])
67
109
 
110
+ found_templates = [
111
+ template for template in templates if template is not None
112
+ ]
113
+
114
+ assert len(found_templates) > 0, "❌ Could not open any templates"
115
+
68
116
  return templates
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cfn-check
3
- Version: 0.2.0
3
+ Version: 0.2.1
4
4
  Summary: Validate Cloud Formation
5
5
  Author-email: Ada Lundhe <adalundhe@lundhe.audio>
6
6
  License: MIT License
@@ -241,7 +241,7 @@ cfn-lint validate -r rules.py template.yaml
241
241
  which outputs:
242
242
 
243
243
  ```
244
- 2025-09-17T01:46:41.542078+00:00 - INFO - 19783474 - /Users/adalundhe/Documents/Duckbill/cfn-check/cfn_check/cli/validate.py:validate.80 - ✅ 1 validations met for 1 templates
244
+ 2025-09-17T01:46:41.542078+00:00 - INFO - 19783474 - /Users/adalundhe/Documents/adalundhe/cfn-check/cfn_check/cli/validate.py:validate.80 - ✅ 1 validations met for 1 templates
245
245
  ```
246
246
 
247
247
  Congrats! You've just made the cloud a bit better place!
@@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"
6
6
 
7
7
  [project]
8
8
  name = "cfn-check"
9
- version = "0.2.0"
9
+ version = "0.2.1"
10
10
  requires-python = ">=3.12"
11
11
  description = "Validate Cloud Formation"
12
12
  readme = "README.md"
File without changes
File without changes
File without changes