'Jenkins checkout scm step

I'm new to Jenkins and I'm trying to understand the following step in Jenkins pipeline line by line:

checkout scm
                dir("some_directory") {
                    checkout(
                        changelog: false,
                        poll: false,
                        scm: [
                            $class                           : 'GitSCM',
                            branches                         : [[name: SOME_BRANCH_NAME]],
                            doGenerateSubmoduleConfigurations: false,
                            extensions                       : [[$class: 'CloneOption', depth: 0, honorRefspec: true, reference: '', shallow: false]],
                            submoduleCfg                     : [],
                            userRemoteConfigs                : [[url: SOME_URL]]
                        ]
                    )
                    sh 'pwd; ls'
                }

From the research I've done I understood that

checkout scm dir("some_directory")

'dir' creates a folder in workspace if it doesn't exist, and git project gets checked out into this directory

checkout(
       changelog:false,
       poll:false,
       scm: [...]
)

this block of code specifies git parameters of the git project that is being checked out into the directory specified above.

This is so far what I understood, can someone please lt me know if my understanding is correct? And possibly add more details to it.

Also, I am confused with the current code syntax. Would it make any difference if I rewrite the top few lines as:

checkout scm dir("some_directory")(
            changelog: false,
            poll: false,
            etc.
)

instead of using 'checkout' two times.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source