Code Analysis: Wrong Rule 4403 for package body with init block

All BEGIN statements are marked with Rule 4403: Avoid unlabeled nested blocks when there is a init block:

CREATE OR REPLACE PACKAGE BODY pac AS
  PROCEDURE proc AS
  BEGIN
    NULL;
  END proc;
BEGIN
  NULL;
END pac;
/

image

I can acknowledge that behaviour.

Yes apparently we get a hit due to the initialization section.
This rule needs work ... Will look at it.

Thanks,
Andre

The XPath expression should read

//BLOCK[parent::BLOCK, parent::IF, parent::ELSIF, parent::CASE_STMT_ELSE, parent::CASE_STMT_WHEN, parent::LOOP][not(preceding-sibling::LABEL)]/TOKEN[@value = "begin"]

In the meantime you could create a custom rule (number 7000 or higher). However, in some beta to be released in the near future it will stop functioning due to a change in our definitions. But by that time 4403 will already have been fixed.