mozilla/webmaker.org

View on GitHub

Showing 111 of 111 total issues

Function navigation has 56 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  return function navigation() {
    var $mainNavContainer = $('#main-navigation-container');
    var lang = $('html').attr('lang') || 'en-US';

    var $expandedNavTriggers = $('.navbar-toggle');
Severity: Major
Found in public/js/base/navigation.js - About 2 hrs to fix

    Function resultsCallback has 55 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          function resultsCallback(err, data, total) {
            var isStickySearch = (searchOptions.tagPrefix === options.stickyPrefix),
              itemString = '',
              frag = document.createElement('div'),
              makerID = $('meta[name=\'maker-id\']').attr('content'),
    Severity: Major
    Found in public/js/base/gallery.js - About 2 hrs to fix

      Function addCSP has 53 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      module.exports.addCSP = function (options) {
        return hood.csp({
          headers: [
            'Content-Security-Policy-Report-Only'
          ],
      Severity: Major
      Found in lib/middleware.js - About 2 hrs to fix

        Function getSvgPlacement has 53 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                function getSvgPlacement(element, placement) {
                    var svgElement = element.closest('svg')[0],
                        domElement = element[0],
                        point = svgElement.createSVGPoint(),
                        boundingBox = domElement.getBBox(),
        Severity: Major
        Found in public/js/lib/jquery.powertip.js - About 2 hrs to fix

          Function powerTip has 51 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              $.fn.powerTip = function(opts, arg) {
                  // don't do any work if there were no matched elements
                  if (!this.length) {
                      return this;
                  }
          Severity: Major
          Found in public/js/lib/jquery.powertip.js - About 2 hrs to fix

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

              var permissionsModel = function (options) {
                var permissions = {
                  'webmaker-super-mentor': {
                    'issue': 3,
                    'applications': 3,
            Severity: Minor
            Found in lib/badges-permissions-model.js - About 1 hr to fix

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

                  emitter.on('application-on', function () {
                    $issueBadgeOn.addClass('hidden');
                    $claimCodContainer.addClass('hidden');
                    $applicationOn.removeClass('hidden');
                    $applicationOff.addClass('hidden');
              Severity: Major
              Found in public/js/pages/badge-detail.js and 3 other locations - About 1 hr to fix
              public/js/pages/badge-detail.js on lines 80..86
              public/js/pages/badge-detail.js on lines 88..94
              public/js/pages/badge-detail.js on lines 96..102

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

              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 4 locations. Consider refactoring.
              Open

                  emitter.on('js-issue-badge-on', function () {
                    $applicationOn.addClass('hidden');
                    $claimCodContainer.addClass('hidden');
                    $issueBadgeOn.removeClass('hidden');
                    $applicationOff.addClass('hidden');
              Severity: Major
              Found in public/js/pages/badge-detail.js and 3 other locations - About 1 hr to fix
              public/js/pages/badge-detail.js on lines 72..78
              public/js/pages/badge-detail.js on lines 80..86
              public/js/pages/badge-detail.js on lines 96..102

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

              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 4 locations. Consider refactoring.
              Open

                  emitter.on('claim-code-button-click', function () {
                    $applicationOn.addClass('hidden');
                    $issueBadgeOn.addClass('hidden');
                    $claimCodContainer.removeClass('hidden');
                    $applicationOff.removeClass('hidden');
              Severity: Major
              Found in public/js/pages/badge-detail.js and 3 other locations - About 1 hr to fix
              public/js/pages/badge-detail.js on lines 72..78
              public/js/pages/badge-detail.js on lines 88..94
              public/js/pages/badge-detail.js on lines 96..102

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

              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 4 locations. Consider refactoring.
              Open

                  emitter.on('application-off', function () {
                    $applicationOn.addClass('hidden');
                    $issueBadgeOn.addClass('hidden');
                    $claimCodContainer.addClass('hidden');
                    $applicationOff.removeClass('hidden');
              Severity: Major
              Found in public/js/pages/badge-detail.js and 3 other locations - About 1 hr to fix
              public/js/pages/badge-detail.js on lines 72..78
              public/js/pages/badge-detail.js on lines 80..86
              public/js/pages/badge-detail.js on lines 88..94

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

              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 link has 46 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      link: function ($scope, $element, $attrs) {
                        var options = [];
                        var lang;
                        for (var i = 0; i < config.supported_languages.length; i++) {
                          lang = config.supported_languages[i];
              Severity: Minor
              Found in public/js/angular/directives.js - About 1 hr to fix

                Function pagination has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  UI.pagination = function (page, total, limit, callback) {
                    var $pagination = $('.pagination'),
                      $ul = $pagination.find('ul'),
                      $li = $('<li></li>'),
                      $pageBtn,
                Severity: Minor
                Found in public/js/base/ui.js - About 1 hr to fix

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

                        $http
                          .get('/data/madewithcode.json')
                          .success(function (data) {
                            $rootScope.madewithcode = data;
                            $rootScope.mwcReady = true;
                  Severity: Major
                  Found in public/js/angular/app.js and 1 other location - About 1 hr to fix
                  public/js/angular/app.js on lines 184..192

                  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

                        $http
                          .get('/data/content.json')
                          .success(function (data) {
                            $rootScope.allContent = data;
                            $rootScope.contentReady = true;
                  Severity: Major
                  Found in public/js/angular/app.js and 1 other location - About 1 hr to fix
                  public/js/angular/app.js on lines 194..202

                  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

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

                    UI.select = function (select, fn) {
                      $('.filter').removeClass('hide');
                  
                      var $el = $('.ui-select', $fragments).clone(true),
                        $toggleBtn = $el.find('.icon'),
                  Severity: Minor
                  Found in public/js/base/ui.js - About 1 hr to fix

                    Function onboardingExperience has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                          function onboardingExperience() {
                            $('#home-start-form').on('submit', function () {
                              $rootScope.joinWebmaker($('.home-email-field').val(), '', $('#onboarding-checkbox').prop('checked'));
                            });
                            var input = $('.onboarding-input');
                    Severity: Minor
                    Found in public/js/angular/controllers.js - About 1 hr to fix

                      Function getHtmlPlacement has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                              function getHtmlPlacement(element, placement) {
                                  var objectOffset = element.offset(),
                                      objectWidth = element.outerWidth(),
                                      objectHeight = element.outerHeight(),
                                      left,
                      Severity: Minor
                      Found in public/js/lib/jquery.powertip.js - About 1 hr to fix

                        Function SocialMedia has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          return function SocialMedia( options ) {
                            var urlPlaceHolder = options.url || "__URL__PLACE__HOLDER__";
                        
                            /**
                             * The various social media all have the same API.
                        Severity: Minor
                        Found in public/js/lib/socialmedia.js - About 1 hr to fix

                          Function process has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              makeClient.process = function (callback, id) {
                                makeClient.then(function (err, data, totalHits) {
                                  if (err) {
                                    return callback(err);
                                  }
                          Severity: Minor
                          Found in lib/makeapi.js - About 1 hr to fix

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

                            module.exports = function (req, res) {
                              var make = require('../lib/makeapi').readOnly,
                                querystring = require('querystring');
                            
                              var DEFAULT_TYPE = 'tags',
                            Severity: Minor
                            Found in routes/search.js - About 1 hr 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

                            Severity
                            Category
                            Status
                            Source
                            Language