talho/openphin

View on GitHub
app/assets/javascripts/search/FindPeople.js

Summary

Maintainability
F
5 days
Test Coverage

Function constructor has 243 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  constructor: function(config){
    Talho.FindPeople.superclass.constructor.call(this, config);

    this.admin_mode = config.admin_mode;
    this.rolesStore = new Ext.data.JsonStore({
Severity: Major
Found in app/assets/javascripts/search/FindPeople.js - About 1 day to fix

    File FindPeople.js has 338 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    Ext.ns('Talho');
    
    Talho.FindPeople = Ext.extend(Ext.util.Observable, {
      constructor: function(config){
        Talho.FindPeople.superclass.constructor.call(this, config);
    Severity: Minor
    Found in app/assets/javascripts/search/FindPeople.js - About 4 hrs to fix

      Function constructor has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

        constructor: function(config){
          Talho.FindPeople.superclass.constructor.call(this, config);
      
          this.admin_mode = config.admin_mode;
          this.rolesStore = new Ext.data.JsonStore({
      Severity: Minor
      Found in app/assets/javascripts/search/FindPeople.js - About 1 hr 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 handleError has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

        handleError: function(proxy, type, action, options, response, arg){
      Severity: Minor
      Found in app/assets/javascripts/search/FindPeople.js - About 45 mins to fix

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

          show_err_message: function(json) {
            var w = 300;
            var msg = '<b>Server Error:</b> ' + json.error + '<br>';
            if (json.exception != null) {
              w = 900;
        Severity: Major
        Found in app/assets/javascripts/search/FindPeople.js and 1 other location - About 1 day to fix
        app/assets/javascripts/profile/ProfileBase.js on lines 134..146

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

        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

          ajax_err_cb: function(response, opts) {
            var msg = '<b>Status: ' + response.status + ' => ' + response.statusText + '</b><br><br>' +
              '<div style="height:400px;overflow:scroll;">' + response.responseText + '<\div>';
            Ext.Msg.show({title: 'Error', msg: msg, minWidth: 900, maxWidth: 900, buttons: Ext.Msg.OK, icon: Ext.Msg.ERROR});
          },
        Severity: Major
        Found in app/assets/javascripts/search/FindPeople.js and 1 other location - About 3 hrs to fix
        app/assets/javascripts/profile/ProfileBase.js on lines 154..158

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

        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

            this.rolesList.on('selectionchange', function(view, nodes){
              var l = nodes.length;
              if (l == 0) { l = 'none'}
              var hdrText = 'Roles: <i>('+l+' selected)</i>';
              this.rolesSelector.getTopToolbar().find('name', 'hdr')[0].setText(hdrText);
        Severity: Major
        Found in app/assets/javascripts/search/FindPeople.js and 1 other location - About 3 hrs to fix
        app/assets/javascripts/search/FindPeople.js on lines 260..265

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

        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

            this.jurisList.on('selectionchange', function(view, nodes){
              var l = nodes.length;
              if (l == 0) { l = 'none'}
              var hdrText = 'Jurisdictions: <i>('+l+' selected)</i>';
              this.jurisSelector.getTopToolbar().find('name', 'hdr')[0].setText(hdrText);
        Severity: Major
        Found in app/assets/javascripts/search/FindPeople.js and 1 other location - About 3 hrs to fix
        app/assets/javascripts/search/FindPeople.js on lines 253..258

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

        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

            this.rolesList = new Ext.list.ListView({
              store: this.rolesStore,
              multiSelect: true,
              simpleSelect: true,
              columnSort: false,
        Severity: Major
        Found in app/assets/javascripts/search/FindPeople.js and 1 other location - About 3 hrs to fix
        app/assets/javascripts/search/FindPeople.js on lines 54..65

        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

            this.jurisList = new Ext.list.ListView({
              store: this.jurisdictionsStore,
              multiSelect: true,
              simpleSelect: true,
              columnSort: false,
        Severity: Major
        Found in app/assets/javascripts/search/FindPeople.js and 1 other location - About 3 hrs to fix
        app/assets/javascripts/search/FindPeople.js on lines 41..52

        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

              tbar: new Ext.Toolbar({items: [
                {xtype: 'tbtext', name: 'hdr', html: 'Jurisdictions: <i>(none selected)</i>'}, '->',
                {xtype: 'button', text: 'Clear All', scope: this, handler: function(){ this.jurisList.clearSelections(); }}
              ]}),
        Severity: Major
        Found in app/assets/javascripts/search/FindPeople.js and 1 other location - About 2 hrs to fix
        app/assets/javascripts/search/FindPeople.js on lines 73..76

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

        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

              tbar: new Ext.Toolbar({items: [
                {xtype: 'tbtext', name: 'hdr', html: 'Roles: <i>(none selected)</i>'}, '->',
                {xtype: 'button', text: 'Clear All', scope: this, handler: function(){ this.rolesList.clearSelections(); }}
              ]}),
        Severity: Major
        Found in app/assets/javascripts/search/FindPeople.js and 1 other location - About 2 hrs to fix
        app/assets/javascripts/search/FindPeople.js on lines 86..89

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

        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

            for (var r = 0; r < this.rolesList.getSelectionCount(); r++ ){
              roleIds[r] = selectedRoles[r].json.id;
            }
        Severity: Major
        Found in app/assets/javascripts/search/FindPeople.js and 1 other location - About 1 hr to fix
        app/assets/javascripts/search/FindPeople.js on lines 298..300

        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

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

            for (var j = 0; j < this.jurisList.getSelectionCount(); j++ ){
              jurisIds[j] = selectedJurisdictions[j].json.id;
            }
        Severity: Major
        Found in app/assets/javascripts/search/FindPeople.js and 1 other location - About 1 hr to fix
        app/assets/javascripts/search/FindPeople.js on lines 295..297

        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

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

        Talho.FindPeople.initialize = function(config){
            var find_people_panel = new Talho.FindPeople(config);
            return find_people_panel.getPanel();
        };
        Severity: Minor
        Found in app/assets/javascripts/search/FindPeople.js and 2 other locations - About 40 mins to fix
        app/assets/javascripts/groups/ManageGroups.js on lines 148..152
        app/assets/javascripts/profile/ShowProfile.js on lines 149..152

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

        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