talho/openphin

View on GitHub

Showing 3,486 of 3,486 total issues

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

  constructor: function(config){
    var Invitee = Ext.data.Record.create([{
      name: 'name',
      type: 'string'
    },{
Severity: Minor
Found in app/assets/javascripts/invitations/NewInvitation.js - About 2 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

Function initComponent has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

  initComponent : function() {
    this.setTitle('Forum: ' + this.forumName);
        
    var forumStore = new Ext.data.JsonStore({
        url: String.format('/forums/{0}.json',this.forumId),
Severity: Minor
Found in app/assets/javascripts/forums/view/topics/Index.js - About 2 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

Function onData has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    onData: function(opt, success, xhr){
        if(success){
            var events = this.getEvents(xhr);
            for(var i = 0, len = events.length; i < len; i++){
                var e = events[i],
Severity: Minor
Found in app/assets/javascripts/ext/src/direct/RemotingProvider.js - About 2 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

Function singleSort has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    singleSort: function(fieldName, dir) {
        var field = this.fields.get(fieldName);
        if (!field) {
            return false;
        }
Severity: Minor
Found in app/assets/javascripts/ext/src/data/Store.js - About 2 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

Function destroy has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    destroy : function(){
        if(!this.isDestroyed){
            if(this.fireEvent('beforedestroy', this) !== false){
                this.destroying = true;
                this.beforeDestroy();
Severity: Minor
Found in app/assets/javascripts/ext/src/widgets/Component.js - About 2 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

Function QuickTips has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

Ext.QuickTips = function(){
    var tip,
        disabled = false;
        
    return {
Severity: Minor
Found in app/assets/javascripts/ext/src/widgets/tips/QuickTips.js - About 2 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

Function load has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    load : function(options)
    {
        if (options) {
            if (options.params) {
                if (options.params[this.paramNames.active_node] === undefined) {

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 load has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    load : function(options)
    {
        if (options) {
            if (options.params) {
                if (options.params[this.paramNames.active_node] === undefined) {
Severity: Minor
Found in app/assets/javascripts/ext_extensions/TreeGrid/TreeGrid.js - About 2 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

Function loadRecords has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    loadRecords: function (o, options, success) {
        if (this.isDestroyed === true) {
            return;
        }
        if (!o || success === false) {
Severity: Minor
Found in app/assets/javascripts/ext_extensions/PagingStore.js - About 2 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

Function execute has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    execute: function (action, rs, options, batch) {
        if (!Ext.data.Api.isAction(action)) {
            throw new Ext.data.Api.Error('execute', action);
        }
        options = Ext.applyIf(options || {}, {
Severity: Minor
Found in app/assets/javascripts/ext_extensions/PagingStore.js - About 2 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

Method get_formatted_shares has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

  def self.get_formatted_shares(current_user)
    shares = []
    Folder.each_with_level(current_user.shares.order(:user_id, :organization_id, :lft)) do |share, level|
      share.is_owner = share.owner?(current_user)
      share.is_author = share.author?(current_user)
Severity: Minor
Found in app/models/folder.rb - About 2 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

Method show has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

  def show
    group = Group.find_by_id(params[:id])
    @group = current_user.viewable_groups.include?(group) ? group : nil

    respond_to do |format|
Severity: Minor
Found in app/controllers/admin/groups_controller.rb - About 2 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

Function open_tab has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    open_tab: function(config) {
        if(this.tabPanel.getComponent(config.id) === undefined) {
            var panel;

            if(Talho.ScriptManager.exists(config.initializer))
Severity: Minor
Found in app/assets/javascripts/dashboard/index.js - About 2 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

Method update has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

  def update
    if (params[:topic] && params[:topic][:comment_attributes] && params[:topic][:comment_attributes][:comment_id])    
      parent_topic = Topic.find(params[:topic][:comment_attributes][:comment_id])
      while not parent_topic.comment_id.nil?
        parent_topic = Topic.find(parent_topic.comment_id)
Severity: Minor
Found in app/controllers/topics_controller.rb - About 2 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

Method query has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    def query(args = nil)
        Service::Phone::Tfcc::CampaignActivationResponse.active.acknowledge.each do |car|
            result = Service::Phone::Tfcc::DetailedActivationResults.build(car, Service::Phone.configuration.options)
            detail = result['ucsxml']['response']['activation_detail']
            results_returned = detail['results_returned']
Severity: Minor
Found in lib/workers/query_tfcc_for_acknowledgments_worker.rb - About 2 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

Method active_topics has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

  def active_topics
    params[:forums].delete('')
    forums = if params[:forums].blank?
      Forum.for_user(current_user)
    else
Severity: Minor
Found in app/controllers/topics_controller.rb - About 2 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

        respond_to do |format|
          format.html do
            link = "<a href=\"#{user_profile_path(role_req.user)}\">#{role_req.user.display_name}</a>"
            flash[:notice]="#{link} has been denied for the role #{role_req.role.name} in #{role_req.jurisdiction.name}"

Severity: Major
Found in app/controllers/admin/role_requests_controller.rb and 1 other location - About 2 hrs to fix
app/controllers/admin/role_requests_controller.rb on lines 78..98

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

        respond_to do |format|
          format.html do
            link = "<a href=\"#{user_profile_path(role_req.user)}\">#{role_req.user.display_name}</a>"
            flash[:notice]="#{link} has been approved for the role #{role_req.role.name} in #{role_req.jurisdiction.name}"

Severity: Major
Found in app/controllers/admin/role_requests_controller.rb and 1 other location - About 2 hrs to fix
app/controllers/admin/role_requests_controller.rb on lines 125..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 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 initComponent has 60 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    initComponent : function(){


        Ext.debug.DomTree.superclass.initComponent.call(this);

Severity: Major
Found in app/assets/javascripts/ext/src/debug.js - About 2 hrs to fix

    Function initComponent has 60 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        initComponent : function(){
            Ext.form.ComboBox.superclass.initComponent.call(this);
            this.addEvents(
                /**
                 * @event expand
    Severity: Major
    Found in app/assets/javascripts/ext/src/widgets/form/Combo.js - About 2 hrs to fix
      Severity
      Category
      Status
      Source
      Language