src/base/Util.js
Util
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
Open
class Util {
/**
* Checks a precondition, throwing an exception containing the given message in the case of failure.
* @param {!boolean|*} expression
* @param {=string} message
File Util.js
has 269 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/**
* Copyright 2017 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Function breakLine
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
static breakLine(text, maxWidth, measureWidth) {
if (text === "") {
return [""];
}
let lines = [];
Function reverseGroupMap
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
Open
static reverseGroupMap(groupMap, includeGroupsForOriginalKeysEvenIfEmpty = false) {
let result = new Map();
if (includeGroupsForOriginalKeysEvenIfEmpty) {
for (let e of groupMap.keys()) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function breakLine
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
static breakLine(text, maxWidth, measureWidth) {
if (text === "") {
return [""];
}
let lines = [];
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"