ara-cli 0.1.10.5__py3-none-any.whl → 0.1.14.0__py3-none-any.whl

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.
Files changed (151) hide show
  1. ara_cli/__init__.py +51 -6
  2. ara_cli/__main__.py +87 -75
  3. ara_cli/ara_command_action.py +189 -101
  4. ara_cli/ara_config.py +187 -128
  5. ara_cli/ara_subcommands/common.py +2 -2
  6. ara_cli/ara_subcommands/config.py +221 -0
  7. ara_cli/ara_subcommands/convert.py +107 -0
  8. ara_cli/ara_subcommands/fetch.py +41 -0
  9. ara_cli/ara_subcommands/fetch_agents.py +22 -0
  10. ara_cli/ara_subcommands/fetch_scripts.py +19 -0
  11. ara_cli/ara_subcommands/fetch_templates.py +15 -10
  12. ara_cli/ara_subcommands/list.py +97 -23
  13. ara_cli/ara_subcommands/prompt.py +266 -106
  14. ara_cli/artefact_autofix.py +117 -64
  15. ara_cli/artefact_converter.py +355 -0
  16. ara_cli/artefact_creator.py +41 -17
  17. ara_cli/artefact_lister.py +3 -3
  18. ara_cli/artefact_models/artefact_model.py +1 -1
  19. ara_cli/artefact_models/artefact_templates.py +0 -9
  20. ara_cli/artefact_models/feature_artefact_model.py +8 -8
  21. ara_cli/artefact_reader.py +62 -43
  22. ara_cli/artefact_scan.py +39 -17
  23. ara_cli/chat.py +300 -71
  24. ara_cli/chat_agent/__init__.py +0 -0
  25. ara_cli/chat_agent/agent_process_manager.py +155 -0
  26. ara_cli/chat_script_runner/__init__.py +0 -0
  27. ara_cli/chat_script_runner/script_completer.py +23 -0
  28. ara_cli/chat_script_runner/script_finder.py +41 -0
  29. ara_cli/chat_script_runner/script_lister.py +36 -0
  30. ara_cli/chat_script_runner/script_runner.py +36 -0
  31. ara_cli/chat_web_search/__init__.py +0 -0
  32. ara_cli/chat_web_search/web_search.py +263 -0
  33. ara_cli/children_contribution_updater.py +737 -0
  34. ara_cli/classifier.py +34 -0
  35. ara_cli/commands/agent_run_command.py +98 -0
  36. ara_cli/commands/fetch_agents_command.py +106 -0
  37. ara_cli/commands/fetch_scripts_command.py +43 -0
  38. ara_cli/commands/fetch_templates_command.py +39 -0
  39. ara_cli/commands/fetch_templates_commands.py +39 -0
  40. ara_cli/commands/list_agents_command.py +39 -0
  41. ara_cli/commands/load_command.py +4 -3
  42. ara_cli/commands/load_image_command.py +1 -1
  43. ara_cli/commands/read_command.py +23 -27
  44. ara_cli/completers.py +95 -35
  45. ara_cli/constants.py +2 -0
  46. ara_cli/directory_navigator.py +37 -4
  47. ara_cli/error_handler.py +26 -11
  48. ara_cli/file_loaders/document_reader.py +0 -178
  49. ara_cli/file_loaders/factories/__init__.py +0 -0
  50. ara_cli/file_loaders/factories/document_reader_factory.py +32 -0
  51. ara_cli/file_loaders/factories/file_loader_factory.py +27 -0
  52. ara_cli/file_loaders/file_loader.py +1 -30
  53. ara_cli/file_loaders/loaders/__init__.py +0 -0
  54. ara_cli/file_loaders/{document_file_loader.py → loaders/document_file_loader.py} +1 -1
  55. ara_cli/file_loaders/loaders/text_file_loader.py +47 -0
  56. ara_cli/file_loaders/readers/__init__.py +0 -0
  57. ara_cli/file_loaders/readers/docx_reader.py +49 -0
  58. ara_cli/file_loaders/readers/excel_reader.py +27 -0
  59. ara_cli/file_loaders/{markdown_reader.py → readers/markdown_reader.py} +1 -1
  60. ara_cli/file_loaders/readers/odt_reader.py +59 -0
  61. ara_cli/file_loaders/readers/pdf_reader.py +54 -0
  62. ara_cli/file_loaders/readers/pptx_reader.py +104 -0
  63. ara_cli/file_loaders/tools/__init__.py +0 -0
  64. ara_cli/llm_utils.py +58 -0
  65. ara_cli/output_suppressor.py +53 -0
  66. ara_cli/prompt_chat.py +20 -4
  67. ara_cli/prompt_extractor.py +47 -32
  68. ara_cli/prompt_handler.py +123 -17
  69. ara_cli/tag_extractor.py +8 -7
  70. ara_cli/template_loader.py +2 -1
  71. ara_cli/template_manager.py +52 -21
  72. ara_cli/templates/global-scripts/hello_global.py +1 -0
  73. ara_cli/templates/prompt-modules/commands/add_scenarios_for_new_behaviour.feature_creation_agent.commands.md +1 -0
  74. ara_cli/templates/prompt-modules/commands/align_feature_with_implementation_changes.interview_agent.commands.md +1 -0
  75. ara_cli/templates/prompt-modules/commands/analyze_codebase_and_plan_tasks.interview_agent.commands.md +1 -0
  76. ara_cli/templates/prompt-modules/commands/choose_best_parent_artefact.interview_agent.commands.md +1 -0
  77. ara_cli/templates/prompt-modules/commands/create_tasks_from_artefact_content.interview_agent.commands.md +1 -0
  78. ara_cli/templates/prompt-modules/commands/create_tests_for_uncovered_modules.test_generation_agent.commands.md +1 -0
  79. ara_cli/templates/prompt-modules/commands/derive_features_from_video_description.feature_creation_agent.commands.md +1 -0
  80. ara_cli/templates/prompt-modules/commands/describe_agent_capabilities.agent.commands.md +1 -0
  81. ara_cli/templates/prompt-modules/commands/empty.commands.md +2 -12
  82. ara_cli/templates/prompt-modules/commands/execute_scoped_todos_in_task.interview_agent.commands.md +1 -0
  83. ara_cli/templates/prompt-modules/commands/explain_single_file_purpose.interview_agent.commands.md +1 -0
  84. ara_cli/templates/prompt-modules/commands/extract_file_information_bullets.interview_agent.commands.md +1 -0
  85. ara_cli/templates/prompt-modules/commands/extract_general.commands.md +12 -0
  86. ara_cli/templates/prompt-modules/commands/extract_markdown.commands.md +11 -0
  87. ara_cli/templates/prompt-modules/commands/extract_python.commands.md +13 -0
  88. ara_cli/templates/prompt-modules/commands/feature_add_or_modifiy_specified_behavior.commands.md +36 -0
  89. ara_cli/templates/prompt-modules/commands/feature_generate_initial_specified_bevahior.commands.md +53 -0
  90. ara_cli/templates/prompt-modules/commands/fix_failing_behave_step_definitions.interview_agent.commands.md +1 -0
  91. ara_cli/templates/prompt-modules/commands/fix_failing_pytest_tests.interview_agent.commands.md +1 -0
  92. ara_cli/templates/prompt-modules/commands/general_instruction_policy.commands.md +47 -0
  93. ara_cli/templates/prompt-modules/commands/generate_and_fix_pytest_tests.test_generation_agent.commands.md +1 -0
  94. ara_cli/templates/prompt-modules/commands/prompt_template_tech_stack_transformer.commands.md +95 -0
  95. ara_cli/templates/prompt-modules/commands/python_bug_fixing_code.commands.md +34 -0
  96. ara_cli/templates/prompt-modules/commands/python_generate_code.commands.md +27 -0
  97. ara_cli/templates/prompt-modules/commands/python_refactoring_code.commands.md +39 -0
  98. ara_cli/templates/prompt-modules/commands/python_step_definitions_generation_and_fixing.commands.md +40 -0
  99. ara_cli/templates/prompt-modules/commands/python_unittest_generation_and_fixing.commands.md +48 -0
  100. ara_cli/templates/prompt-modules/commands/suggest_next_story_child_tasks.interview_agent.commands.md +1 -0
  101. ara_cli/templates/prompt-modules/commands/summarize_or_transcribe_media.interview_agent.commands.md +1 -0
  102. ara_cli/templates/prompt-modules/commands/update_feature_to_match_implementation.feature_creation_agent.commands.md +1 -0
  103. ara_cli/templates/prompt-modules/commands/update_user_story_with_requirements.interview_agent.commands.md +1 -0
  104. ara_cli/version.py +1 -1
  105. {ara_cli-0.1.10.5.dist-info → ara_cli-0.1.14.0.dist-info}/METADATA +49 -11
  106. ara_cli-0.1.14.0.dist-info/RECORD +253 -0
  107. {ara_cli-0.1.10.5.dist-info → ara_cli-0.1.14.0.dist-info}/WHEEL +1 -1
  108. tests/test_ara_command_action.py +31 -19
  109. tests/test_ara_config.py +177 -90
  110. tests/test_artefact_autofix.py +170 -97
  111. tests/test_artefact_autofix_integration.py +495 -0
  112. tests/test_artefact_converter.py +312 -0
  113. tests/test_artefact_extraction.py +564 -0
  114. tests/test_artefact_lister.py +11 -8
  115. tests/test_chat.py +166 -130
  116. tests/test_chat_givens_images.py +603 -0
  117. tests/test_chat_script_runner.py +454 -0
  118. tests/test_children_contribution_updater.py +98 -0
  119. tests/test_document_loader_office.py +267 -0
  120. tests/test_llm_utils.py +164 -0
  121. tests/test_prompt_chat.py +343 -0
  122. tests/test_prompt_extractor.py +683 -0
  123. tests/test_prompt_handler.py +416 -214
  124. tests/test_setup_default_chat_prompt_mode.py +198 -0
  125. tests/test_tag_extractor.py +95 -49
  126. tests/test_web_search.py +467 -0
  127. ara_cli/file_loaders/document_readers.py +0 -233
  128. ara_cli/file_loaders/file_loaders.py +0 -123
  129. ara_cli/file_loaders/text_file_loader.py +0 -187
  130. ara_cli/templates/prompt-modules/blueprints/complete_pytest_unittest.blueprint.md +0 -27
  131. ara_cli/templates/prompt-modules/blueprints/pytest_unittest_prompt.blueprint.md +0 -32
  132. ara_cli/templates/prompt-modules/blueprints/task_todo_list_implement_feature_BDD_way.blueprint.md +0 -30
  133. ara_cli/templates/prompt-modules/commands/artefact_classification.commands.md +0 -9
  134. ara_cli/templates/prompt-modules/commands/artefact_extension.commands.md +0 -17
  135. ara_cli/templates/prompt-modules/commands/artefact_formulation.commands.md +0 -14
  136. ara_cli/templates/prompt-modules/commands/behave_step_generation.commands.md +0 -102
  137. ara_cli/templates/prompt-modules/commands/code_generation_complex.commands.md +0 -20
  138. ara_cli/templates/prompt-modules/commands/code_generation_simple.commands.md +0 -13
  139. ara_cli/templates/prompt-modules/commands/error_fixing.commands.md +0 -20
  140. ara_cli/templates/prompt-modules/commands/feature_file_update.commands.md +0 -18
  141. ara_cli/templates/prompt-modules/commands/feature_formulation.commands.md +0 -43
  142. ara_cli/templates/prompt-modules/commands/js_code_generation_simple.commands.md +0 -13
  143. ara_cli/templates/prompt-modules/commands/refactoring.commands.md +0 -15
  144. ara_cli/templates/prompt-modules/commands/refactoring_analysis.commands.md +0 -9
  145. ara_cli/templates/prompt-modules/commands/reverse_engineer_feature_file.commands.md +0 -15
  146. ara_cli/templates/prompt-modules/commands/reverse_engineer_program_flow.commands.md +0 -19
  147. ara_cli-0.1.10.5.dist-info/RECORD +0 -194
  148. /ara_cli/file_loaders/{binary_file_loader.py → loaders/binary_file_loader.py} +0 -0
  149. /ara_cli/file_loaders/{image_processor.py → tools/image_processor.py} +0 -0
  150. {ara_cli-0.1.10.5.dist-info → ara_cli-0.1.14.0.dist-info}/entry_points.txt +0 -0
  151. {ara_cli-0.1.10.5.dist-info → ara_cli-0.1.14.0.dist-info}/top_level.txt +0 -0
