This is a bit of a complicated problem and is not fully resolved, but this seems to be improvement over the simple adjustment in the previous logic. The old logic was doing a simple shift on the line numbers, and it seemed to fix the problem if a function was lower in the file after a function that had a single decorator.
For example:
@pytest.fixture(autouse=True)
def setup(self):
...
def function_with_wrong_line_numbers(self):
# the off by one fix in the previous code fixed me
In all other cases the line numbers would be wrong. With this new fix, I'm seeing most cases being correct except for multiline decorators, but it's easily fixed by altering the function with the wrong line numbers.
This is a bit of a complicated problem and is not fully resolved, but this seems to be improvement over the simple adjustment in the previous logic. The old logic was doing a simple shift on the line numbers, and it seemed to fix the problem if a function was lower in the file after a function that had a single decorator.
For example:
In all other cases the line numbers would be wrong. With this new fix, I'm seeing most cases being correct except for multiline decorators, but it's easily fixed by altering the function with the wrong line numbers.
See https://github.com/breuleux/jurigged/issues/29 for the full issue discussion.