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

[feat] Accept non-existing file paths in report-converter #4288

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -90,16 +90,12 @@ def parse_stack_trace_line(self, line: str) -> Optional[BugPathEvent]:
return None

file_path = file_match.group('path')
if file_path and os.path.exists(file_path):
col = file_match.group('column')
return BugPathEvent(
line.rstrip(),
get_or_create_file(
os.path.abspath(file_path), self._file_cache),
int(file_match.group('line')),
int(col) if col else 0)

return None
col = file_match.group('column')
return BugPathEvent(
line.rstrip(),
get_or_create_file(os.path.abspath(file_path), self._file_cache),
int(file_match.group('line')),
int(col) if col else 0)

def create_report(
self,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,9 @@ def __get_report_hash_context_free(report: Report) -> List[str]:

if line_content == '' and \
not os.path.isfile(report.file.original_path):
LOG.error("Failed to include source line in the report hash.")
LOG.error('%s does not exists!', report.file.original_path)
LOG.warning(
"Failed to include source line in the report hash. "
'%s does not exist!', report.file.original_path)

return [
report.file.name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def get_line(file_path: str, line_no: int, errors: str = 'ignore') -> str:
with open(file_path, mode='r', encoding='utf-8', errors=errors) as f:
return get_linef(f, line_no)
except IOError:
LOG.error("Failed to open file %s", file_path)
LOG.warning("Failed to open file %s", file_path)
return ''


Expand Down
Loading