@@ -3,20 +3,29 @@ from ara_cli.classifier import Classifier
3
3
  from ara_cli.file_classifier import FileClassifier
4
4
  from ara_cli.artefact_models.artefact_model import Artefact
5
5
  from ara_cli.artefact_models.artefact_load import artefact_from_content
6
- from ara_cli.artefact_fuzzy_search import suggest_close_name_matches_for_parent, suggest_close_name_matches
6
+ from ara_cli.artefact_fuzzy_search import (
7
+ suggest_close_name_matches_for_parent,
8
+ suggest_close_name_matches,
9
+ )
7
10
  from typing import Dict, List
8
11
  import os
9
12
  import re
10
13
 
11
14
 
12
15
  class ArtefactReader:
13
- @staticmethod
14
- def read_artefact_data(artefact_name, classifier, classified_file_info = None) -> tuple[str, dict[str, str]]:
16
+ def __init__(self, file_system=None):
17
+ self.file_system = file_system or os
18
+
19
+ def read_artefact_data(
20
+ self, artefact_name, classifier, classified_file_info=None
21
+ ) -> tuple[str, dict[str, str]]:
15
22
  if not Classifier.is_valid_classifier(classifier):
16
- raise ValueError("Invalid classifier provided. Please provide a valid classifier.")
23
+ raise ValueError(
24
+ "Invalid classifier provided. Please provide a valid classifier."
25
+ )
17
26
 
