santiiiii/Web-Socket-Router

View on GitHub
Server.js

Summary

Maintainability
C
1 day
Test Coverage

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

   Router.prototype.shouldEventExecute = function (data, evt) {
        if (!this.routify (evt.action).exec(data.action)) {
            return false;
        }
Severity: Major
Found in Server.js and 3 other locations - About 5 hrs to fix
Client.js on lines 620..630
web-socket-router-client.js on lines 623..633
web-socket-router-server.js on lines 461..471

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

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

    Router.prototype.request = function (n, fn, filters) {
        return this.on(n, fn).action(this.action.REQUEST).filters(filters);
    };
Severity: Major
Found in Server.js and 19 other locations - About 1 hr to fix
Client.js on lines 392..394
Client.js on lines 417..419
Client.js on lines 442..444
Client.js on lines 467..469
Client.js on lines 492..494
Server.js on lines 230..232
Server.js on lines 255..257
Server.js on lines 280..282
Server.js on lines 330..332
web-socket-router-client.js on lines 393..395
web-socket-router-client.js on lines 418..420
web-socket-router-client.js on lines 443..445
web-socket-router-client.js on lines 468..470
web-socket-router-client.js on lines 493..495
web-socket-router-server.js on lines 231..233
web-socket-router-server.js on lines 256..258
web-socket-router-server.js on lines 281..283
web-socket-router-server.js on lines 306..308
web-socket-router-server.js on lines 331..333

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

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

    Router.prototype.create = function (n, fn, filters) {
        return this.on(n, fn).action(this.action.CREATE).filters(filters);
    };
Severity: Major
Found in Server.js and 19 other locations - About 1 hr to fix
Client.js on lines 392..394
Client.js on lines 417..419
Client.js on lines 442..444
Client.js on lines 467..469
Client.js on lines 492..494
Server.js on lines 230..232
Server.js on lines 255..257
Server.js on lines 305..307
Server.js on lines 330..332
web-socket-router-client.js on lines 393..395
web-socket-router-client.js on lines 418..420
web-socket-router-client.js on lines 443..445
web-socket-router-client.js on lines 468..470
web-socket-router-client.js on lines 493..495
web-socket-router-server.js on lines 231..233
web-socket-router-server.js on lines 256..258
web-socket-router-server.js on lines 281..283
web-socket-router-server.js on lines 306..308
web-socket-router-server.js on lines 331..333

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

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

    Router.prototype.delete = function (n, fn, filters) {
        return this.on(n, fn).action(this.action.DELETE).filters(filters);
    };
Severity: Major
Found in Server.js and 19 other locations - About 1 hr to fix
Client.js on lines 392..394
Client.js on lines 417..419
Client.js on lines 442..444
Client.js on lines 467..469
Client.js on lines 492..494
Server.js on lines 255..257
Server.js on lines 280..282
Server.js on lines 305..307
Server.js on lines 330..332
web-socket-router-client.js on lines 393..395
web-socket-router-client.js on lines 418..420
web-socket-router-client.js on lines 443..445
web-socket-router-client.js on lines 468..470
web-socket-router-client.js on lines 493..495
web-socket-router-server.js on lines 231..233
web-socket-router-server.js on lines 256..258
web-socket-router-server.js on lines 281..283
web-socket-router-server.js on lines 306..308
web-socket-router-server.js on lines 331..333

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

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

    Router.prototype.update = function (n, fn, filters) {
        return this.on(n, fn).action(this.action.UPDATE).filters(filters);
    };
Severity: Major
Found in Server.js and 19 other locations - About 1 hr to fix
Client.js on lines 392..394
Client.js on lines 417..419
Client.js on lines 442..444
Client.js on lines 467..469
Client.js on lines 492..494
Server.js on lines 230..232
Server.js on lines 280..282
Server.js on lines 305..307
Server.js on lines 330..332
web-socket-router-client.js on lines 393..395
web-socket-router-client.js on lines 418..420
web-socket-router-client.js on lines 443..445
web-socket-router-client.js on lines 468..470
web-socket-router-client.js on lines 493..495
web-socket-router-server.js on lines 231..233
web-socket-router-server.js on lines 256..258
web-socket-router-server.js on lines 281..283
web-socket-router-server.js on lines 306..308
web-socket-router-server.js on lines 331..333

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

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

    Router.prototype.subscribe = function (n, fn, filters) {
        return this.on(n, fn).action(this.action.SUBSCRIBE).filters(filters);
    };
Severity: Major
Found in Server.js and 19 other locations - About 1 hr to fix
Client.js on lines 392..394
Client.js on lines 417..419
Client.js on lines 442..444
Client.js on lines 467..469
Client.js on lines 492..494
Server.js on lines 230..232
Server.js on lines 255..257
Server.js on lines 280..282
Server.js on lines 305..307
web-socket-router-client.js on lines 393..395
web-socket-router-client.js on lines 418..420
web-socket-router-client.js on lines 443..445
web-socket-router-client.js on lines 468..470
web-socket-router-client.js on lines 493..495
web-socket-router-server.js on lines 231..233
web-socket-router-server.js on lines 256..258
web-socket-router-server.js on lines 281..283
web-socket-router-server.js on lines 306..308
web-socket-router-server.js on lines 331..333

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

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

There are no issues that match your filters.

Category
Status