Detect script/expression usages that can be replaced with pure Declarative and log them

This issue is archived. You can view it, but you can't modify it. Learn more

XMLWordPrintable

      It would be interesting to see if we could inspect script and expression blocks in Declarative validation and look for instances of use cases/patterns/strings that could be replaced by a standard Declarative directive/condition/option, or which served no purpose at all. We'd log those as compiler warnings with a short "hey, don't do that, do this [link to example]", with a page on jenkins.io for the examples. This could look for things like:

      • Setting currentBuild.result = "FAILURE" in a post failure block - that's just totally redundant, why bother.
      • expression blocks that are just if (foo == "bar") (which can be replaced with the equals condition) and other simple if clauses that have direct equivalent conditions.
      • ...ok, need to think of more.

            Assignee:
            Unassigned
            Reporter:
            Andrew Bayer
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Archived: