Skip to content

Commit acf48ad

Browse files
authored
Fix: Replace slashes with dots in fully qualified name (#18)
* Fix: Replace slashes with dots in fully qualified name * feat: Update documentation * WIP
1 parent 889632a commit acf48ad

3 files changed

Lines changed: 15 additions & 16 deletions

File tree

‎README.md‎

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,31 +13,31 @@ This provides decorators and collecting of decorated code, formatting it and wri
1313

1414
## Installation
1515

16-
The package name is `reqstool-decorators`.
16+
The package name is `reqstool-python-decorators`.
1717

1818
* Using pip install:
1919

2020
```
21-
$pip install reqstool-decorators
21+
$pip install reqstool-python-decorators
2222
```
2323

24-
## Using
24+
## Usage
2525

2626
### pyproject.toml
2727

2828
* Hatch
2929

3030
```
3131
dependencies = [
32-
"reqstool-decorators == <version>"
32+
"reqstool-python-decorators == <version>"
3333
]
3434
```
3535

3636
* Poetry
3737

3838
```
3939
[tool.poetry.dependencies]
40-
reqstool-decorators = "<version>"
40+
reqstool-python-decorators = "<version>"
4141
```
4242

4343
### Decorators
@@ -51,12 +51,12 @@ from reqstool-decorators.decorators.decorators import Requirements, SVCs
5151
Example usage of the decorators:
5252

5353
```
54-
@Requirements(REQ_111, REQ_222)
54+
@Requirements("REQ_111", "REQ_222")
5555
def somefunction():
5656
```
5757

5858
```
59-
@SVCs(SVC_111, SVC_222)
59+
@SVCs("SVC_111", "SVC_222")
6060
def test_somefunction():
6161
```
6262

@@ -65,20 +65,19 @@ def test_somefunction():
6565
Import processor:
6666

6767
```
68-
from reqstool.processors.decorator_processor import ProcessDecorator
68+
from reqstool.processors.decorator_processor import DecoratorProcessor
6969
```
7070

7171
Main function to collect decorators data and generate yaml file:
7272

7373
```
74-
process_decorated_data(path_to_python_files)
74+
process_decorated_data(path_to_python_files, output_file)
7575
```
7676

77-
Here `path_to_python_files` is the directories to search through to find decorated code.
77+
`path_to_python_files` is the directories to search through to find decorated code.
7878

79-
*Note:*
79+
(Optional) `output_file` is output file(path) the yaml file is stored to. Default is `/build/reqstool/annotations.yml`.
8080

81-
Yaml file is saved into the `/dist` folder, make sure the folder exists before running the `process_decorated_data` function.
8281

8382
## License
8483

‎docs/modules/ROOT/pages/usage.adoc‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ from reqstool_python_decorators.decorators.decorators import Requirements, SVCs
2828
Example usage of the decorators:
2929

3030
```python
31-
@Requirements(REQ_111, REQ_222)
31+
@Requirements("REQ_111", "REQ_222")
3232
def somefunction():
3333
```
3434

3535
```python
36-
@SVCs(SVC_111, SVC_222)
36+
@SVCs("SVC_111", "SVC_222")
3737
def test_somefunction():
3838
```
3939

@@ -53,5 +53,5 @@ process_decorated_data(path_to_python_files, output_file)
5353

5454
`path_to_python_files` is the directories to search through to find decorated code.
5555

56-
`output_file` is output file(path) the yaml file is stored to
56+
(Optional) `output_file` is output file(path) the yaml file is stored to. Default is `/build/reqstool/annotations.yml`.
5757

‎src/reqstool_python_decorators/processors/decorator_processor.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def get_functions_and_classes(self, file_path, decorator_names):
9898
if any(decorator_info["name"] in decorator_names for decorator_info in decorators_info):
9999
self.req_svc_results.append(
100100
{
101-
"fullyQualifiedName": file_path,
101+
"fullyQualifiedName": str(file_path).replace("/", "."),
102102
"elementKind": str(type(node)).split(".")[-1][:-5].upper(),
103103
"name": node.name,
104104
"decorators": decorators_info,

0 commit comments

Comments
 (0)