Sonar scanner not including a file from my project

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    Sonar community edition (downloaded in zip file)

  • what are you trying to achieve
    I am running sonar scanner on my project to measure comments percentage. But its excluding one file which has 27000 lines of code. I do not see any error in the logs. If I reduce the lines, its not excluding. Is there any limit on lines of code in a single file? Please help me with any solution. I want all files in the project to be included.

  • what have you tried so far to achieve this
    Googled, but didn’t find proper solution.


Welcome to the community!

What language is the file in question?


I am using Typescript language and file saved as *.ts


I see now that you tagged the OP typescript.

TBH, we’re planning to do file size-based automatic exclusions on the SonarQube side ( SONAR-11096) but that ticket hasn’t been worked on yet, so I’m assuming this is happening on the language side… Which puts me out of my depth. Let’s wait till the language experts get here.


Hi again,

No need to wait, as it turns out. A colleague was able to point me to the relevant ticket, and it turns out that JavaScript and TypeScript analysis do automatically exclude large files. Details here:

Exclude huge files from analysis #2037


Okay. Thanks for the update. Is there any way to stop automatically excluding large files when I ran sonar scanner?

I don’t see anything in the ticket description about that.


Okay. Thanks. Expecting someone to reply with solution.

Hi @kirangoud323 ,

There should be a property named sonar.javascript.maxFileSize, which determines the threshold for the file size, measured in kilobytes. Could you please try setting it to some value larger than the size of the excluded file (like e.g. 10000 or 100000), and then see whether it solves the problem?

Thanks in advance.

Thanks for the suggestion. But unfortunately, I could not try it. Because, I am using local version of sonarqube which was dowloaded from here
I don’t see any file to edit this property sonar.javascript.maxFileSize. Do you have any suggestions on how to change this property when sonarqube is being ran locally?

When running the scanner, try to add to the command line -Dsonar.javascript.maxFileSize=100000.