emotionLoop/jsCode

View on GitHub

Showing 55 of 55 total issues

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

exports = module.exports = function() {

  var settings = [];

  settings.push({
Severity: Major
Found in app/models/settings.js - About 5 days to fix

    File settings.js has 1097 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    
    // # settings
    
    var _ = require( 'underscore' );
    
    
    Severity: Major
    Found in app/models/settings.js - About 2 days to fix

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

      exports = module.exports = function( mongoose, iglooMongoosePlugin, settings ) {
      
        var Package = new mongoose.Schema({
          slug: {
            type: String
      Severity: Minor
      Found in app/models/package.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

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

      exports = module.exports = function( mongoose, iglooMongoosePlugin, settings ) {
      
        var Package = new mongoose.Schema({
          slug: {
            type: String
      Severity: Major
      Found in app/models/package.js - About 1 day to fix

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

          function toggleHelper( event ) {
            /*jshint validthis: true */
            event.preventDefault();
        
            var $this = $( this );
        Severity: Major
        Found in assets/public/js/package.js and 1 other location - About 7 hrs to fix
        assets/public/js/home.js on lines 176..203

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

        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 toggleHelper( event ) {
            /*jshint validthis: true */
            event.preventDefault();
        
            var $this = $( this );
        Severity: Major
        Found in assets/public/js/home.js and 1 other location - About 7 hrs to fix
        assets/public/js/package.js on lines 32..59

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

        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

          function getGroupedSettings() {
            var groupedSettings = [];
            var lastGroup = {
                name: '',
                settings: []
        Severity: Major
        Found in app/controllers/home.js and 1 other location - About 6 hrs to fix
        app/controllers/settings.js on lines 37..62

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

        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

          function getGroupedSettings() {
            var groupedSettings = [];
            var lastGroup = {
                name: '',
                settings: []
        Severity: Major
        Found in app/controllers/settings.js and 1 other location - About 6 hrs to fix
        app/controllers/home.js on lines 71..96

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

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

        exports = module.exports = function() {
        
          return {
        
            defaults: {
        Severity: Major
        Found in boot/config.js - About 5 hrs to fix

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

          exports = module.exports = function( Package ) {
          
            // Get 5 most popular packages
            function popular( req, res, next ) {
              req.query.limit = 5;
          Severity: Major
          Found in app/controllers/packages.js - About 5 hrs to fix

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

              function toggleBadges( event ) {
                /*jshint validthis: true */
                event.preventDefault();
            
                var $this = $( this );
            Severity: Major
            Found in assets/public/js/main.js and 1 other location - About 4 hrs to fix
            assets/public/js/main.js on lines 106..127

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

            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 toggleSharing( event ) {
                /*jshint validthis: true */
                event.preventDefault();
            
                var $this = $( this );
            Severity: Major
            Found in assets/public/js/main.js and 1 other location - About 4 hrs to fix
            assets/public/js/main.js on lines 130..151

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

            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

                $('.helper .sample-code').each( function() {
                  var $this = $( this );
                  var code = $this.html().replace( /^\r\n|\r|\n/, '' ).replace( /(&)/g, '&' );
                  var highlightedCode = hljs.highlight( 'javascript', code, true );
            
            
            Severity: Major
            Found in assets/public/js/home.js and 1 other location - About 4 hrs to fix
            assets/public/js/package.js on lines 7..15

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

            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

                $('.sample-code').each( function() {
                  var $this = $( this );
                  var code = $this.html().replace( /^\r\n|\r|\n/, '' ).replace( /(&)/g, '&' );
                  var highlightedCode = hljs.highlight( 'javascript', code, true );
            
            
            Severity: Major
            Found in assets/public/js/package.js and 1 other location - About 4 hrs to fix
            assets/public/js/home.js on lines 14..22

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

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

              function getSampleCode( convertedSettings ) {
                // If there are no settings, return an empty string
                if ( convertedSettings.length === 0 ) {
                  return '';
                }
            Severity: Major
            Found in app/models/package.js - About 3 hrs to fix

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

              exports = module.exports = function( Package, settings ) {
              
                function home( req, res, next ) {
                  var popularPackages = [];
                  var latestPackages = [];
              Severity: Major
              Found in app/controllers/home.js - About 2 hrs to fix

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

                      function fetchPopularPackages( callback ) {
                        Package
                          .find()
                          .limit( 5 )
                          .sort( '-views' )
                Severity: Major
                Found in app/controllers/home.js and 1 other location - About 2 hrs to fix
                app/controllers/home.js on lines 31..45

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

                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 fetchLatestPackages( callback ) {
                        Package
                          .find()
                          .limit( 5 )
                          .sort( '-created_at' )
                Severity: Major
                Found in app/controllers/home.js and 1 other location - About 2 hrs to fix
                app/controllers/home.js on lines 14..28

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

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

                  function getJSHintCode( convertedSettings ) {
                    // If there are no settings, return an empty string
                    if ( convertedSettings.length === 0 ) {
                      return '';
                    }
                Severity: Minor
                Found in app/models/package.js - About 1 hr to fix

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

                  exports = module.exports = function( settings ) {
                  
                    function index( req, res, next ) {
                        res.format({
                          html: function() {
                  Severity: Minor
                  Found in app/controllers/settings.js - About 1 hr to fix
                    Severity
                    Category
                    Status
                    Source
                    Language