mozilla/webmaker.org

View on GitHub

Showing 59 of 111 total issues

Function exports has 351 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function (env) {
  // Error messages
  var errorHandlers = {
    unauthorized: function () {
      var err = new Error('You must be logged in to access this area.');
Severity: Major
Found in routes/badges.js - About 1 day to fix

    File jquery.powertip.js has 715 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /*!
     PowerTip - v1.2.0 - 2013-04-03
     http://stevenbenner.github.com/jquery-powertip/
     Copyright (c) 2013 Steven Benner (http://stevenbenner.com/).
     Released under MIT license.
    Severity: Major
    Found in public/js/lib/jquery.powertip.js - About 1 day to fix

      File controllers.js has 614 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      angular
        .module('webmakerApp')
        .controller('navigationController', ['$scope', '$location', '$routeParams', '$rootScope', 'weblit', 'wmNav', 'CONFIG',
          function ($scope, $location, $routeParams, $rootScope, weblit, wmNav, config) {
            // Nav data
      Severity: Major
      Found in public/js/angular/controllers.js - About 1 day to fix

        Function exports has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring.
        Open

        module.exports = function (options) {
          var moment = require('moment');
          var MakeClient = require('makeapi-client');
        
          function generateGravatar(hash) {
        Severity: Minor
        Found in lib/makeapi.js - About 7 hrs 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 TooltipController has 197 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function TooltipController(options) {
                var placementCalculator = new PlacementCalculator(),
                    tipElement = $('#' + options.popupId);
        
                // build and append tooltip div if it does not already exist
        Severity: Major
        Found in public/js/lib/jquery.powertip.js - About 7 hrs to fix

          Function Gallery has 174 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              var Gallery = function (options) {
                var self = this;
          
                options = options || {};
                options.mainGallery = options.mainGallery || '.main-gallery';
          Severity: Major
          Found in public/js/base/gallery.js - About 6 hrs to fix

            Function PlacementCalculator has 162 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function PlacementCalculator() {
                    /**
                     * Compute the CSS position to display a tooltip at the specified placement
                     * relative to the specified element.
                     * @private
            Severity: Major
            Found in public/js/lib/jquery.powertip.js - About 6 hrs to fix

              Function exports has 156 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              module.exports = function (grunt) {
                require('time-grunt')(grunt);
                require('jit-grunt')(grunt, {
                  shell: 'grunt-shell-spawn',
                  express: 'grunt-express-server',
              Severity: Major
              Found in Gruntfile.js - About 6 hrs to fix

                File app.js has 406 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                var newrelic;
                if (process.env.NEW_RELIC_HOME) {
                  newrelic = require('newrelic');
                } else {
                  newrelic = {
                Severity: Minor
                Found in app.js - About 5 hrs to fix

                  File badges.js has 355 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  var BadgeClient = require('badgekit-api-client');
                  var async = require('async');
                  
                  module.exports = function (env) {
                    // Error messages
                  Severity: Minor
                  Found in routes/badges.js - About 4 hrs to fix

                    Function exports has 106 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    module.exports = function (options) {
                      return function (req, res, next) {
                        var DEFAULT_PREFIX = 'p',
                          DEFAULT_LAYOUT = 'index',
                          DEFAULT_STICKY_LIMIT = 24, // Larger to account for possible duplicates
                    Severity: Major
                    Found in routes/gallery_old.js - About 4 hrs to fix

                      Function exports has 104 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      module.exports = function (app) {
                        var redirectMap = [{
                          // Switch to SSL after Bug 883370 lands.
                          route: 'http://blog.webmaker.org',
                          paths: [
                      Severity: Major
                      Found in routes/redirect.js - About 4 hrs to fix

                        Function exports has 95 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        module.exports = function (options) {
                          var moment = require('moment');
                          var MakeClient = require('makeapi-client');
                        
                          function generateGravatar(hash) {
                        Severity: Major
                        Found in lib/makeapi.js - About 3 hrs to fix

                          Function exports has 95 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          module.exports = function (req, res) {
                            var make = require('../lib/makeapi').readOnly,
                              querystring = require('querystring');
                          
                            var DEFAULT_TYPE = 'tags',
                          Severity: Major
                          Found in routes/search.js - About 3 hrs to fix

                            Function exports has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                            Open

                            module.exports = function (env) {
                              // Error messages
                              var errorHandlers = {
                                unauthorized: function () {
                                  var err = new Error('You must be logged in to access this area.');
                            Severity: Minor
                            Found in routes/badges.js - About 3 hrs 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 createMakeClient has 82 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              function createMakeClient(url, hawk) {
                                var options = {
                                  apiURL: url
                                };
                                if (hawk) {
                            Severity: Major
                            Found in lib/makeapi.js - About 3 hrs to fix

                              Function details has 76 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  details: function (req, res, next) {
                                    function getBadge(callback) {
                                      badgeClient.getBadge({
                                        system: env.get('BADGES_SYSTEM'),
                                        badge: req.params.badge
                              Severity: Major
                              Found in routes/badges.js - About 3 hrs to fix

                                Function exports has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                module.exports = function (req, res) {
                                  var MAX_REMIXES = 5;
                                  var make = require('../lib/makeapi').authenticated;
                                
                                  function renderError(message) {
                                Severity: Major
                                Found in routes/details.js - About 2 hrs to fix

                                  Function DisplayController has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      function DisplayController(element, options, tipController) {
                                          var hoverTimer = null;
                                  
                                          /**
                                           * Begins the process of showing a tooltip.
                                  Severity: Major
                                  Found in public/js/lib/jquery.powertip.js - About 2 hrs to fix

                                    File directives.js has 266 lines of code (exceeds 250 allowed). Consider refactoring.
                                    Open

                                    angular
                                      .module('webmakerApp')
                                      .directive('wmAffix', ['$window', '$timeout',
                                        function ($window, $timeout) {
                                          return {
                                    Severity: Minor
                                    Found in public/js/angular/directives.js - About 2 hrs to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language