Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get full path of files found in rv.stdout #180

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lobster/tools/cpp/cpp.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ def main():
match = re.match(RE_NOTAGS, line)
if match:
filename, line_nr, kind, function_name = match.groups()
filename = next((item for item in file_list if filename in item), None)
filename = os.path.relpath(filename, prefix)
Copy link
Member

@phiwuu phiwuu Jan 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line filename = os.path.relpath(filename, prefix) returns the relative path, but your pull request title indicates to use the full path. What do you intend to achieve?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use case: some lines from rv.stdout contains relative path instead of absolute path and because of this filename = os.path.relpath(filename, prefix) will do nothing and a fix to get the absolute path is needed.

line_nr = int(line_nr)
function_uid = "%s:%s:%u" % (os.path.basename(filename),
Expand All @@ -174,6 +175,7 @@ def main():
match = re.match(RE_JUST, line)
if match:
filename, line_nr, kind, function_name, reason = match.groups()
filename = next((item for item in file_list if filename in item), None)
filename = os.path.relpath(filename, prefix)
line_nr = int(line_nr)
function_uid = "%s:%s:%u" % (os.path.basename(filename),
Expand All @@ -197,6 +199,7 @@ def main():
match = re.match(RE_TAGS, line)
if match:
filename, line_nr, kind, function_name, ref = match.groups()
filename = next((item for item in file_list if filename in item), None)
filename = os.path.relpath(filename, prefix)
line_nr = int(line_nr)
function_uid = "%s:%s:%u" % (os.path.basename(filename),
Expand Down
Loading