Trivadis / plsql-cop-cli

db* CODECOP Command Line
Other
24 stars 1 forks source link

Highlighting the area of G-7460 violations is too extensive for standalone functions #17

Closed PhilippSalvisberg closed 5 months ago

PhilippSalvisberg commented 6 months ago

Violations of G-7460 are reported in the following cases:

create or replace package body pkg is
   function f return integer is
   begin
      return 1;
   end f;
end pkg;
/

create or replace function f return integer is
begin
   return 1;
end f;
/

That's ok. However, the highlighted area which becomes visible in the "Code Excerpt" in the db* CODECOP reports or in the highlighted area in the SQL Developer extension or in SonarQube is too extensive.

Here is the screenshot for the violation in the package function:

image

And here is the screenshot for the violation in the standalone function:

image

The reported scope should be the same for standalone functions as for package functions.

PhilippSalvisberg commented 5 months ago

The underlying plsql grammar does not provide an object for the standalone function signature. However, in that case, we can highlight the function name. This should be good enough. G-7410 reports the issues the same way.

PhilippSalvisberg commented 5 months ago

closed with Azure DevOps commit