Showing 16 of 24 total issues
Function parseEntry
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
PoParser.prototype.parseEntry = function(entry) {
var flags, context, key, value, pluralKey, pluralValues;
flags = pluralValues = [];
context = key = value = pluralKey = null;
- 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 parseEntry
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
PoParser.prototype.parseEntry = function(entry) {
var flags, context, key, value, pluralKey, pluralValues;
flags = pluralValues = [];
context = key = value = pluralKey = null;
Function exports
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
browserify: {
all: {
Function getTranslation
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Translator.prototype.getTranslation = function(domain, context, key, hasPlural) {
if(this.domains && this.domains.hasDomain(domain)) {
var domainTranslations = this.domains.getDomain(domain);
if(domainTranslations.hasTranslation(key)) {
var keyTranslations = domainTranslations.getTranslations(key);
- 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 load
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
LinkProvider.prototype.load = function (defaultDomain, callback) {
var links = this.getValidLinks();
var callbacksRemaining = links.length;
var domainCollection = new DomainCollection();
var adapterCallback = function(partialDomainCollection) {
- 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 translate
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
Translator.prototype.translate = function() {
var args = Array.prototype.slice.call(arguments);
if(args.length > 0) {
// Check, if placeholder values were passed
var stringArgsLength = args.length;
- 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 Translation
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
function Translation(key, value, context, pluralKey, pluralValues, flags) {
Function dcngettext
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Translator.prototype.dcngettext = function(domain, context, singularKey, pluralKey, numericValue, placeholderValues) {
Function Translation
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function Translation(key, value, context, pluralKey, pluralValues, flags) {
if(!key) {
throw new Error('Key of the translation has to be provided.');
}
if(!pluralValues) {
- 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 dngettext
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Translator.prototype.dngettext = function(domain, singularKey, pluralKey, numericValue, placeholderValues) {
Function cngettext
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Translator.prototype.cngettext = function(context, singularKey, pluralKey, numericValue, placeholderValues) {
Function readStrings
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
MoParser.prototype.readStrings = function(dataView, length, offset) {
// Read complete string length into buffer
var buffer = dataView.getBytes(length, offset);
// Check, if the buffer contains multiple strings separated by NULL or EOT bytes.
- 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 doRequest
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
AjaxProvider.prototype.doRequest = function(url, binarySource, callback) {
var request = new XMLHttpRequest();
request.open('GET', url, true);
if(binarySource) {
request.responseType = "arraybuffer";
- 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 extractText
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
PoParser.prototype.extractText = function(lines, startLine, charOffset) {
var line = lines[startLine];
if(line.substring(charOffset) === '""') {
// Multi-line text
var text = "";
- 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 evalPluralFormDefinition
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Translator.prototype.evalPluralFormDefinition = function(n, pluralFormDefinition) {
var nplurals, plural;
try {
// eslint-disable-next-line no-eval
eval(pluralFormDefinition);
- 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 createTranslation
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
MoParser.prototype.createTranslation = function(originalStrings, translatedStrings) {
var key, value, context, pluralKey, pluralValues;
// Extract context
if((originalStrings.length === 3 && translatedStrings.length > 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"