-
Notifications
You must be signed in to change notification settings - Fork 7
feat: document generation #946
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
45 commits
Select commit
Hold shift + click to select a range
35c4b47
chore: establish a basic structure for document generation
rjaegers 971710e
chore: playing around with location and granularity
rjaegers 4781fa6
chore: add gherkin extraction
rjaegers e4ec3d3
Merge branch 'main' into feature/document-generation
rjaegers cd08647
Merge branch 'main' into feature/document-generation
rjaegers f88a6f0
Merge branch 'main' into feature/document-generation
rjaegers ca61782
docs: generate requirements document
rjaegers e3cc660
fix: don't use sudo in workflows
rjaegers 176a0f0
fix: allow sudo in workflow that needs it
rjaegers ada3cac
ci: install missing package
rjaegers c8df85b
Apply suggestions from code review
rjaegers e75b5fc
Merge branch 'main' into feature/document-generation
rjaegers ac7263d
docs: generate nicer PDF
rjaegers c4f4768
Merge branch 'feature/document-generation' of https://github.com/phil…
rjaegers 9c37fe1
chore: correct workflow syntax
rjaegers becc991
chore: minor refactor to workflow
rjaegers a11b967
chore: pin pip dependencies
rjaegers 8caaba2
docs: make the pdf more appealing
rjaegers e51eaef
chore: refactor gherkin to sbdl workflow
rjaegers 34621e0
chore: refactor requirement structure
rjaegers de87a42
chore: enable listings code highlighter
rjaegers aac0e2e
Merge branch 'main' into feature/document-generation-additions
rjaegers db8cafb
docs: add eisvogel front-matter
rjaegers 2cb5a4a
Merge branch 'feature/document-generation-additions' of https://githu…
rjaegers 6e07d15
docs: update to front-matter config
rjaegers f2e6e60
docs: add more requirements
rjaegers bbc02bf
docs: add a toc
rjaegers cdf9a70
docs: extend requirements
rjaegers 9e239d1
chore: refactor gherkin to sbdl
rjaegers 1d9340b
Merge branch 'main' into feature/document-generation-additions
rjaegers 8ef18fc
Update docs/templates/software-requirements-specification.md.j2
rjaegers 71087b5
Merge branch 'main' into feature/document-generation-additions
rjaegers 5a91818
chore: refactor for testability
rjaegers 8ff7a45
chore: extend the urllib3 ignores with one month
rjaegers b0fd257
chore: update linter settings
rjaegers c9113e3
chore: add missing import
rjaegers 6b3eefb
chore: add *.pyc to gitignore
rjaegers 59d76ba
chore: add documents to release upload
rjaegers 446a5fc
docs: minor cosmetic changes
rjaegers 72534db
chore: processed review comments
rjaegers 76a665e
chore: correct/extend lychee scope
rjaegers 5fe9db4
Update docs/support/gherkin_sbdl_converter.py
rjaegers fe3f8ec
Update .mega-linter.yml
rjaegers 893436e
style: add newline between classes
rjaegers 0336d46
Merge branch 'main' into feature/document-generation-additions
rjaegers File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,5 +11,6 @@ test-results/ | |
| .env | ||
| *.profdata | ||
| *.profraw | ||
| *.pyc | ||
| **/playwright/.auth/user.json | ||
| CMakeUserPresets.json | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| #!/usr/bin/env python3 | ||
|
|
||
| import argparse | ||
| import os | ||
| import sys | ||
|
|
||
| from gherkin_mapping_config import FEATURE_RULE_CONFIG, FEATURE_RULE_SCENARIO_CONFIG | ||
| from gherkin_sbdl_converter import GherkinConverter | ||
|
|
||
| def main(): | ||
| configs = { | ||
| 'feature-rule': FEATURE_RULE_CONFIG, | ||
| 'feature-rule-scenario': FEATURE_RULE_SCENARIO_CONFIG | ||
| } | ||
|
|
||
| parser = argparse.ArgumentParser(description='Configurable Gherkin to SBDL converter') | ||
| parser.add_argument('feature_files', nargs='+', help='Paths to feature files') | ||
| parser.add_argument('--output', '-o', default='output.sbdl', help='Output SBDL file') | ||
| parser.add_argument('--config', choices=configs.keys(), | ||
| default='feature-rule', help='Conversion configuration preset') | ||
|
|
||
| args = parser.parse_args() | ||
| config = configs[args.config] | ||
| converter = GherkinConverter(config) | ||
| gherkin_elements = [] | ||
|
|
||
| for feature_path in args.feature_files: | ||
| if os.path.isfile(feature_path): | ||
| print(f"Processing {feature_path}") | ||
| elements = converter.extract_from_feature_file(feature_path) | ||
| gherkin_elements.extend(elements) | ||
| else: | ||
| print(f"File not found: {feature_path}", file=sys.stderr) | ||
|
|
||
| converter.write_sbdl_output(gherkin_elements, args.output) | ||
| print(f"Extracted {len(gherkin_elements)} elements to {args.output}") | ||
|
|
||
| if __name__ == '__main__': | ||
| main() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,106 @@ | ||
| #!/usr/bin/env python3 | ||
|
|
||
| """ | ||
| Configuration-driven Gherkin to SBDL mapping with flexible hierarchy support. | ||
| """ | ||
|
|
||
| from dataclasses import dataclass | ||
| from typing import Dict, List, Optional, Union | ||
| from enum import Enum | ||
|
|
||
| class GherkinElementType(Enum): | ||
| """Supported Gherkin element types for conversion.""" | ||
| FEATURE = "feature" | ||
| RULE = "rule" | ||
| SCENARIO = "scenario" | ||
| SCENARIO_OUTLINE = "scenario_outline" | ||
| EXAMPLE = "example" | ||
| BACKGROUND = "background" | ||
|
|
||
| class SBDLElementType(Enum): | ||
| """Supported SBDL element types for mapping.""" | ||
| REQUIREMENT = "requirement" | ||
| ASPECT = "aspect" | ||
| USECASE = "usecase" | ||
| DEFINITION = "definition" | ||
| TEST = "test" | ||
|
|
||
| @dataclass | ||
| class HierarchyMapping: | ||
| """Configuration for mapping Gherkin elements to SBDL with document hierarchy.""" | ||
| gherkin_type: GherkinElementType | ||
| sbdl_type: SBDLElementType | ||
|
|
||
| @dataclass | ||
| class ConversionConfig: | ||
| """Complete configuration for Gherkin to SBDL conversion.""" | ||
| hierarchy_mappings: List[HierarchyMapping] | ||
|
|
||
| def get_mapping_for_type(self, gherkin_type: GherkinElementType) -> Optional[HierarchyMapping]: | ||
| """Get the hierarchy mapping for a specific Gherkin element type.""" | ||
| for mapping in self.hierarchy_mappings: | ||
| if mapping.gherkin_type == gherkin_type: | ||
| return mapping | ||
| return None | ||
|
|
||
| # Predefined configurations for different use cases | ||
|
|
||
| # Current Configuration (Feature -> Rule mapping) | ||
| FEATURE_RULE_CONFIG = ConversionConfig( | ||
| hierarchy_mappings=[ | ||
| HierarchyMapping( | ||
| gherkin_type=GherkinElementType.FEATURE, | ||
| sbdl_type=SBDLElementType.REQUIREMENT | ||
| ), | ||
| HierarchyMapping( | ||
| gherkin_type=GherkinElementType.RULE, | ||
| sbdl_type=SBDLElementType.REQUIREMENT | ||
| ) | ||
| ] | ||
| ) | ||
|
|
||
| # Extended Configuration (Feature -> Rule -> Scenario mapping) | ||
| FEATURE_RULE_SCENARIO_CONFIG = ConversionConfig( | ||
| hierarchy_mappings=[ | ||
| HierarchyMapping( | ||
| gherkin_type=GherkinElementType.FEATURE, | ||
| sbdl_type=SBDLElementType.ASPECT | ||
| ), | ||
| HierarchyMapping( | ||
| gherkin_type=GherkinElementType.RULE, | ||
| sbdl_type=SBDLElementType.REQUIREMENT | ||
| ), | ||
| HierarchyMapping( | ||
| gherkin_type=GherkinElementType.SCENARIO, | ||
| sbdl_type=SBDLElementType.TEST | ||
| ) | ||
| ] | ||
| ) | ||
|
|
||
| # Flat Configuration (All as requirements at same level) | ||
| FLAT_CONFIG = ConversionConfig( | ||
| hierarchy_mappings=[ | ||
| HierarchyMapping( | ||
| gherkin_type=GherkinElementType.FEATURE, | ||
| sbdl_type=SBDLElementType.REQUIREMENT | ||
| ), | ||
| HierarchyMapping( | ||
| gherkin_type=GherkinElementType.RULE, | ||
| sbdl_type=SBDLElementType.REQUIREMENT | ||
| ) | ||
| ] | ||
| ) | ||
|
|
||
| # Use Case Focused Configuration | ||
| USECASE_CONFIG = ConversionConfig( | ||
| hierarchy_mappings=[ | ||
| HierarchyMapping( | ||
| gherkin_type=GherkinElementType.FEATURE, | ||
| sbdl_type=SBDLElementType.USECASE | ||
| ), | ||
| HierarchyMapping( | ||
| gherkin_type=GherkinElementType.SCENARIO, | ||
| sbdl_type=SBDLElementType.USECASE | ||
| ) | ||
| ] | ||
| ) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.