phodal/diaonan

View on GitHub

Showing 191 of 191 total issues

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

    mqtt.createServer(app.controllers.mqtt_api).listen(opts.mqtt, function () {
        console.log("oap-mqtt-rest mqtt server listening on port %d in %s mode", opts.mqtt, app.settings.env);
        return done();
    });
Severity: Major
Found in diaonan.js and 1 other location - About 1 hr to fix
diaonan.js on lines 189..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 68.

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

    coap.createServer(app.controllers.coap_api).listen(opts.coap, function () {
        console.log("coap-mqtt-rest coap server listening on port %d in %s mode", opts.coap, app.settings.env);
        return done();
    });
Severity: Major
Found in diaonan.js and 1 other location - About 1 hr to fix
diaonan.js on lines 194..197

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

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

        unsubscribeAll = function () {
            var listener, topic, _results;
            _results = [];
            for (topic in listeners) {
                listener = listeners[topic];
Severity: Major
Found in app/controllers/mqtt_api.js and 1 other location - About 1 hr to fix
app/controllers/websocket_api.js on lines 20..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 68.

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

        return socket.on('disconnect', function () {
            var listener, topic, _results;
            _results = [];
            for (topic in subscriptions) {
                listener = subscriptions[topic];
Severity: Major
Found in app/controllers/websocket_api.js and 1 other location - About 1 hr to fix
app/controllers/mqtt_api.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 68.

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

    val: function( value ) {
        var hooks, ret, isFunction,
            elem = this[0];

        if ( !arguments.length ) {
Severity: Minor
Found in app/assets/js/jquery-1.8.2.js - About 1 hr to fix

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

    function Sizzle( selector, context, results, seed ) {
        results = results || [];
        context = context || document;
        var match, elem, xml, m,
            nodeType = context.nodeType;
    Severity: Minor
    Found in app/assets/js/jquery-1.8.2.js - About 1 hr to fix

      Function extend has 40 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      jQuery.extend = jQuery.fn.extend = function() {
          var options, name, src, copy, copyIsArray, clone,
              target = arguments[0] || {},
              i = 1,
              length = arguments.length,
      Severity: Minor
      Found in app/assets/js/jquery-1.8.2.js - About 1 hr to fix

        Function on has 40 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            on: function( types, selector, data, fn, /*INTERNAL*/ one ) {
                var origFn, type;
        
                // Types can be a map of types/handlers
                if ( typeof types === "object" ) {
        Severity: Minor
        Found in app/assets/js/jquery-1.8.2.js - About 1 hr to fix

          Function stop has 40 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              stop: function( type, clearQueue, gotoEnd ) {
                  var stopQueue = function( hooks ) {
                      var stop = hooks.stop;
                      delete hooks.stop;
                      stop( gotoEnd );
          Severity: Minor
          Found in app/assets/js/jquery-1.8.2.js - About 1 hr to fix

            Function tokenize has 39 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function tokenize( selector, parseOnly ) {
                var matched, match, tokens, type, soFar, groups, preFilters,
                    cached = tokenCache[ expando ][ selector ];
            
                if ( cached ) {
            Severity: Minor
            Found in app/assets/js/jquery-1.8.2.js - About 1 hr to fix

              Function next has 39 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              next:function () {
                      if (this.done) {
                          return this.EOF;
                      }
                      if (!this._input) this.done = true;
              Severity: Minor
              Found in app/assets/js/jsonlint.js - About 1 hr to fix

                Function load has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                jQuery.fn.load = function( url, params, callback ) {
                    if ( typeof url !== "string" && _load ) {
                        return _load.apply( this, arguments );
                    }
                
                
                Severity: Minor
                Found in app/assets/js/jquery-1.8.2.js - About 1 hr to fix

                  Function find has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      Data.find = function (pattern, callback) {
                          var foundRecord;
                          foundRecord = function (key) {
                              return app.redis.client.get(buildKey(key), function (err, value) {
                                  if (err) {
                  Severity: Minor
                  Found in app/models/data.js - About 1 hr to fix

                    Function when has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        when: function( subordinate /* , ..., subordinateN */ ) {
                            var i = 0,
                                resolveValues = core_slice.call( arguments ),
                                length = resolveValues.length,
                    
                    
                    Severity: Minor
                    Found in app/assets/js/jquery-1.8.2.js - About 1 hr to fix

                      Function slide has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        , slide: function (type, next) {
                            var $active = this.$element.find('.item.active')
                              , $next = next || $active[type]()
                              , isCycling = this.interval
                              , direction = type == 'next' ? 'left' : 'right'
                      Severity: Minor
                      Found in app/assets/js/bootstrap/bootstrap-carousel.js - About 1 hr to fix

                        Function attr has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            attr: function( elem, name, value, pass ) {
                                var ret, hooks, notxml,
                                    nType = elem.nodeType;
                        
                                // don't get/set attributes on text, comment and attribute nodes
                        Severity: Minor
                        Found in app/assets/js/jquery-1.8.2.js - About 1 hr to fix

                          Function showHide has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          function showHide( elements, show ) {
                              var elem, display,
                                  values = [],
                                  index = 0,
                                  length = elements.length;
                          Severity: Minor
                          Found in app/assets/js/jquery-1.8.2.js - About 1 hr to fix

                            Function each has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                each: function( obj, callback, args ) {
                                    var name,
                                        i = 0,
                                        length = obj.length,
                                        isObj = length === undefined || jQuery.isFunction( obj );
                            Severity: Minor
                            Found in app/assets/js/jquery-1.8.2.js - About 1 hr to fix

                              Function access has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  access: function( elems, fn, key, value, chainable, emptyGet, pass ) {
                                      var exec,
                                          bulk = key == null,
                                          i = 0,
                                          length = elems.length;
                              Severity: Minor
                              Found in app/assets/js/jquery-1.8.2.js - About 1 hr to fix

                                Function cleanData has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    cleanData: function( elems, /* internal */ acceptData ) {
                                        var data, id, elem, type,
                                            i = 0,
                                            internalKey = jQuery.expando,
                                            cache = jQuery.cache,
                                Severity: Minor
                                Found in app/assets/js/jquery-1.8.2.js - About 1 hr to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language