Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-74818

Automatically set fileName and lineStart in groovy parsers

    • Icon: New Feature New Feature
    • Resolution: Unresolved
    • Icon: Minor Minor
    • warnings-ng-plugin
    • None

      When the plugin invokes a user provided groovy based parser, it injects the builder, matcher, fileName and lineNumber variables. However, it's currently in the responsibility of the user to actually use those injected variables by calling the builder API. Since that's not well known, the plugin should check whether a file name and a line number have been set on the parser return value, and just add them if they are missing.

      That way all existing custom builders would benefit from having a link to the analyzed source by default. Right now most custom parsers probably don't have such a link, as it requires the knowledge of the undocumented injected variables. I've created a PR to document them: https://github.com/jenkinsci/warnings-ng-plugin/pull/1879, but setting them by default might be even more useful.

          [JENKINS-74818] Automatically set fileName and lineStart in groovy parsers

          Ulli Hafner added a comment -

          I think it is not possible to change these values in case they have not been altered by the script: the builder is discarded after the invocation of the script. But it should not hurt if the builder is initialized with these values? What do you think? Interested in providing a PR?

          Ulli Hafner added a comment - I think it is not possible to change these values in case they have not been altered by the script: the builder is discarded after the invocation of the script. But it should not hurt if the builder is initialized with these values? What do you think? Interested in providing a PR?

          Sounds also good to me, as it should have the same effect for the end user. Might take some days for the PR due to other activities.

          Michael Keppler added a comment - Sounds also good to me, as it should have the same effect for the end user. Might take some days for the PR due to other activities.

            drulli Ulli Hafner
            bananeweizen Michael Keppler
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: