Code Tags

ipt supports a list of tags that can be used to annotate your code to trigger build-in behavior of ipt. All tags are used inside comments.

fallthrough

This tag marks a switch case as fallthrough. More information can be found at the linting rule Codestyle: Fallthrough case require comment.

FIXME(ruleName)

These tags are inserted by ipt to highlight regions that need manual fixes that cannot be done automatically by ipt.

IPT_FORMAT_OFF and IPT_FORMAT_ON

These are specialized comments that can be used to turn ipt formatting on or off for certain code regions. The comment has to be in a single line that is not allowed to contain other code. The tag itself can be somewhere in the comment itself. Doing this will keep all original formatting between IPT_FORMAT_OFF and IPT_FORMAT_ON.

Before
if(var)
    print 1,2,     3
    // IPT_FORMAT_OFF
    print 1,2,     3
endif

print 1,2,     3
// IPT_FORMAT_OFF
print 1,2,     3
// IPT_FORMAT_ON
print 1,2,     3
After formatting
if(var)
    print 1, 2, 3
    // IPT_FORMAT_OFF
    print 1,2,     3
endif

print 1, 2, 3
// IPT_FORMAT_OFF
print 1,2,     3
// IPT_FORMAT_ON
print 1, 2, 3

For good style it is recommended to always add a matching // IPT_FORMAT_ON for each // IPT_FORMAT_OFF.

IPT_NORETURN

This tag can be used to mark a code line that will never return in the usual way and will always abort or quit Igor. This can be used when calling a user function like FAIL("msg") that will always abort the current execution. This line will then be handled the same way as an abort statement.

NOLINT(ruleName)

This tag turns a specific rule at the current line off and its execution will be disabled. In case a rule targets a multiline statement, it will always consider the start of the statement and it will be at same line as the error message.

If you used line continuation, the tag will be active from the position of the tag up until to the line that started the line continuation.

// NOLINT will be active from the line of its comment up until to the print
// that introduced the first line continuation
print 1 + \
      2 + \
      3 // NOLINT(ruleName)

You can NOLINT multiple rules (or features) at once.

// NOLINT(ruleName1, ruleName2, ruleName3:feature)
or
// NOLINT(ruleName1) NOLINT(ruleName2) NOLINT(ruleName3:feature)

Both variants are supported and you can mix styles. Commas and spaces as delimiter are optional and ignored. NOLINT(ruleName1ruleName2) is not supported. Text outside of NOLINT is supported and ignored.

NOLINT with unsupported rule names are ignored.

You cannot specify NOLINT for generated code, but most rules ignore generated code anyway.