Only use the branch options if it's actually running in a branch and analyse main without them, sonarqube otherwise doesn't recognize the main branch.
Minor oversight from previous commit. Specify clone depth in .gitlab-ci.yml file instead.
Adding sonarqube scan to the pipeline.