Samisdat/ddns

View on GitHub

Showing 22 of 22 total issues

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

module.exports = function (grunt) {

    var key = require('./key')(grunt);

    var backupConfLocal = function(){
Severity: Major
Found in grunt/lib/server.js - About 5 hrs to fix

    Function config has 110 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    var config = (function() {
    
        var configFilePath = '/ddns/config.json';
    
        var nameServer;
    Severity: Major
    Found in grunt/lib/config.js - About 4 hrs to fix

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

      module.exports = function (grunt) {
      
          var createUpdateMessageScript = function(){
      
              var deferred = q.defer();
      Severity: Major
      Found in grunt/lib/client.js - About 3 hrs to fix

        Function config has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
        Open

        var config = (function() {
        
            var configFilePath = '/ddns/config.json';
        
            var nameServer;
        Severity: Minor
        Found in grunt/lib/config.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

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

            grunt.registerTask('server:add_key', 'add key to local config', function() {
        
                var done = this.async();
        
                server.addKeyToConfLocal()
        Severity: Major
        Found in grunt/server.js and 1 other location - About 3 hrs to fix
        grunt/server.js on lines 11..24

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

        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

            grunt.registerTask('server:create_key', 'create key', function() {
        
                var done = this.async();
        
                server.createKey()
        Severity: Major
        Found in grunt/server.js and 1 other location - About 3 hrs to fix
        grunt/server.js on lines 26..39

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

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

        module.exports = function (grunt) {
        
            var createKeyDir = function(){
                if (true === fs.existsSync('/ddns/key')){
                    return q.resolve();
        Severity: Major
        Found in grunt/lib/key.js - About 3 hrs to fix

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

          module.exports = function (grunt) {
          
              var server = require('./lib/server')(grunt);
          
              grunt.registerTask('server:create_key', 'create key', function() {
          Severity: Major
          Found in grunt/server.js - About 2 hrs to fix

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

            var writeFile = function(file, data){
            
                var deferred = q.defer();
            
                fs.writeFile(
            Severity: Major
            Found in grunt/lib/qfs.js and 1 other location - About 2 hrs to fix
            grunt/lib/qfs.js on lines 169..188

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

            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

            var appendFile = function(file, data){
            
                var deferred = q.defer();
            
                fs.appendFile(
            Severity: Major
            Found in grunt/lib/qfs.js and 1 other location - About 2 hrs to fix
            grunt/lib/qfs.js on lines 129..148

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

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

            var promiseToExec = function(gruntLog, cmd, message, timeout, debug){
            
                var deferred = q.defer();
            
                if (undefined === gruntLog){
            Severity: Major
            Found in grunt/lib/qexec.js - About 2 hrs to fix

              Function createUpdateMessageScript has 47 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  var createUpdateMessageScript = function(){
              
                      var deferred = q.defer();
              
                      qfs.fileExists('/ddns/client/create-update-message.sh')
              Severity: Minor
              Found in grunt/lib/client.js - About 1 hr to fix

                Function firstSetup has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    var firstSetup = function(nameServer, domains){
                
                        var deferred = q.defer();
                
                
                
                Severity: Minor
                Found in grunt/lib/server.js - About 1 hr to fix

                  Function readKey has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      var readKey = function(){
                          var deferred = q.defer();
                  
                          qfs.readdir('/ddns/key')
                          .then(function(files){
                  Severity: Minor
                  Found in grunt/lib/key.js - About 1 hr to fix

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

                            for (var i = 0, x = zones.length; i < x; i += 1){
                                if (zone === zones[i]){
                                    alreadyExists = true;
                                    break;
                                }
                    Severity: Major
                    Found in grunt/lib/config.js and 1 other location - About 1 hr to fix
                    grunt/lib/config.js on lines 103..108

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

                    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

                            for (var i = 0, x = zones.length; i < x; i += 1){
                                if (zone === zones[i]){
                                    alreadyExists = true;
                                    break;
                                }
                    Severity: Major
                    Found in grunt/lib/config.js and 1 other location - About 1 hr to fix
                    grunt/lib/config.js on lines 88..93

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

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

                        var createClient = function(){
                    
                            var deferred = q.defer();
                            qexec(grunt.log, 'mkdir -p /ddns/client', 'create dir for client', 0, true)
                            .then(function () {
                    Severity: Minor
                    Found in grunt/lib/client.js - About 1 hr to fix

                      Function promiseToExec has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                      var promiseToExec = function(gruntLog, cmd, message, timeout, debug){
                      
                          var deferred = q.defer();
                      
                          if (undefined === gruntLog){
                      Severity: Minor
                      Found in grunt/lib/qexec.js - About 45 mins 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 promiseToExec has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                      var promiseToExec = function(gruntLog, cmd, message, timeout, debug){
                      Severity: Minor
                      Found in grunt/lib/qexec.js - About 35 mins to fix

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

                            return {
                                removeConfLocal: removeConfLocal,
                                createConfLocal: createConfLocal,
                                backupConfLocal: backupConfLocal,
                                addKeyToConfLocal: addKeyToConfLocal,
                        Severity: Minor
                        Found in grunt/lib/server.js and 1 other location - About 35 mins to fix
                        grunt/lib/qfs.js on lines 208..218

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

                        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

                        Severity
                        Category
                        Status
                        Source
                        Language