UnitexGramLab/unitexgramlab-org

View on GitHub

Showing 41 of 41 total issues

Function Modernizr has 605 lines of code (exceeds 25 allowed). Consider refactoring.
Open

window.Modernizr = (function( window, document, undefined ) {

    var version = '2.7.1',

    Modernizr = {},
Severity: Major
Found in themes/unitexgramlab/js/modernizr.js - About 3 days to fix

    Function Modernizr has a Cognitive Complexity of 115 (exceeds 5 allowed). Consider refactoring.
    Open

    window.Modernizr = (function( window, document, undefined ) {
    
        var version = '2.7.1',
    
        Modernizr = {},
    Severity: Minor
    Found in themes/unitexgramlab/js/modernizr.js - About 2 days 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 Dropdown has a Cognitive Complexity of 89 (exceeds 5 allowed). Consider refactoring.
    Open

    var Dropdown = (function(){
    
      // the delay, in milliseconds
      var DELAY = 250;
    
    
    Severity: Minor
    Found in themes/unitexgramlab/js/language-dropdown.js - About 1 day 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

    File modernizr.js has 607 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /*!
     * Modernizr v2.7.1
     * www.modernizr.com
     *
     * Copyright (c) Faruk Ates, Paul Irish, Alex Sexton
    Severity: Major
    Found in themes/unitexgramlab/js/modernizr.js - About 1 day to fix

      Function Dropdown has 139 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      var Dropdown = (function(){
      
        // the delay, in milliseconds
        var DELAY = 250;
      
      
      Severity: Major
      Found in themes/unitexgramlab/js/language-dropdown.js - About 5 hrs to fix

        Function searchBar has 139 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          var searchBar = (function() {
            // set options for the control
            var searchBar        = $('.search-bar'),
                searchButton     = $('.search-button'),
                searchButtonIcon = $('.search-button i'),
        Severity: Major
        Found in themes/unitexgramlab/js/jquery.searchbar.js - About 5 hrs to fix

          Function placeholder has 138 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              $.fn.placeholder = function() {
          
                  // Browser natively supports placeholders? Bail.
                      if (typeof (document.createElement('input')).placeholder != 'undefined')
                          return $(this);
          Severity: Major
          Found in themes/unitexgramlab/js/fractal/util.js - About 5 hrs to fix

            Function panel has 133 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                $.fn.panel = function(userConfig) {
            
                    // No elements?
                        if (this.length == 0)
                            return $this;
            Severity: Major
            Found in themes/unitexgramlab/js/fractal/util.js - About 5 hrs to fix

              File util.js has 326 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              (function($) {
              
                  /**
                   * Generate an indented list of links from a nav. Meant for use with panel().
                   * @return {jQuery} jQuery object.
              Severity: Minor
              Found in themes/unitexgramlab/js/fractal/util.js - About 3 hrs to fix

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

                  var releaseLink = (function() {
                
                    function init() {
                      // show '.os-win', '.os-linux', '.os-osx', '.os-other'
                      showClass('.os-' + RELEASE_OS_CLASS);
                Severity: Major
                Found in themes/unitexgramlab/js/unitex/release.js - About 3 hrs to fix

                  Function downloadCarousel has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    var downloadCarousel = (function() {
                      // set options for the control
                      var carousel      = $('.download-carousel'),
                          stable        = $('#icon-version-stable'),
                          stableIcon    = $('#icon-version-stable i'),
                  Severity: Major
                  Found in themes/unitexgramlab/js/custom.js - About 2 hrs to fix

                    Function init has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        var init = function() {
                          searchInput.val("");
                    
                          // show/hide search bar
                          searchButton.click(function(e){
                    Severity: Minor
                    Found in themes/unitexgramlab/js/jquery.searchbar.js - About 1 hr to fix

                      Similar blocks of code found in 2 locations. Consider refactoring.
                      Open

                                      $this.on('click', 'a[href="#' + id + '"]', function(event) {
                      
                                          event.preventDefault();
                                          event.stopPropagation();
                      
                      
                      Severity: Major
                      Found in themes/unitexgramlab/js/fractal/util.js and 1 other location - About 1 hr to fix
                      themes/unitexgramlab/js/fractal/util.js on lines 275..282

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 71.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Similar blocks of code found in 2 locations. Consider refactoring.
                      Open

                                      $body.on('click', 'a[href="#' + id + '"]', function(event) {
                      
                                          event.preventDefault();
                                          event.stopPropagation();
                      
                      
                      Severity: Major
                      Found in themes/unitexgramlab/js/fractal/util.js and 1 other location - About 1 hr to fix
                      themes/unitexgramlab/js/fractal/util.js on lines 258..265

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 71.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Consider simplifying this complex logical expression.
                      Open

                                              if (config.hideOnSwipe) {
                      
                                                  var result = false,
                                                      boundary = 20,
                                                      delta = 50;
                      Severity: Critical
                      Found in themes/unitexgramlab/js/fractal/util.js - About 1 hr to fix

                        Function attachInstallInstructions has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            function attachInstallInstructions(selector) {
                              // show a modal dialog with the install instructions
                              $(selector).on('click', function (event) {
                                var $this = $(this);
                                var url = $('#language-current').attr('hreflang') + '/home/install-instructions';
                        Severity: Minor
                        Found in themes/unitexgramlab/js/unitex/release.js - About 1 hr to fix

                          Function clipboardButton has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          var clipboardButton = (function() {
                            var attach = function(elem) {
                              var clipInit = false;
                              $(elem).each(function () {
                                var code = $(this),
                          Severity: Minor
                          Found in themes/unitexgramlab/js/plugins.js - About 1 hr to fix

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

                              var attach = function(elem) {
                                var clipInit = false;
                                $(elem).each(function () {
                                  var code = $(this),
                                  text = code.text();
                            Severity: Minor
                            Found in themes/unitexgramlab/js/plugins.js - About 1 hr to fix

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

                                  function webforms() {
                                      /*>>input*/
                                      // Run through HTML5's new input attributes to see if the UA understands any.
                                      // We're using f which is the <input> element created early on
                                      // Mike Taylr has created a comprehensive resource for testing these attributes
                              Severity: Minor
                              Found in themes/unitexgramlab/js/modernizr.js - About 1 hr to fix

                                Function stateHandler has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    stateHandler: function() {
                                
                                      var config,
                                        attachments = [],
                                        x, id, s, s1, s2;
                                Severity: Minor
                                Found in themes/unitexgramlab/js/fractal/skel-conditionals.js - About 1 hr to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language