SQL must be checked after each execution of a &SQL() statement.

You should avoid legacy versions of if and else, and use the most modern format which uses curly braces. Below is explained the reason.

There are several reasons for a method not to have a method body:

The declared method is never used, so probably it is dead code that can be removed. Be sure you don't need this piece of code before removing it.

Don't use quoted names in classes to avoid confusion.

Noncompliant Code Example

Next declaration is valid, but can be confusing when it is used on the code.

Property "Hello_World";

Compliant Solution

Next declaration is preferred for clarity.

Property Hello_World;

This check computes the Width of Inheritance Tree, that is the number of leaves in the dependency tree.

For instance, for a class named MyClass, let's suppose that we have:

This check computes the Depth of Inheritance Tree as described here.

This check computes the Lack of Cohesion of Methods as described here.

An LCOM4 which is greater than 1 means that this class has two or more distinct functional paths (a given set of instance variables is only used by a given set of methods of this class). If appropriate/possible, try and split this class into several ones with isolated functionalities.

Use parenthesis to surround the boolean expressions in a conditional statement.

Noncompliant Code Example

ClassMethod foo()
{
    Set a=1
    Set b=2

    if a=1 || b=2
    {
        Write !,"Hello "
    }
    Write !,"World"
}

Compliant Solution

ClassMethod foo()
{
    Set a=1
    Set b=2

    if (a=1) || (b=2)
    {
        Write !,"Hello "
    }
    Write !,"World"
}

Method is used in expression but has no ReturnType in definition.

Noncompliant Code Example

ClassMethod foo()
{
    Quit "1"
}

ClassMethod bar()
{
    #Dim str As %String = ..foo()
    Write !,str
}

Compliant Solution

ClassMethod foo() As %String
{
    Quit "1"
}

ClassMethod bar()
{
    #Dim str As %String = ..foo()
    Write !,str
}

Pages