18
27
  if not classified_file_info:
19
- file_classifier = FileClassifier(os)
28
+ file_classifier = FileClassifier(self.file_system)
20
29
  classified_file_info = file_classifier.classify_files()
21
30
  artefact_info_of_classifier = classified_file_info.get(classifier, [])
22
31
 
@@ -24,21 +33,21 @@ class ArtefactReader:
24
33
  file_path = artefact_info["file_path"]
25
34
  artefact_title = artefact_info["title"]
26
35
  if artefact_title == artefact_name:
27
- with open(file_path, 'r', encoding='utf-8') as file:
36
+ with open(file_path, "r", encoding="utf-8") as file:
28
37
  content = file.read()
29
38
  return content, artefact_info
30
39
 
31
40
  all_artefact_names = [info["title"] for info in artefact_info_of_classifier]
32
- suggest_close_name_matches(
33
- artefact_name,
34
- all_artefact_names
35
- )
41
+ suggest_close_name_matches(artefact_name, all_artefact_names)
36
42
 
37
43
  return None, None
38
44
 
39
- @staticmethod
40
- def read_artefact(artefact_name, classifier, classified_file_info=None) -> Artefact:
41
- content, artefact_info = ArtefactReader.read_artefact_data(artefact_name, classifier, classified_file_info)
45
+ def read_artefact(
46
+ self, artefact_name, classifier, classified_file_info=None
47
+ ) -> Artefact:
48
+ content, artefact_info = self.read_artefact_data(
49
+ artefact_name, classifier, classified_file_info
50
+ )
42
51
  if not content or not artefact_info:
