public/mozilla-pdf/web/l10n.js

Summary

Maintainability
F
2 wks
Test Coverage

Function webL10n has a Cognitive Complexity of 367 (exceeds 5 allowed). Consider refactoring.
Open

document.webL10n = (function(window, document, undefined) {
  var gL10nData = {};
  var gTextData = '';
  var gTextProp = 'textContent';
  var gLanguage = '';
Severity: Minor
Found in public/mozilla-pdf/web/l10n.js - About 1 wk to fix

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

document.webL10n = (function(window, document, undefined) {
  var gL10nData = {};
  var gTextData = '';
  var gTextProp = 'textContent';
  var gLanguage = '';
Severity: Major
Found in public/mozilla-pdf/web/l10n.js - About 3 days to fix

    Function getPluralRules has 385 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      function getPluralRules(lang) {
        var locales2rules = {
          'af': 3,
          'ak': 4,
          'am': 4,
    Severity: Major
    Found in public/mozilla-pdf/web/l10n.js - About 1 day to fix

      File l10n.js has 779 lines of code (exceeds 250 allowed). Consider refactoring.
      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
      Severity: Major
      Found in public/mozilla-pdf/web/l10n.js - About 1 day to fix

        Function parseResource has 82 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          function parseResource(href, lang, successCallback, failureCallback) {
            var baseURL = href.replace(/[^\/]*$/, '') || './';
        
            // handle escaped characters (backslashes) in a string
            function evalString(text) {
        Severity: Major
        Found in public/mozilla-pdf/web/l10n.js - About 3 hrs to fix

          Function loadLocale has 48 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            function loadLocale(lang, callback) {
              callback = callback || function _callback() {};
          
              clear();
              gLanguage = lang;
          Severity: Minor
          Found in public/mozilla-pdf/web/l10n.js - About 1 hr to fix

            Function parseProperties has 44 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function parseProperties(text) {
                  var dictionary = [];
            
                  // token expressions
                  var reBlank = /^\s*|\s*$/;
            Severity: Minor
            Found in public/mozilla-pdf/web/l10n.js - About 1 hr to fix

              Function translateElement has 34 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                function translateElement(element) {
                  var l10n = getL10nAttributes(element);
                  if (!l10n.id)
                    return;
              
              
              Severity: Minor
              Found in public/mozilla-pdf/web/l10n.js - About 1 hr to fix

                Function parseRawLines has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                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;
                Severity: Minor
                Found in public/mozilla-pdf/web/l10n.js - About 1 hr to fix

                  Avoid deeply nested control flow statements.
                  Open

                              if (found) {
                                children[i].nodeValue = '';
                              } else {
                                children[i].nodeValue = data[gTextProp];
                                found = true;
                  Severity: Major
                  Found in public/mozilla-pdf/web/l10n.js - About 45 mins to fix

                    Avoid too many return statements within this function.
                    Open

                            return 'other';
                    Severity: Major
                    Found in public/mozilla-pdf/web/l10n.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                return 'one';
                      Severity: Major
                      Found in public/mozilla-pdf/web/l10n.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                  return 'one';
                        Severity: Major
                        Found in public/mozilla-pdf/web/l10n.js - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                  return 'other';
                          Severity: Major
                          Found in public/mozilla-pdf/web/l10n.js - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                    return 'other';
                            Severity: Major
                            Found in public/mozilla-pdf/web/l10n.js - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                      return 'other';
                              Severity: Major
                              Found in public/mozilla-pdf/web/l10n.js - About 30 mins to fix

                                There are no issues that match your filters.

                                Category
                                Status