public/mozilla-pdf/web/l10n.js
Function webL10n
has a Cognitive Complexity of 367 (exceeds 5 allowed). Consider refactoring. Open
Open
document.webL10n = (function(window, document, undefined) {
var gL10nData = {};
var gTextData = '';
var gTextProp = 'textContent';
var gLanguage = '';
- 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 webL10n
has 776 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
document.webL10n = (function(window, document, undefined) {
var gL10nData = {};
var gTextData = '';
var gTextProp = 'textContent';
var gLanguage = '';
Function getPluralRules
has 385 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function getPluralRules(lang) {
var locales2rules = {
'af': 3,
'ak': 4,
'am': 4,
File l10n.js
has 779 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/**
* Copyright (c) 2011-2013 Fabien Cazenave, Mozilla.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
Function parseResource
has 82 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function parseResource(href, lang, successCallback, failureCallback) {
var baseURL = href.replace(/[^\/]*$/, '') || './';
// handle escaped characters (backslashes) in a string
function evalString(text) {
Function loadLocale
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function loadLocale(lang, callback) {
callback = callback || function _callback() {};
clear();
gLanguage = lang;
Function parseProperties
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function parseProperties(text) {
var dictionary = [];
// token expressions
var reBlank = /^\s*|\s*$/;
Function translateElement
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function translateElement(element) {
var l10n = getL10nAttributes(element);
if (!l10n.id)
return;
Function parseRawLines
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function parseRawLines(rawText, extendedSyntax) {
var entries = rawText.replace(reBlank, '').split(/[\r\n]+/);
var currentLang = '*';
var genericLang = lang.replace(/-[a-z]+$/i, '');
var skipLang = false;
Avoid deeply nested control flow statements. Open
Open
if (found) {
children[i].nodeValue = '';
} else {
children[i].nodeValue = data[gTextProp];
found = true;
Avoid too many return
statements within this function. Open
Open
return 'other';
Avoid too many return
statements within this function. Open
Open
return 'one';
Avoid too many return
statements within this function. Open
Open
return 'one';
Avoid too many return
statements within this function. Open
Open
return 'other';
Avoid too many return
statements within this function. Open
Open
return 'other';
Avoid too many return
statements within this function. Open
Open
return 'other';