jonniespratley/angular-cms

View on GitHub

Showing 73 of 73 total issues

File markdown.js has 999 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// Released under MIT license
// Copyright (c) 2009-2010 Dominic Baggott
// Copyright (c) 2009-2010 Ash Berlin
// Copyright (c) 2011 Christoph Dorn <christoph@christophdorn.com> (http://www.christophdorn.com)

Severity: Major
Found in app/libs/markdown.js - About 2 days to fix

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

    module.exports = function(grunt) {
    
        //Connect proxy to route requests to localhost:8181/api
        //require('json-proxy').initialize({});
        require('load-grunt-tasks')(grunt);
    Severity: Major
    Found in Gruntfile.js - About 2 days to fix

      File Gruntfile.js has 506 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /* jshint camelcase:false */
      'use strict';
      var fs = require('fs'),
          express = require('express'),
          cmsRouter = require('./routes/cms-router.js'),
      Severity: Major
      Found in Gruntfile.js - About 1 day to fix

        Function MD5 has 195 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        var MD5 = function(string) {
        
            function RotateLeft(lValue, iShiftBits) {
                return (lValue << iShiftBits) | (lValue >>> (32 - iShiftBits));
            }
        Severity: Major
        Found in app/libs/md5.js - About 7 hrs to fix

          Function cmsPassport has 178 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          var cmsPassport = function(config, app) {
          
              var user = new User();
          
              if (!app) {
          Severity: Major
          Found in routes/cms-passport.js - About 7 hrs to fix

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

                lists: (function( ) {
                  // Use a closure to hide a few variables.
                  var any_list = "[*+-]|\\d+\\.",
                      bullet_list = /[*+-]/,
                      number_list = /\d+\./,
            Severity: Major
            Found in app/libs/markdown.js - About 6 hrs to fix

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

                  case "link_ref":
                    jsonml[ 0 ] = "a";
              
                    // grab this ref and clean up the attribute node
                    var ref = references[ attrs.ref ];
              Severity: Major
              Found in app/libs/markdown.js and 1 other location - About 4 hrs to fix
              app/libs/markdown.js on lines 1535..1558

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

              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

                  case "img_ref":
                    jsonml[ 0 ] = "img";
              
                    // grab this ref and clean up the attribute node
                    var ref = references[ attrs.ref ];
              Severity: Major
              Found in app/libs/markdown.js and 1 other location - About 4 hrs to fix
              app/libs/markdown.js on lines 1511..1534

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

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

              module.exports = function (config, app) {
              
                  console.log('cms-upload intialized');
              
              
              
              Severity: Major
              Found in routes/cms-upload.js - About 4 hrs to fix

                Function convert_tree_to_html has 102 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function convert_tree_to_html( tree, references, options ) {
                  var i;
                  options = options || {};
                
                  // shallow clone
                Severity: Major
                Found in app/libs/markdown.js - About 4 hrs to fix

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

                      init: function (app) {
                          var self = this;
                  
                          io = sio.listen( app );
                          io.sockets.on( 'connection', function (socket) {
                  Severity: Major
                  Found in routes/socketserver.js - About 3 hrs to fix

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

                            fs.readFile(localPath, 'utf8', function(err, data) {
                                if (err) {
                                    req.end('There was an error.');
                                    return console.log(err);
                                } else {
                    Severity: Major
                    Found in routes/rest.js and 1 other location - About 3 hrs to fix
                    routes/rest.js on lines 219..232

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

                    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

                        fs.readFile(localPath, 'utf8', function(err, data) {
                            if (err) {
                                res.end('There was an error.');
                                return console.log(err);
                            } else {
                    Severity: Major
                    Found in routes/rest.js and 1 other location - About 3 hrs to fix
                    routes/rest.js on lines 192..204

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

                    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 MD5 has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                    Open

                    var MD5 = function(string) {
                    
                        function RotateLeft(lValue, iShiftBits) {
                            return (lValue << iShiftBits) | (lValue >>> (32 - iShiftBits));
                        }
                    Severity: Minor
                    Found in app/libs/md5.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 exports has 76 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    module.exports = function(config, app){
                        // define the schema for our user model
                        this.Schema = {
                            id: String,
                            provider: String,
                    Severity: Major
                    Found in routes/models/user.js - About 3 hrs to fix

                      Function cmsAuth has 71 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      var cmsAuth = function(config, app) {
                          console.warn('cms-auth initialized');
                      
                          //### hashPassword
                          //Hash password using basic sha1 hash.
                      Severity: Major
                      Found in routes/cms-auth.js - About 2 hrs to fix

                        Function app has 70 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        var app = angular.module('angularCmsApp', ['ngCookies', 'ngResource', 'ngSanitize', 'ngRoute', 'ngAnimate', 'mgcrea.ngStrap', 'fg']).config(function ($routeProvider) {
                            var routeResolver;
                            routeResolver = {
                                delay: function ($q, $timeout) {
                                    var delay;
                        Severity: Major
                        Found in app/scripts/app.js - About 2 hrs to fix

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

                                  if ( m[2] && m[2][0] == '<' && m[2][m[2].length-1] == '>' )
                                    m[2] = m[2].substring( 1, m[2].length - 1 );
                          Severity: Major
                          Found in app/libs/markdown.js and 1 other location - About 2 hrs to fix
                          app/libs/markdown.js on lines 820..821

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

                          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

                                  if ( m[2] && m[2][0] == '<' && m[2][m[2].length-1] == '>' )
                                    m[2] = m[2].substring( 1, m[2].length - 1 );
                          Severity: Major
                          Found in app/libs/markdown.js and 1 other location - About 2 hrs to fix
                          app/libs/markdown.js on lines 715..716

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

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

                              var upload = function (req, res, next) {
                                  var appid = 'public';
                          
                                  if (req.param( 'appid' )) {
                                      appid = String( req.param( 'appid' ) );
                          Severity: Major
                          Found in routes/cms-upload.js - About 2 hrs to fix
                            Severity
                            Category
                            Status
                            Source
                            Language