Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistencies between G-9102 and G-2185 #62

Closed
PhilippSalvisberg opened this issue Dec 21, 2023 · 1 comment
Closed

Inconsistencies between G-9102 and G-2185 #62

PhilippSalvisberg opened this issue Dec 21, 2023 · 1 comment
Assignees
Labels
bug Something isn't working
Milestone

Comments

@PhilippSalvisberg
Copy link
Collaborator

The following code throws a G-2185 for the identifier i (ok) but no warning of G-9102 for i (inconsistent):

declare
   i integer := 0;  -- violates G-2185, not used in while loop condition nor exit condition
   j integer;       -- does not violate G-2185, used in exit condition
begin
   <<demo>>
   loop
      j := i;
      exit demo when j = 10;
      i := i + 1;
   end loop demo;
end;
/

The next example uses also overly short variable names, but not i nor j:

declare
   a integer := 0;  -- violates G-2185, not used in while loop condition nor exit condition, violates G-9102
   b integer;       -- does not violate G-2185, used in exit condition, violates G-9102
begin
   <<demo>>
   loop
      b := a;
      exit demo when b = 10;
      a := a + 1;
   end loop demo;
end;
/

This time there are G-9102 violations for a and b because they are not handled as exceptions in G-9102.

Instead of defining a list of exceptions as in

private static String VALID_LOCAL_VARIABLE_NAMES = "^([ij])$";
we should use the same logic as for G-2185 to identify the local variables to be checked.

@PhilippSalvisberg PhilippSalvisberg added the bug Something isn't working label Dec 21, 2023
@PhilippSalvisberg PhilippSalvisberg self-assigned this Dec 21, 2023
@PhilippSalvisberg PhilippSalvisberg changed the title Inconsistencies between G-9102 nad G-2185 Inconsistencies between G-9102 and G-2185 Jan 3, 2024
@PhilippSalvisberg PhilippSalvisberg added this to the v4.5.0 milestone Jan 16, 2024
PhilippSalvisberg added a commit that referenced this issue Jan 16, 2024
it is not applicable anymore when
implementing #62
PhilippSalvisberg added a commit that referenced this issue Jan 16, 2024
@PhilippSalvisberg
Copy link
Collaborator Author

closed via 6953d53

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant