Function _format
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
MessageFormat.prototype._format = function (pattern, values, builderCtx, builderFactory) {
var builder = builderFactory(builderCtx);
var i, len, part, id, value;
for (i = 0, len = pattern.length; i < len; i += 1) {
- 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 MessageFormat
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
function MessageFormat(message, locales, formats, opts) {
// Parse string messages into an AST.
var ast = typeof message === 'string' ?
MessageFormat.__parse(message) : message;
- 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 _format
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
MessageFormat.prototype._format = function (pattern, values, builderCtx, builderFactory) {
var builder = builderFactory(builderCtx);
var i, len, part, id, value;
for (i = 0, len = pattern.length; i < len; i += 1) {
Function MessageFormat
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
function MessageFormat(message, locales, formats, opts) {
// Parse string messages into an AST.
var ast = typeof message === 'string' ?
MessageFormat.__parse(message) : message;
Function _resolveLocale
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
MessageFormat.prototype._resolveLocale = function (locales) {
if (typeof locales === 'string') {
locales = [locales];
}
- 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 _compilePattern
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
MessageFormat.prototype._compilePattern = function (ast, locales, formats, pluralFn, opts) {
TODO found Open
// TODO: Provide anything else?
- Exclude checks