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

Return statement does not exit function

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: Minor Minor
    • coverity-plugin
    • None

      Hi,

      I have a boolean function which uses 'withCoverityEnv'. Inside that code block I have an if statement and when it returns false it does not exit the function, it only exits the withCoverityEnv block

      Example

       

      boolean myFunFunction()
      {
         withCoverityEnv(coverityToolName: 'default', 
            connectInstance: 'foo-bar')
      
         {
            if (someBadCondition)
            {
               echo " bad  "
               return false
            }
            SomeMoreCode that is skipped
         }
         someMoreCodeThatGetsExecuted!
         return true
      }

       

      so even when 'someBadCondition' happens

      my code ends up returning true

      since that return false only exits the 'withCoverityEnv' block

            synopsys_sig_jenkins Synopsys SIG
            jc3265 Juan Caldas
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: