mozilla/webmaker.org

View on GitHub

Showing 111 of 111 total issues

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

      Marquee.prototype = {

        /**
         * Animate in a group of items
         * @param  {number} firstItemIndex
Severity: Major
Found in public/js/angular/directives.js and 1 other location - About 2 days to fix
public/js/base/marquee.js on lines 45..128

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 491.

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

  Marquee.prototype = {

    /**
     * Animate in a group of items
     * @param  {number} firstItemIndex
Severity: Major
Found in public/js/base/marquee.js and 1 other location - About 2 days to fix
public/js/angular/directives.js on lines 167..250

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 491.

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

      function likeClickCallback(e) {
        e.preventDefault();
        e.stopPropagation();
        var $this = $(this),
          makeID = $this.data('make-id'),
Severity: Major
Found in public/js/base/gallery.js and 1 other location - About 2 days to fix
public/js/pages/search.js on lines 68..105

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 362.

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

    function likeClickCallback(e) {
      e.preventDefault();
      e.stopPropagation();
      var $this = $(this),
        makeID = $this.data('make-id'),
Severity: Major
Found in public/js/pages/search.js and 1 other location - About 2 days to fix
public/js/base/gallery.js on lines 83..120

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 362.

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

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

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

      module.exports = function () {
        var make = require('../lib/makeapi').authenticated;
        return {
          report: function (req, res) {
            var id = req.body.makeID,
      Severity: Major
      Found in routes/report.js and 1 other location - About 1 day to fix
      routes/like.js on lines 1..35

      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 291.

      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

      module.exports = function () {
        var make = require('../lib/makeapi').authenticated;
        return {
          like: function (req, res) {
            var id = req.body.makeID,
      Severity: Major
      Found in routes/like.js and 1 other location - About 1 day to fix
      routes/report.js on lines 1..34

      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 291.

      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

      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

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

          var Marquee = function (target, options) {
            var self = this,
              defaults,
              option;
        
        
        Severity: Major
        Found in public/js/base/marquee.js and 1 other location - About 1 day to fix
        public/js/angular/directives.js on lines 130..165

        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 238.

        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

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

              var Marquee = function (target, options) {
                var self = this,
                  defaults,
                  option;
        
        
        Severity: Major
        Found in public/js/angular/directives.js and 1 other location - About 1 day to fix
        public/js/base/marquee.js on lines 8..43

        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 238.

        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

        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

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

                                    if (selectedLang === lang) {
                                      return;
                                      // check if we have any matches and they are exist in the array we have
                                    } else if ((matches && matches[0]) && supportedLanguages.indexOf(matchesLang) !== -1) {
                                      href = href.replace(matches[0], selectedLang);
                  Severity: Major
                  Found in public/js/angular/directives.js and 1 other location - About 4 hrs to fix
                  public/js/pages/localweb.js on lines 120..130

                  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 131.

                  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

                          if (selectedLang === lang) {
                            return;
                            // check if we have any matches and they are exist in the array we have
                          } else if ((matches && matches[0]) && supportedLanguages.indexOf(matchesLang) !== -1) {
                            href = href.replace(matches[0], selectedLang);
                  Severity: Major
                  Found in public/js/pages/localweb.js and 1 other location - About 4 hrs to fix
                  public/js/angular/directives.js on lines 305..315

                  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 131.

                  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

                  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
                    Severity
                    Category
                    Status
                    Source
                    Language