Sonarqube taking around 25 -30 mins to scan the code

so, i have integrated sonarqube 7.9 version (community edition) with jenkins.
i also, installed the sonarqube scanner plugin and the sonarqube quality gates plugin.
I am trying to use the quality gates on a freestyle job and whenever the quality gates fail, build fails.
the problem is that it takes a minimum of 25 mins to scan the code that has around 5000 lines.
is there a way to shorten the time taken by the sonarqube scanner ??


First, your version is past EOL. You should upgrade to either the latest version or the current LTS at your earliest convenience. Your upgrade path is:

7.9.6 → 8.9.2 → 9.1 (last step optional)

You may find the Upgrade Guide and the LTS-to-LTS Upgrade Notes helpful. If you have questions about upgrading, feel free to open a new thread for that here.

Regarding your actual question, analysis duration can be affected by many things. Once you upgrade, please enable debug logging in your analysis and post the logs so we can see where the time is going.