Lints - Config


invalid_value

Code: L-C01
Default Severity: Error
Minimum Severity: Error

Reports on any values in the config that could not be parsed into a valid config value.

Example

Incorrect

class MyClass {
    data = 1.0.0; // invalid value, should be quoted
};

Correct

class MyClass {
    data = "1.0.0";
};

Explanation

Arma configs only support Strings, Numbers, and Arrays. While other tools would guess that 1.0.0 is a string (often called auto-quote), this behaviour can introduce unintentional mistakes and is not supported by HEMTT.


duplicate_property

Code: L-C02
Default Severity: Error
Minimum Severity: Error

Reports on duplicated properties.

Example

Incorrect

class MyClass {
    data = 1;
    data = 2;
};

Incorrect

class MyClass {
    data = 1;
    class data {
        value = 1;
    };
};

Explanation

Properties on a class must be unique, regardless of the type of property.


duplicate_classes

Code: L-C03
Default Severity: Error
Minimum Severity: Error

Reports on duplicated child classes.

Example

Incorrect

class MyClass {
    class data {
        value = 1;
    };
    class data {
        value = 2;
    };
};

Incorrect

class MyClass {
    class child;
    class child {
        value = 1;
    };
};

Explanation

Children classes can only be defined once in a class.


external_missing

Code: L-C04
Default Severity: Error
Minimum Severity: Error

Reports on classes that extend an external class that is not present in the config

Example

Incorrect

class MyClass: ExternalClass {
    value = 1;
};

Correct

class ExternalClass;
class MyClass: ExternalClass {
    value = 1;
};

Explanation

Classes that extend an external class must be declared in the config.

Read more about class inheritance.


external_parent_case

Code: L-C05
Default Severity: Warning
Minimum Severity: Help

Reports on uses of base classes with incorrect case compared to the parent definition

Example

Incorrect

class BaseClass {};
class MyClass: baseclass {};

Correct

class BaseClass {};
class MyClass: BaseClass {};

Explanation

While Arma does not care about the case of class names, HEMTT wants you to have pretty code.


unexpected_array

Code: L-C06
Default Severity: Error
Minimum Severity: Error

Reports on properties that are not expected to be arrays, but are defined as arrays

Example

Incorrect

class MyClass {
    data = {1, 2, 3};
};

Correct

class MyClass {
    data[] = {1, 2, 3};
};

Explanation

Arrays in Arma configs are denoted by [] after the property name.


expected_array

Code: L-C07
Default Severity: Error
Minimum Severity: Error

Reports on properties that are expected to be arrays, but are not defined as arrays

Example

Incorrect

class MyClass {
    data[] = 1;
};

Correct

class MyClass {
    data = 1;
};

Explanation

Only properties that are arrays must have [] after the property name.


missing_semicolon

Code: L-C08
Default Severity: Error
Minimum Severity: Error

Reports on properties that are missing a semicolon

Example

Incorrect

class MyClass {
    data = 1
};

Correct

class MyClass {
    data = 1;
};

Incorrect

class MyClass {
    data = 1;
}

Correct

class MyClass {
    data = 1;
};

Explanation

All properties must end with a semicolon, including classes.


magwell_missing_magazine

Code: L-C09
Default Severity: Error
Minimum Severity: Warning

Reports on magazines that are defined in CfgMagazineWells but not in CfgMagazines

Example

Incorrect

class CfgMagazineWells {
    class abe_banana_shooter {
        abe_main[] = {
            "abe_cavendish",
            "abe_plantain",
            "external_banana"
        };
    };
};
class CfgMagazines {
    class abe_cavendish {};
};

Correct

class CfgMagazineWells {
    class abe_banana_shooter {
        abe_main[] = {
            "abe_cavendish",
            "abe_plantain",
            "external_banana"
        };
    };
};
class CfgMagazines {
    class abe_cavendish {};
    class abe_plantain {};
};

Explanation

Magazines defined in CfgMagazineWells that are using the project's prefix (abe in this case) must be defined in CfgMagazines as well. This is to prevent accidental typos or forgotten magazines.


class_missing_braces

Code: L-C10
Default Severity: Error
Minimum Severity: Error

Reports on classes that use inheritance without braces

Example

Incorrect

class External;
class AlsoExternal: External;
class MyClass: AlsoExternal {
    data = 1;
};

Correct

class External;
class AlsoExternal: External {};
class MyClass: AlsoExternal {
    data = 1;
};

Explanation

All classes using inheritance with a parent class must use braces {}, even if the class has no properties.


file_type

Code: L-C11
Default Severity: Warning
Minimum Severity: Help

Reports on properties that have an unusual or missing file type

Configuration

  • allow_no_extension: Allow properties to not have a file extension, default is false.
[lints.config.file_type]
options.allow_no_extension = true

Example

Incorrect

class MyClass {
    model = "model.blend";
};

Correct

class MyClass {
    model = "model.p3d";
};

Incorrect

class MyClass {
    editorPreview = "preview.jgp";
}

Correct

class MyClass {
    editorPreview = "preview.jpg";
};

Incorrect, when allow_no_extension is false

class MyClass {
    model = "my_model";
};

Correct

class MyClass {
    model = "my_model.p3d";
};

Explanation

Some properties require a specific file type. This lint will report on properties that have an unusual file type, from typos or incorrect file extensions.


math_could_be_unquoted

Code: L-C12
Default Severity: Help
Minimum Severity: Help

Reports on quoted math statements that could be evaulated at build-time

Configuration

  • ignore: Specifies a list of properties to ignore, typically because they may contain false positives.
  • forced: Specifies a boolean to check all properites for numbers, or list of properties that should be checked to be numbers.

default values shown below

[lints.config.math_could_be_unquoted]
options.ignore = ["text", "name", "displayname"]
options.forced = ["initspeed", "ambient", "diffuse", "forceddiffuse", "emmisive", "specular", "specularpower"]

Example

Incorrect

x = '1+1';

Correct

x = 1+1; // HEMTT will evaluate at build-time to 2

Explanation

Quoted math statements will have to be evaulated on each use in-game, by allowing HEMTT to evaluate the math at build-time you can save some performance.


config_this_call

Code: L-C13
Default Severity: Help (Pedantic)
Minimum Severity: Help

Checks for usage of _this call, where _this is not necessary - in config text

Example

Incorrect

statement = "_this call _my_function";

Correct

statement = "call _my_function";

Explanation

When using call, the called code will inherit _this from the calling scope. This means that _this is not necessary in the call, and can be omitted for better performance.