43
52
  return None
44
53
  file_path = artefact_info["file_path"]
@@ -49,9 +58,11 @@ class ArtefactReader:
49
58
  @staticmethod
50
59
  def extract_parent_tree(artefact_content):
51
60
  artefact_titles = Classifier.artefact_titles()
52
- title_segment = '|'.join(artefact_titles)
61
+ title_segment = "|".join(artefact_titles)
53
62
 
54
- regex_pattern = rf'(?:Contributes to|Illustrates)\s*:*\s*(.*)\s+({title_segment}).*'
63
+ regex_pattern = (
64
+ rf"(?:Contributes to|Illustrates)\s*:*\s*(.*)\s+({title_segment}).*"
65
+ )
55
66
  regex = re.compile(regex_pattern)
56
67
  match = re.search(regex, artefact_content)
57
68
  if not match:
@@ -72,33 +83,40 @@ class ArtefactReader:
72
83
  merged[key].extend(artefacts)
73
84
  return dict(merged)
74
85
 
75
- @staticmethod
76
- def read_artefacts(classified_artefacts=None, file_system=os, tags=None) -> Dict[str, List[Artefact]]:
86
+ def read_artefacts(
87
+ self, classified_artefacts=None, tags=None
88
+ ) -> Dict[str, List[Artefact]]:
77
89
 
