Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion _version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.2.14"
__version__ = "0.2.18"
2 changes: 1 addition & 1 deletion plain_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,7 @@ def plain_file_parser( # noqa: C901
)

if not check_if_functional_requirements_are_specified(plain_file_parse_result.plain_source, []):
raise PlainSyntaxError("Syntax error: No functionality specified.")
raise PlainSyntaxError(f"Module '{module_name}' was required but does not contain functional requirements.")

exported_definitions = process_required_modules(
plain_file_parse_result.required_modules,
Expand Down
13 changes: 3 additions & 10 deletions render_machine/render_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,6 @@ def start_implementing_frid(self):
else:
frid = plain_spec.get_next_frid(self.plain_source_tree, self.frid_context.frid)

if frid is None:
# If frid context is empty, it means that all frids have been implemented
self.frid_context = None
self.machine.dispatch(triggers.PREPARE_FINAL_OUTPUT)
return

specifications, _ = plain_spec.get_specifications_for_frid(self.plain_source_tree, frid)
functional_requirement_text = specifications[plain_spec.FUNCTIONAL_REQUIREMENTS][-1]

Expand All @@ -172,10 +166,6 @@ def start_implementing_frid(self):
return

def check_frid_iteration_limit(self):
# If frid context is not set, it means that all frids have been implemented
if self.frid_context is None:
return

if self.frid_context.functional_requirement_render_attempts >= MAX_CODE_GENERATION_RETRIES:
error_msg = f"Unittests could not be fixed after rendering the functionality {self.frid_context.frid} for the {MAX_CODE_GENERATION_RETRIES} times."
self.dispatch_error(error_msg)
Expand All @@ -189,6 +179,9 @@ def check_frid_iteration_limit(self):
f"Restarting rendering the functionality {self.frid_context.frid} from scratch."
)

def has_next_frid(self) -> bool:
return plain_spec.get_next_frid(self.plain_source_tree, self.frid_context.frid) is not None

def finish_implementing_frid(self):
self.functional_requirements_render_attempts_failed_unit_during_conformance_tests = 0
self.run_state.increment_rendered_functionalities()
Expand Down
12 changes: 7 additions & 5 deletions render_machine/state_machine_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,11 +261,6 @@ def get_transitions(self) -> List[Dict[str, Any]]:
"dest": f"{States.IMPLEMENTING_FRID.value}_{States.STEP_COMPLETED.value}",
"unless": "should_run_unit_tests",
},
{
"source": f"{States.IMPLEMENTING_FRID.value}",
"trigger": triggers.PREPARE_FINAL_OUTPUT,
"dest": States.RENDER_COMPLETED.value,
},
{
"source": "*",
"trigger": triggers.HANDLE_ERROR,
Expand Down Expand Up @@ -349,6 +344,13 @@ def get_transitions(self) -> List[Dict[str, Any]]:
"source": f"{States.IMPLEMENTING_FRID.value}_{States.FRID_FULLY_IMPLEMENTED.value}",
"trigger": triggers.PROCEED_FRID_PROCESSING,
"dest": f"{States.IMPLEMENTING_FRID.value}",
"conditions": "has_next_frid",
},
{
"source": f"{States.IMPLEMENTING_FRID.value}_{States.FRID_FULLY_IMPLEMENTED.value}",
"trigger": triggers.PROCEED_FRID_PROCESSING,
"dest": States.RENDER_COMPLETED.value,
"unless": "has_next_frid",
},
{
"source": f"{States.IMPLEMENTING_FRID.value}_{States.REFACTORING_CODE.value}_{States.PROCESSING_UNIT_TESTS.value}_{States.UNIT_TESTS_READY.value}",
Expand Down
1 change: 0 additions & 1 deletion render_machine/triggers.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
MARK_UNIT_TESTS_FAILED = "mark_unit_tests_failed"
MARK_UNIT_TESTS_PASSED = "mark_unit_tests_passed"
MARK_UNIT_TESTS_READY = "mark_unit_tests_ready"
PREPARE_FINAL_OUTPUT = "prepare_final_output"
FINISH_RENDER = "finish_render"
HANDLE_ERROR = "handle_error"
REFACTOR_CODE = "refactor_code"
Expand Down
Loading