[UI] add source context to reports in bugs.txt

Summary:
Now that the terminal output is truncated to max 10 issues, it's useful to have
some place where all bugs with source excerpts can be found. Since bugs.txt is
already unstructured (to the extend that it's just text), hopefully no one was
relying on it having a particular format so it's safe to change it to add
source excerpts.

Anyone wanting the old behaviour should consider parsing report.json instead,
which is intended to be more stable.

Closes https://github.com/facebook/infer/issues/520

Reviewed By: akotulski

Differential Revision: D4284175

fbshipit-source-id: 764f291
master
Jules Villard 8 years ago committed by Facebook Github Bot
parent bd216f3205
commit b0a5495611

@ -98,16 +98,15 @@ def _text_of_report_list(project_root, reports, bugs_txt_path, limit=None,
line = report[JSON_INDEX_LINE]
source_context = ''
if formatter == colorize.TERMINAL_FORMATTER:
source_context = source.build_source_context(
os.path.join(project_root, filename),
formatter,
line,
)
indenter = source.Indenter() \
.indent_push() \
.add(source_context)
source_context = '\n' + unicode(indenter)
source_context = source.build_source_context(
os.path.join(project_root, filename),
formatter,
line,
)
indenter = source.Indenter() \
.indent_push() \
.add(source_context)
source_context = '\n' + unicode(indenter)
msg = text_of_report(report)
if report[JSON_INDEX_KIND] == ISSUE_KIND_ERROR:

Loading…
Cancel
Save