78
90
  if classified_artefacts is None:
79
- file_classifier = FileClassifier(file_system)
91
+ file_classifier = FileClassifier(self.file_system)
80
92
  classified_artefacts = file_classifier.classify_files()
81
93
 
82
- artefacts = {artefact_type: []
83
- for artefact_type in classified_artefacts.keys()}
94
+ artefacts = {artefact_type: [] for artefact_type in classified_artefacts.keys()}
84
95
  for artefact_type, artefact_info_dicts in classified_artefacts.items():
85
96
  for artefact_info in artefact_info_dicts:
86
97
  title = artefact_info["title"]
87
98
  try:
88
- artefact = ArtefactReader.read_artefact(title, artefact_type, classified_artefacts)
99
+ artefact = self.read_artefact(
100
+ title, artefact_type, classified_artefacts
101
+ )
89
102
  artefacts[artefact_type].append(artefact)
90
103
  except Exception as e:
91
104
  error_handler.report_error(e, f"reading {artefact_type} '{title}'")
92
105
  continue
93
106
  return artefacts
94
107
 
95
- @staticmethod
96
- def find_children(artefact_name, classifier, artefacts_by_classifier=None, classified_artefacts=None):
108
+ def find_children(
109
+ self,
110
+ artefact_name,
111
+ classifier,
112
+ artefacts_by_classifier=None,
113
+ classified_artefacts=None,
114
+ ):
97
115
  artefacts_by_classifier = artefacts_by_classifier or {}
98
116
  filtered_artefacts = {k: [] for k in artefacts_by_classifier.keys()}
99
117
 
100
118
  if classified_artefacts is None:
101
- classified_artefacts = ArtefactReader.read_artefacts()
119
+ classified_artefacts = self.read_artefacts()
102
120
 
103
121
  for artefact_classifier, artefacts in classified_artefacts.items():
104
122
  for artefact in artefacts:
@@ -112,38 +130,37 @@ class ArtefactReader:
112
130
  def _process_artefact(artefact, artefact_name, classifier, filtered_artefacts):
113
131
  if not isinstance(artefact, Artefact):
114
132
  return
115
- contribution = getattr(artefact, 'contribution', None)
133
+ contribution = getattr(artefact, "contribution", None)
116
134
  if not contribution:
117
135
  return
118
- if getattr(contribution, 'artefact_name', None) != artefact_name:
136
+ if getattr(contribution, "artefact_name", None) != artefact_name:
119
137
  return
120
- if getattr(contribution, 'classifier', None) != classifier:
138
+ if getattr(contribution, "classifier", None) != classifier:
121
139
  return
122
140
 
123
- file_classifier = getattr(artefact, '_file_path', '').split('.')[-1]
141
+ file_classifier = getattr(artefact, "_file_path", "").split(".")[-1]
124
142
  if file_classifier not in filtered_artefacts:
125
143
  filtered_artefacts[file_classifier] = []
126
144
  filtered_artefacts[file_classifier].append(artefact)
127
145
 
128
- @staticmethod
129
146
  def step_through_value_chain(
130
- artefact_name,
131
- classifier,
132
- artefacts_by_classifier=None,
133
- classified_artefacts: dict[str, list['Artefact']] | None = None
147
+ self,
148
+ artefact_name,
149
+ classifier,
150
+ artefacts_by_classifier=None,
151
+ classified_artefacts: dict[str, list["Artefact"]] | None = None,
134
152
  ):
135
153
  from ara_cli.artefact_models.artefact_load import artefact_from_content
136
154
 
137
155
  artefacts_by_classifier = artefacts_by_classifier or {}
138
156
 
139
157
  if classified_artefacts is None:
140
- classified_artefacts = ArtefactReader.read_artefacts()
158
+ classified_artefacts = self.read_artefacts()
141
159
 
142
160
  ArtefactReader._ensure_classifier_key(classifier, artefacts_by_classifier)
143
161
 
144
162
  artefact = ArtefactReader._find_artefact_by_name(
145
- artefact_name,
146
- classified_artefacts.get(classifier, [])
163
+ artefact_name, classified_artefacts.get(classifier, [])
147
164
  )
148
165
 
149
166
  if not artefact or artefact in artefacts_by_classifier[classifier]:
@@ -151,7 +168,7 @@ class ArtefactReader:
151
168
 
152
169
  artefacts_by_classifier[classifier].append(artefact)
153
170
 
154
- parent = getattr(artefact, 'contribution', None)
171
+ parent = getattr(artefact, "contribution", None)
155
172
  if not ArtefactReader._has_valid_parent(parent):
156
173
  return
157
174
 
@@ -168,11 +185,11 @@ class ArtefactReader:
168
185
  print()
169
186
  return
170
187
 
171
- ArtefactReader.step_through_value_chain(
188
+ self.step_through_value_chain(
172
189
  artefact_name=parent_name,
173
190
  classifier=parent_classifier,
174
191
  artefacts_by_classifier=artefacts_by_classifier,
175
- classified_artefacts=classified_artefacts
192
+ classified_artefacts=classified_artefacts,
176
193
  )
177
194
 
178
195
  @staticmethod
@@ -186,13 +203,15 @@ class ArtefactReader:
186
203
 
187
204
  @staticmethod
188
205
  def _has_valid_parent(parent):
189
- return parent and getattr(parent, 'artefact_name', None) and getattr(parent, 'classifier', None)
206
+ return (
207
+ parent
208
+ and getattr(parent, "artefact_name", None)
209
+ and getattr(parent, "classifier", None)
210
+ )
190
211
 
191
212
  @staticmethod
192
213
  def _suggest_parent_name_match(artefact_name, all_artefact_names, parent_name):
193
214
  if parent_name is not None:
194
215
  suggest_close_name_matches_for_parent(
195
- artefact_name,
196
- all_artefact_names,
197
- parent_name
216
+ artefact_name, all_artefact_names, parent_name
198
217
  )
ara_cli/artefact_scan.py CHANGED
@@ -4,12 +4,16 @@ import os
4
4
 
5
5
  def is_contribution_valid(contribution, classified_artefact_info) -> bool:
6
6
  from ara_cli.artefact_fuzzy_search import extract_artefact_names_of_classifier
7
- if not contribution or not contribution.artefact_name or not contribution.classifier:
7
+
8
+ if (
9
+ not contribution
10
+ or not contribution.artefact_name
11
+ or not contribution.classifier
12
+ ):
8
13
  return True
9
14
 
10
15
  all_artefact_names = extract_artefact_names_of_classifier(
11
- classified_files=classified_artefact_info,
12
- classifier=contribution.classifier
16
+ classified_files=classified_artefact_info, classifier=contribution.classifier
13
17
  )
14
18
  if contribution.artefact_name not in all_artefact_names:
15
19
  return False
@@ -19,12 +23,18 @@ def is_contribution_valid(contribution, classified_artefact_info) -> bool:
19
23
  def is_rule_valid(contribution, classified_artefact_info) -> bool:
20
24
  from ara_cli.artefact_reader import ArtefactReader
21
25
 
22
- if not contribution or not contribution.artefact_name or not contribution.classifier:
26
+ if (
27
+ not contribution
28
+ or not contribution.artefact_name
29
+ or not contribution.classifier
30
+ ):
23
31
  return True
24
32
  rule = contribution.rule
25
33
  if not rule:
26
34
  return True
27
- parent = ArtefactReader.read_artefact(contribution.artefact_name, contribution.classifier)
35
+ parent = ArtefactReader().read_artefact(
36
+ contribution.artefact_name, contribution.classifier
37
+ )
28
38
  if not parent:
29
39
  return True
30
40
  rules = parent.rules
@@ -33,20 +43,26 @@ def is_rule_valid(contribution, classified_artefact_info) -> bool:
33
43
  return True
34
44
 
35
45
 
36
- def check_contribution(contribution, classified_artefact_info, file_path) -> tuple[bool, str]:
46
+ def check_contribution(
47
+ contribution, classified_artefact_info, file_path
48
+ ) -> tuple[bool, str]:
37
49
  if not contribution:
38
50
  return True, None
39
51
 
40
52
  if not is_contribution_valid(contribution, classified_artefact_info):
41
- reason = (f"Invalid Contribution Reference: The contribution references "
42
- f"'{contribution.classifier}' artefact '{contribution.artefact_name}' "
43
- f"which does not exist.")
53
+ reason = (
54
+ f"Invalid Contribution Reference: The contribution references "
55
+ f"'{contribution.classifier}' artefact '{contribution.artefact_name}' "
56
+ f"which does not exist."
57
+ )
44
58
  return False, reason
45
59
 
46
60
  if not is_rule_valid(contribution, classified_artefact_info):
47
- reason = (f"Rule Mismatch: The contribution references "
48
- f"rule '{contribution.rule}' which the parent "
49
- f"{contribution.classifier} '{contribution.artefact_name}' does not have.")
61
+ reason = (
62
+ f"Rule Mismatch: The contribution references "
63
+ f"rule '{contribution.rule}' which the parent "
64
+ f"{contribution.classifier} '{contribution.artefact_name}' does not have."
65
+ )
50
66
  return False, reason
51
67
  return True, None
52
68
 
@@ -73,13 +89,17 @@ def check_file(file_path, artefact_class, classified_artefact_info=None):
73
89
 
74
90
  # Check title and file name matching
75
91
  if artefact_instance.title != file_name_without_ext:
76
- reason = (f"Filename-Title Mismatch: The file name '{file_name_without_ext}' "
77
- f"does not match the artefact title '{artefact_instance.title}'.")
92
+ reason = (
93
+ f"Filename-Title Mismatch: The file name '{file_name_without_ext}' "
94
+ f"does not match the artefact title '{artefact_instance.title}'."
95
+ )
78
96
  return False, reason
79
97
 
80
98
  contribution = artefact_instance.contribution
81
99
 
82
- contribution_valid, reason = check_contribution(contribution, classified_artefact_info, file_path)
100
+ contribution_valid, reason = check_contribution(
101
+ contribution, classified_artefact_info, file_path
102
+ )
83
103
  if not contribution_valid:
84
104
  return False, reason
85
105
 
@@ -100,7 +120,9 @@ def find_invalid_files(classified_artefact_info, classifier):
100
120
  continue
101
121
  if ".data" in artefact_info["file_path"]:
102
122
  continue
103
- is_valid, reason = check_file(artefact_info["file_path"], artefact_class, classified_artefact_info)
123
+ is_valid, reason = check_file(
124
+ artefact_info["file_path"], artefact_class, classified_artefact_info
125
+ )
104
126
  if not is_valid:
105
127
  invalid_files.append((artefact_info["file_path"], reason))
106
128
  return invalid_files
@@ -122,4 +144,4 @@ def show_results(invalid_artefacts):
122
144
  report.write("\n")
123
145
  if not has_issues:
124
146
  print("All files are good!")
125
- report.write("No problems found.\n")
147
+ report.write("No problems found.\n")