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

Request for computational version of IG QA output incl. line and col for the errors/warnings/hints #675

Closed
hvamstel opened this issue Apr 24, 2023 · 9 comments
Labels
Approved Change has been reviewed and accepted and can now be applied to the templates enhancement New feature or request

Comments

@hvamstel
Copy link
Contributor

hvamstel commented Apr 24, 2023

Hi,

When I look in the qa.html file I see that a lot of warnings and errors have the line and column information to find the location of the message in the source file. The needed information is available but not printed in the qa.txt file. I need this information to create a ProblemMatcher in visual studio code that parses this qa.txt file and presents the warnings/errors/informations nice and clickable to the developer.

I was able to add this line and column information by adding + lineCol(vm) to the genQAText method in the ValidationPresenter.java.
See last line in the code block below.

  public void genQAText(String title, List<FetchedFile> files, String path, SuppressedMessageInformation filteredMessages, List<ValidationMessage> linkErrors)
      throws IOException {
    StringBuilder b = new StringBuilder();
    b.append(genHeaderTxt(title, err, warn, info));
    b.append(genSummaryRowTxtInternal(linkErrors));
    files = sorted(files);
    for (FetchedFile f : files) 
      b.append(genSummaryRowTxt(f));
    b.append(genEnd());
    b.append(genStartTxtInternal());
    for (ValidationMessage vm : linkErrors)
      b.append(vm.getDisplay() + "\r\n");
    b.append(genEndTxt());
    for (FetchedFile f : files) {
      b.append(genStartTxt(f));
      for (ValidationMessage vm : filterMessages(f.getErrors(), false, filteredMessages))
        b.append(vm.getDisplay() + lineCol(vm) + "\r\n");
@github-actions github-actions bot added this to Inbox in Kanban board Apr 24, 2023
@lmckenzi
Copy link
Contributor

The content in qa.txt is used to drive how IGs suppress warning and information messages. Adding line and column numbers here would break a lot of implementation guides. The intention is that programmatic use of the QA output should be driven by qa.xml. Would this work for you? (Also, if we change the rendering of the .txt in the future, it would break your parsing code, while the content of the qa.xml is driven by the OperationOutcome resource and is therefore guaranteed to be predictable/stable.)

@grahamegrieve
Copy link
Contributor

I will add a new file in eslint-compact format

@hvamstel
Copy link
Contributor Author

hvamstel commented May 1, 2023

The content in qa.txt is used to drive how IGs suppress warning and information messages. Adding line and column numbers here would break a lot of implementation guides. The intention is that programmatic use of the QA output should be driven by qa.xml. Would this work for you? (Also, if we change the rendering of the .txt in the future, it would break your parsing code, while the content of the qa.xml is driven by the OperationOutcome resource and is therefore guaranteed to be predictable/stable.)

This could work (will check) but would make the regex needed for extracting message, severity, line and col information more complex. As this mechanism developed for parsing human readable string-based output.

@hvamstel
Copy link
Contributor Author

hvamstel commented May 1, 2023

I will add a new file in eslint-compact format

Thanks this will help. I also noticed that there are errors/warnings without line/col information. Would it be possible to have a line/col for every warning/error?

@grahamegrieve
Copy link
Contributor

Probably not. if they don't have one now, then the information is probably not easily available, if at all

@hvamstel
Copy link
Contributor Author

hvamstel commented May 1, 2023

image

What I try to achieve in vscode is that after an IGpublisher run a nice overview is created that shows the errors/warnings/informationals graphically. When clicking on one of these the correct file is opened at the correct location so that the user can make the needed changes immediately.

This is based on parsing output like from gcc/java etc. The needed items like filename, message, severity, line, col are extracted using regex-groups in one or two regular expression(s). It is possible to link following errors to 1 source file as long as the list of errors follows this filename. A txt base file would work best. @grahamegrieve the eslint would work very well here as there are also plugins for this that would make it easier.

@lmckenzi I tried to work with the xml but as this is one big line without any line endings it does not work well in this scenario. Also I found that the filenames do not have an extension in the qa.xml. And this mechanism in vscode does not allow me to add this.

Some additional information on this can be found here: https://code.visualstudio.com/Docs/editor/tasks#_defining-a-problem-matcher

@david-simons
Copy link

I will add a new file in eslint-compact format

this would be appreciated @grahamegrieve - to enable the computational conversion of the IGPublisher QA output (eslint format) into VS Code tasks.

@hvamstel hvamstel changed the title The QA.txt doesn't contain the line and col for the errors/warnings/information messages while the QA.html does. Request for computational version of IG QA output incl. line and col for the errors/warnings/hints May 12, 2023
@lmckenzi lmckenzi added enhancement New feature or request Approved Change has been reviewed and accepted and can now be applied to the templates labels May 16, 2023
@lmckenzi lmckenzi moved this from Inbox to To do in Kanban board May 16, 2023
@david-simons
Copy link

I will add a new file in eslint-compact format

@hvamstel has created PR #689 for this - would be great to get this included

@lmckenzi
Copy link
Contributor

lmckenzi commented Jul 4, 2023

Complete

@lmckenzi lmckenzi closed this as completed Jul 4, 2023
Kanban board automation moved this from To do to Done Jul 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Approved Change has been reviewed and accepted and can now be applied to the templates enhancement New feature or request
Projects
Development

No branches or pull requests

4 participants