bmw-software-engineering / lobster

Lightweight Open BMW Software Traceability Evidence Report
GNU Affero General Public License v3.0
12 stars 6 forks source link

lobster-python: false positive on duplicate function definition #36

Closed jnow-87 closed 2 weeks ago

jnow-87 commented 3 months ago

lobster-python reports a duplicated function definition for severity() in the following example:

import dataclasses

@dataclasses.dataclass
class Diagnostic: 
    _severity: int = dataclasses.field()

    @property
    def severity(self):
        return self._severity

    @severity.setter
    def severity(self, value: int):
        self._severity = value

These are clearly not duplicate functions but separate ones which can both be called on the same instance if Diagnostic. Hence, this case should be fixed within lobster.

The problem might originate from here https://github.com/bmw-software-engineering/lobster/blob/6bb274e19b47b8ced6fc9c6d103c5e4418cf83a7/lobster/tools/python/python.py#L197-L198 since the function tag is built only using self.fqn(), which is probably the function name. A solution might be to consider the entire function signature as the tag.

phiwuu commented 3 months ago

Possible duplicate of https://github.com/bmw-software-engineering/lobster/issues/30