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

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

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.

            Unassigned Unassigned
            abayer Andrew Bayer
            Votes:
            4 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: