bq/corbel-js

View on GitHub
src/iam/usersBuilder.js

Summary

Maintainability
F
5 days
Test Coverage

File usersBuilder.js has 306 lines of code (exceeds 250 allowed). Consider refactoring.
Open

//@exclude
// jshint unused: false
'use strict';
//@endexclude

Severity: Minor
Found in src/iam/usersBuilder.js - About 3 hrs to fix

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

            _deleteGroup: function(group) {
                console.log('iamInterface.user.deleteGroup');
                corbel.validate.values(['id', 'group'], {
                    'id':this.id,
                    'group': group
    Severity: Major
    Found in src/iam/usersBuilder.js and 2 other locations - About 4 hrs to fix
    src/iam/usersBuilder.js on lines 248..258
    src/iam/usersBuilder.js on lines 283..293

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

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

             _deleteDevice: function(deviceId) {
                 console.log('iamInterface.user.deleteDevice');
                 corbel.validate.values(['id', 'deviceId'], {
                     'id':this.id,
                     'deviceId': deviceId
    Severity: Major
    Found in src/iam/usersBuilder.js and 2 other locations - About 4 hrs to fix
    src/iam/usersBuilder.js on lines 248..258
    src/iam/usersBuilder.js on lines 334..344

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

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

             _getDevice: function(deviceId) {
                console.log('iamInterface.user.getDevice');
                corbel.validate.values(['id', 'deviceId'], {
                    'id':this.id,
                    'deviceId': deviceId
    Severity: Major
    Found in src/iam/usersBuilder.js and 2 other locations - About 4 hrs to fix
    src/iam/usersBuilder.js on lines 283..293
    src/iam/usersBuilder.js on lines 334..344

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

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

            create: function(data) {
                console.log('iamInterface.users.create', data);
                return this.request({
                    url: this._buildUriWithDomain(this.uri),
                    method: corbel.request.method.POST,
    Severity: Major
    Found in src/iam/usersBuilder.js and 7 other locations - About 3 hrs to fix
    src/borrow/borrowBuilder.js on lines 42..51
    src/borrow/lenderBuilder.js on lines 39..48
    src/ec/productBuilder.js on lines 61..71
    src/iam/clientBuilder.js on lines 55..64
    src/iam/domainBuilder.js on lines 48..57
    src/notifications/notificationsDomainBuilder.js on lines 27..37
    src/notifications/notificationsTemplateBuilder.js on lines 30..40

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

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

            _closeSessions: function() {
                console.log('iamInterface.user.close.sessions');
                corbel.validate.value('id', this.id);
                return this.request({
                    url: this._buildUriWithDomain(this.uri, this.id) + '/session',
    Severity: Major
    Found in src/iam/usersBuilder.js and 5 other locations - About 3 hrs to fix
    src/iam/usersBuilder.js on lines 125..132
    src/iam/usersBuilder.js on lines 140..147
    src/iam/usersBuilder.js on lines 155..162
    src/iam/usersBuilder.js on lines 206..213
    src/iam/usersBuilder.js on lines 301..308

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

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

            _getIdentities: function() {
                console.log('iamInterface.user.getIdentities');
                corbel.validate.value('id', this.id);
                return this.request({
                    url: this._buildUriWithDomain(this.uri, this.id) + '/identity',
    Severity: Major
    Found in src/iam/usersBuilder.js and 5 other locations - About 3 hrs to fix
    src/iam/usersBuilder.js on lines 125..132
    src/iam/usersBuilder.js on lines 140..147
    src/iam/usersBuilder.js on lines 155..162
    src/iam/usersBuilder.js on lines 171..178
    src/iam/usersBuilder.js on lines 301..308

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

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

            _signOut: function() {
                console.log('iamInterface.users.signOutMe');
                corbel.validate.value('id', this.id);
                return this.request({
                    url: this._buildUriWithDomain(this.uri, this.id) + '/signout',
    Severity: Major
    Found in src/iam/usersBuilder.js and 5 other locations - About 3 hrs to fix
    src/iam/usersBuilder.js on lines 140..147
    src/iam/usersBuilder.js on lines 155..162
    src/iam/usersBuilder.js on lines 171..178
    src/iam/usersBuilder.js on lines 206..213
    src/iam/usersBuilder.js on lines 301..308

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

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

            _getSession: function() {
                console.log('iamInterface.user.get.session');
                corbel.validate.value('id', this.id);
                return this.request({
                    url: this._buildUriWithDomain(this.uri, this.id) + '/session',
    Severity: Major
    Found in src/iam/usersBuilder.js and 5 other locations - About 3 hrs to fix
    src/iam/usersBuilder.js on lines 125..132
    src/iam/usersBuilder.js on lines 140..147
    src/iam/usersBuilder.js on lines 171..178
    src/iam/usersBuilder.js on lines 206..213
    src/iam/usersBuilder.js on lines 301..308

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

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

            _disconnect: function() {
                console.log('iamInterface.user.disconnect');
                corbel.validate.value('id', this.id);
                return this.request({
                    url: this._buildUriWithDomain(this.uri, this.id) + '/disconnect',
    Severity: Major
    Found in src/iam/usersBuilder.js and 5 other locations - About 3 hrs to fix
    src/iam/usersBuilder.js on lines 125..132
    src/iam/usersBuilder.js on lines 155..162
    src/iam/usersBuilder.js on lines 171..178
    src/iam/usersBuilder.js on lines 206..213
    src/iam/usersBuilder.js on lines 301..308

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

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

            _getProfile: function() {
                console.log('iamInterface.user.getProfile');
                corbel.validate.value('id', this.id);
                return this.request({
                    url: this._buildUriWithDomain(this.uri, this.id) + '/profile',
    Severity: Major
    Found in src/iam/usersBuilder.js and 5 other locations - About 3 hrs to fix
    src/iam/usersBuilder.js on lines 125..132
    src/iam/usersBuilder.js on lines 140..147
    src/iam/usersBuilder.js on lines 155..162
    src/iam/usersBuilder.js on lines 171..178
    src/iam/usersBuilder.js on lines 206..213

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

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

                return this.request({
                    url: this._buildUriWithDomain(this.uri),
                    method: corbel.request.method.GET,
                    query: params ? corbel.utils.serializeParams(params) : null
                });
    Severity: Major
    Found in src/iam/usersBuilder.js and 2 other locations - About 1 hr to fix
    src/ec/productBuilder.js on lines 90..94
    src/iam/clientBuilder.js on lines 97..101

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

    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 this.request({
                    url: this._buildUriWithDomain(this.uri, this.id) + '/identity',
                    method: corbel.request.method.POST,
                    data: identity
                });
    Severity: Major
    Found in src/iam/usersBuilder.js and 1 other location - About 1 hr to fix
    src/iam/usersBuilder.js on lines 320..324

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

    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 this.request({
                    url: this._buildUriWithDomain(this.uri, this.id) + '/group',
                    method: corbel.request.method.PUT,
                    data: groups
                });
    Severity: Major
    Found in src/iam/usersBuilder.js and 1 other location - About 1 hr to fix
    src/iam/usersBuilder.js on lines 193..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 60.

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

         corbel.Iam.prototype.users = function() {
             var builder =  new UsersBuilder();
    
             builder.driver = this.driver;
             return builder;
    Severity: Major
    Found in src/iam/usersBuilder.js and 5 other locations - About 1 hr to fix
    src/ec/paymentBuilder.js on lines 12..16
    src/ec/paymentMethodsBuilder.js on lines 12..16
    src/ec/purchaseBuilder.js on lines 12..16
    src/iam/domainBuilder.js on lines 12..16
    src/iam/usernameBuilder.js on lines 11..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 56.

    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