Has the line count method changed?

Hi there,

Our line count skyrocketed last week according to SonarCloud. We haven’t made any major changes, that could explain it and our project configuration hasn’t changed for months or years either. SonarCloud now detects new lines in almost all files compared to just 8 days ago, even in files which have not been modified at all. Our project line count jumped from ~400k to ~720 overnight.

For us it seems that empty lines, or lines containing only comments are now being included. I couldn’t find any official explanation for this on the support pages, or in the changelogs.

Can someone please explain this?

Thanks in advance

Hey there.

What language(s) primarily make up your repo?

Hi Colin,

It is 98%+ TypeScript.

Thanks

Hi @blaky,

do you run tsc before the analysis? The only reason I can imagine at this moment is that maybe the scanner is finding the .js files from the build process and you may need to add them to your ignore.

Cheers,
Victor

Hi,
No we don’t, the JS files are not found and they are not included in the report.

Thanks,
Bence

Hi @blaky,

can you share your sonar.properties and your analysis steps? any .yml config?

Thanks,
Victor

Sonar properties: The organization identifiers are removed, I can give them to you in a DM.

sonar.projectKey=XXXXXXX
sonar.organization=XXXXXXX
sonar.sources=.
# This is the name and version displayed in the SonarCloud UI.
sonar.projectName=XXXXXXX
sonar.projectVersion=1.0

# Encoding of the source code. Default is default system encoding
sonar.sourceEncoding=UTF-8

Github action:

on:
  # Trigger analysis when pushing in master or pull requests, and when creating
  # a pull request.
  push:
    branches:
      - master
  pull_request:
    types: [opened, synchronize, reopened]
name: Main Workflow
jobs:
  sonarcloud:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
        with:
          # Disabling shallow clone is recommended for improving relevancy of reporting
          fetch-depth: 0
      - name: SonarCloud Scan
        uses: sonarsource/sonarcloud-github-action@master
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

Hi @blaky,

wouldn’t you have by any chance logs from after and before the change in line count? If not, if you could share with us (or with me privately if you prefer) debug logs (enabled with sonar.verbose=true) of one analysis would be very helpful.

Cheers,
Victor