From 83478a5b8d5268bc8619fc4f8c4886ca1e7ad284 Mon Sep 17 00:00:00 2001 From: David Mathias Mortensen Date: Thu, 4 Apr 2024 13:24:03 +0200 Subject: [PATCH 1/3] Fix: Replace slashes with dots in fully qualified name --- .../processors/decorator_processor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/reqstool_python_decorators/processors/decorator_processor.py b/src/reqstool_python_decorators/processors/decorator_processor.py index 8331425..cc342c6 100644 --- a/src/reqstool_python_decorators/processors/decorator_processor.py +++ b/src/reqstool_python_decorators/processors/decorator_processor.py @@ -98,7 +98,7 @@ def get_functions_and_classes(self, file_path, decorator_names): if any(decorator_info["name"] in decorator_names for decorator_info in decorators_info): self.req_svc_results.append( { - "fullyQualifiedName": file_path, + "fullyQualifiedName": str(file_path).replace("/", "."), "elementKind": str(type(node)).split(".")[-1][:-5].upper(), "name": node.name, "decorators": decorators_info, From 3d983073a58e01d983b5e322eae87b2beb4d1bfb Mon Sep 17 00:00:00 2001 From: David Mathias Mortensen Date: Thu, 4 Apr 2024 13:34:58 +0200 Subject: [PATCH 2/3] feat: Update documentation --- README.md | 21 ++++++++++----------- docs/modules/ROOT/pages/usage.adoc | 6 +++--- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 463ec0a..e4c24b9 100644 --- a/README.md +++ b/README.md @@ -13,12 +13,12 @@ This provides decorators and collecting of decorated code, formatting it and wri ## Installation -The package name is `reqstool-decorators`. +The package name is `reqstool-python-decorators`. * Using pip install: ``` -$pip install reqstool-decorators +$pip install reqstool-python-decorators ``` ## Using @@ -29,7 +29,7 @@ $pip install reqstool-decorators ``` dependencies = [ - "reqstool-decorators == " + "reqstool-python-decorators == " ] ``` @@ -37,7 +37,7 @@ dependencies = [ ``` [tool.poetry.dependencies] -reqstool-decorators = "" +reqstool-python-decorators = "" ``` ### Decorators @@ -51,12 +51,12 @@ from reqstool-decorators.decorators.decorators import Requirements, SVCs Example usage of the decorators: ``` -@Requirements(REQ_111, REQ_222) +@Requirements("REQ_111", "REQ_222") def somefunction(): ``` ``` -@SVCs(SVC_111, SVC_222) +@SVCs("SVC_111", "SVC_222") def test_somefunction(): ``` @@ -65,20 +65,19 @@ def test_somefunction(): Import processor: ``` -from reqstool.processors.decorator_processor import ProcessDecorator +from reqstool.processors.decorator_processor import DecoratorProcessor ``` Main function to collect decorators data and generate yaml file: ``` -process_decorated_data(path_to_python_files) +process_decorated_data(path_to_python_files, output_file) ``` -Here `path_to_python_files` is the directories to search through to find decorated code. +`path_to_python_files` is the directories to search through to find decorated code. -*Note:* +(Optional) `output_file` is output file(path) the yaml file is stored to. Default is `/build/reqstool/annotations.yml`. -Yaml file is saved into the `/dist` folder, make sure the folder exists before running the `process_decorated_data` function. ## License diff --git a/docs/modules/ROOT/pages/usage.adoc b/docs/modules/ROOT/pages/usage.adoc index 266a7fb..e9175e6 100644 --- a/docs/modules/ROOT/pages/usage.adoc +++ b/docs/modules/ROOT/pages/usage.adoc @@ -28,12 +28,12 @@ from reqstool_python_decorators.decorators.decorators import Requirements, SVCs Example usage of the decorators: ```python -@Requirements(REQ_111, REQ_222) +@Requirements("REQ_111", "REQ_222") def somefunction(): ``` ```python -@SVCs(SVC_111, SVC_222) +@SVCs("SVC_111", "SVC_222") def test_somefunction(): ``` @@ -53,5 +53,5 @@ process_decorated_data(path_to_python_files, output_file) `path_to_python_files` is the directories to search through to find decorated code. -`output_file` is output file(path) the yaml file is stored to +(Optional) `output_file` is output file(path) the yaml file is stored to. Default is `/build/reqstool/annotations.yml`. From cae451e8f1e20f77a0a9f81625fb6c63a5062f19 Mon Sep 17 00:00:00 2001 From: David Mathias Mortensen Date: Thu, 4 Apr 2024 13:36:55 +0200 Subject: [PATCH 3/3] WIP --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e4c24b9..10f098d 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ The package name is `reqstool-python-decorators`. $pip install reqstool-python-decorators ``` -## Using +## Usage ### pyproject.toml