Loc for pgsql missing during PR analysis

  • ALM used (GitHub)
  • CI system used (Github Workflow)
  • Scanner command used when applicable (private details masked)
    • sonar-scanner -Dsonar.projectBaseDir=.
      
  • Languages of the repository
    • TS, Go, PGsql, SQL
  • Error observed (wrap logs/code around with triple quotes ``` for proper formatting)
    • the loc metrics for pgsql files missing while scanning using PR analysis. With the same pgsql files, the loc metrics show up in the code section using branch analysis.
  • Steps to reproduce
    • save the following query in both sql and pgsql file extensions in main branch and trigger sonar workflow.
    • create new branch and commit the query with different filename and trigger PR analysis.
-- testing
-- test comment
CREATE TABLE IF NOT EXISTS report.d_source (
    id varchar(100) NOT NULL,
    report_id int8 NOT NULL,
    "name" varchar(50) NOT NULL,
    CONSTRAINT datasources_pk PRIMARY KEY (id)
);

Main branch analysis

PR analysis result

Github workflow log

workflow.log (196.0 KB)

Hello!

Thanks for the report, I was able to reproduce it for PGSQL.
We have identified the root cause and the fix will be deployed soon on SonarQube Cloud.

I misread your initial post, it should now work correctly on SonarQube Cloud for PGSQL.

confirmed the LOC metrics are showing on the PR analysis.

Thanks for the swift response. :folded_hands: