Closed phiwuu closed 1 month ago
Real-world example: https://github.com/python-attrs/cattrs/blob/v22.1.0/src/cattrs/_compat.py#L184
we could just add the line_nr at the end of the current Tracing Tag to make it unique. this is done in the cpp converter as well in https://github.com/bmw-software-engineering/lobster/blob/2b8296c0b7e8e71089872ec96c3bd5299eeed033/lobster/tools/cpp/cpp.py#L132
Adding the line number works to solve the bug issues, but it introduces another problem. Consider some project uses a test-driven approach and breaks system tests down into unit tests (instead of breaking down system requirements into unit requirements), and they want to link the unit test against the system test. This is no longer possible, because the line number of the system test will change easily.
Current Behaviour
If a Python file contains several function definitions with the same name, then the output of
lobster-python
cannot be forwarded tolobster-report
.Consider the following Python file (call it
code.py
):Now run
lobster-python
:The result of
python.lobster
is the following:Now
lobster-report
cannot handle this input, as it detects a duplicate definition of "code.compute". The error is raised here: https://github.com/bmw-software-engineering/lobster/blob/666f8afed28a7e4a5156fc7cacb47f2b6998c622/lobster/io.py#L128Expected Behaviour
Now the question is: What is the expected behaviour? For sure the above Python code is valid and needs to be supported by lobster. On the other hand, duplicate definitions shall be detected, too. We could add a unique identifier to the function name, like the line number, but then it will be hard to reference this function in other elements of the tracing policy. But the V-model of ISO 26262 always recommends to trace from code to requirements, so I wonder if tracing from something to python code through lobster-links is a real use case. Then adding line numbers might be a valid solution. This could be implemented as a switch flag.
Any ideas how to handle this best?