Skip to content

Method definitions must be placed before the module body operators (CodeBlockBeforeSub)

Type Scope Severity Activated
by default
Minutes
to fix
Tags
Error BSL
OS
Blocker Yes 5 error

Description

The structure of the software module (in general form) is clearly defined:

  • first comes the variable definition block
  • then definitions of procedures and functions
  • then the module code block

Based on the structure described above, the location of the program code before the definition of methods is unacceptable.

Examples

Incorrect

SomeMethod();
Message("Before methods definition");

Procedure SomeMethod()
// Method body
EndProcedure

Sources

Snippets

Diagnostic ignorance in code

// BSLLS:CodeBlockBeforeSub-off
// BSLLS:CodeBlockBeforeSub-on

Parameter for config

"CodeBlockBeforeSub": false