Postgresql LOC miscalculation

  • ALM used (GitHub)
  • CI system used (Github Workflow)
  • Scanner command used when applicable (sonar-scanner -Dsonar.projectBaseDir=.)
  • Languages of the repository - Go, Vue, psql
  • Error observed (loc metrics not tally on postgresql file.)
  • scanner cli version: SonarScanner CLI 8.1.0.6389
  • Steps to reproduce
    • create a psql query and save in two file with .sql and .pgsql extensions.
      ensure sql file scanned by plsql analyzer and pgsql by postgresql analyzer

Hi, I faced some issue regarding the LOC metrics when processing the psql files. Anyone facing the same issue?

I saved postgresql sql into two file extensions: sql and psql.
analyze result:

  1. plsql analyzer - parsing error but LOC match the file content.
  2. postgresql analyzer - syntax parsing without issue but LOC not tally with the file content.

Hey @chml0204, welcome to the Community!

Assuming you’re using CI-based analysis: could you check the logs to confirm that indeed both files are being parsed and analyzed correctly? Are there any warnings? Would you mind sharing debug-level logs?

Hi there,

I observed some errors on parsing the sql file but that was expected. I checked the logs and there’s no errors when it came to the pgsql files. pgsql files are indexed as PostgreSQL, no issue on parsing, analyzing & Detection of duplications.

No sure how’s the LOC determined but I would be expecting LOC values closer to sql file copies.

herewith the debug logs.
workflow.log (202.7 KB)

Hey, thanks for sharing the logs, I’m going to flag this for the team to have a look.