codebeat

Advice & answers from the codebeat team

New to codebeat? Want to learn more about our tool or how it can help you developer better code? You're in the right place! Go ahead and browse our documentation; you should find all the answers there.

You can also reach us directly through the live chat icon placed in the bottom right-hand corner.

Muting individual issues

Disable certain metrics using magic comments

The Syntax

Use the comment syntax presented below to disable and enable reporting individual issues. You can pass a comma-separated list of desired issues to disable multiple types at once. You can find the list of all available types below.

// codebeat:disable[LOC,ABC]
func authentication(username username: String, password: String) -> String {
  // your code
}
// codebeat:enable[LOC,ABC]

Place the comment above the namespace declaration In order to disable a namespace-level metric.

// codebeat:disable[TOO_MANY_IVARS]
struct HttpRequest {
  // your code
}
// codebeat:enable[TOO_MANY_IVARS]

Scope

If you add a codebeat:disable comment without a following codebeat:enable, the remaining part of your source file will be affected.

Muting issues works similarly across all supported languages

Metric keys

You can disable one or more metrics. Below you will find the keys to use within muting comments with an explanation of the metric itself.

"ABC" - Assignment Branch Condition size;
"ARITY" - number of function/method arguments;
"BLOCK_NESTING" - maximum block nesting;
"CYCLO" - cyclomatic complexity;
"LOC" - length (in terms of lines of code) of a function/method;
"RETURN_ARITY" - Number of return values (Go only);
"TOTAL_COMPLEXITY" - Total namespace complexity;
"TOTAL_LOC" - Namespace length in terms of lines of code;
"TOO_MANY_FUNCTIONS" - Number of functions in a given namespace;
"TOO_MANY_IVARS" - Number of instance variables in a given namespace;