felipebz / zpa

Parser and static code analysis tool for PL/SQL and Oracle SQL.
https://zpa.felipebz.com
GNU Lesser General Public License v3.0
211 stars 77 forks source link

Comparison to SonarQube's PL/SQL-support? #167

Closed chkpnt closed 1 year ago

chkpnt commented 1 year ago

Not in the community edition, but in the developer edition and above, SonarQube has (some) PL/SQL support. Would you mind to elaborate a little bit how this plugin differs from SonarSource's implementation? Do you consider zpa as an alternative or as an supplement?

felipebz commented 1 year ago

Hi! I consider it an alternative. Both the SonarSource's plugin and ZPA have a similar set of features. Here are some differences:

When I analyze PL/SQL code, I expect that the code is identified and analyzed correctly at least. Take this code as an example:

select 1
  from tab, tab2
 where tab.id = tab.id;

select 1
  from tab, tab2
 where tab.id = tab.id
   and (tab.col1, tab.col2) in (select col1, col2 
                                  from tab3);

These two queries have the same issue: a value being compared to itself on where tab.id = tab.id. However, the SonarSource's plugin doesn't report the issue on the second query because it doesn't recognize the (col1, col2) in (…) syntax and it considers the whole query as invalid code. Here is an example from an analysis on SonarCloud:

image

In my opinion, the fact that it fails to parse this simple code is a serious flaw that compromises the quality and reliability of the code analysis and may lead to false negatives and missed vulnerabilities.

Using ZPA, both issues are reported correctly:

image

On the other hand, SonarSource is a unicorn startup with many developers and commercial support, I'm sure they can fix this whenever they want, and I'm just a PL/SQL developer myself maintaining a plugin on my free time. 😄

chkpnt commented 1 year ago

Thank you for this detailed and very useful reply!

felipebz commented 1 year ago

Thanks!😊