martinpovolny/conductor

View on GitHub

Showing 403 of 403 total issues

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

  def show
    @pool = Pool.find(params[:id])
    @title = @pool.name
    save_breadcrumb(pool_path(@pool, :viewstate => viewstate_id), @pool.name)
    require_privilege(Privilege::VIEW, @pool)
Severity: Minor
Found in src/app/controllers/pools_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 update has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

  def update
    KEYS.each do |key|
      if params[key]
        if key == SELF_SERVICE_DEFAULT_QUOTA
          @self_service_default_quota = MetadataObject.lookup(key)
Severity: Minor
Found in src/app/controllers/settings_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

  def update
    # TODO - This USER_MUTABLE_ATTRS business is because what a user and app components can do
    # will be greatly different. (e.g., a user shouldn't be able to change an instance's pool,
    # since it won't do what they expect). As we build this out, this logic will become more complex.
    attrs = {}
Severity: Major
Found in src/app/controllers/instances_controller.rb and 1 other location - About 2 hrs to fix
src/app/controllers/deployments_controller.rb on lines 259..273

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

  def update
    attrs = {}
    params[:deployment].each_pair{|k,v| attrs[k] = v if Deployment::USER_MUTABLE_ATTRS.include?(k)}
    respond_to do |format|
      if check_privilege(Privilege::MODIFY, @deployment) and @deployment.update_attributes(attrs)
Severity: Major
Found in src/app/controllers/deployments_controller.rb and 1 other location - About 2 hrs to fix
src/app/controllers/instances_controller.rb on lines 72..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 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

`` has 24 functions (exceeds 20 allowed). Consider refactoring.
Open

$.extend(Conductor, {
  tabIsClickedResetFilters: false,

  positionFooter: function () {
    var $footer = $('footer');
Severity: Minor
Found in src/app/assets/javascripts/conductor.js - About 2 hrs to fix

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

    Conductor.Models.Instances = Backbone.Collection.extend({
      model: Backbone.Model.Instance,
      queryParams: {},
      url: function() {
        var path = Conductor.prefixedPath('/instances');
    Severity: Major
    Found in src/app/assets/javascripts/backbone/models.js and 1 other location - About 2 hrs to fix
    src/app/assets/javascripts/backbone/models.js on lines 72..79

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

    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

    Conductor.Models.Deployments = Backbone.Collection.extend({
      model: Backbone.Model.Deployment,
      queryParams: {},
      url: function() {
        var path = Conductor.prefixedPath('/deployments');
    Severity: Major
    Found in src/app/assets/javascripts/backbone/models.js and 1 other location - About 2 hrs to fix
    src/app/assets/javascripts/backbone/models.js on lines 35..42

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

    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

    Method launch_time_params has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

      def launch_time_params
        @title = _('New Deployment')
    
        @deployment = Deployment.new(params[:deployment])
        @pool = @deployment.pool
    Severity: Minor
    Found in src/app/controllers/deployments_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 add_members has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

      def add_members
        @user_group = UserGroup.find(params[:id])
        require_privilege(Privilege::MODIFY, User)
    
        unless @user_group.membership_source == UserGroup::MEMBERSHIP_SOURCE_LOCAL
    Severity: Minor
    Found in src/app/controllers/user_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

    Method create has 63 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def create
        if params[:cancel]
          redirect_to polymorphic_path([params[:catalog_id], Deployable])
          return
        end
    Severity: Major
    Found in src/app/controllers/deployables_controller.rb - About 2 hrs to fix

      Class DeploymentsController has 23 methods (exceeds 20 allowed). Consider refactoring.
      Open

      class DeploymentsController < ApplicationController
        before_filter :require_user
        before_filter :load_deployments, :only => [:index, :show]
        before_filter :load_deployment, :only => [:edit, :update]
        before_filter :check_inaccessible_instances, :only => :multi_stop
      Severity: Minor
      Found in src/app/controllers/deployments_controller.rb - About 2 hrs to fix

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

        Then /^there should be these ec2 provider accounts:$/ do |table|
          accounts = @xml_response.root.xpath('/provider_accounts/provider_account').map do |n|
            {:name => n.xpath('label').text,
             :provider  => n.xpath('provider').text,
             :access_key => n.xpath('access_key').text,
        Severity: Major
        Found in src/features/step_definitions/provider_account_steps.rb and 1 other location - About 2 hrs to fix
        src/features/step_definitions/provider_account_steps.rb on lines 104..118

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

        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

        Then /^there should be these mock provider accounts:$/ do |table|
          accounts = @xml_response.root.xpath('/provider_accounts/provider_account').map do |n|
            {:name => n.xpath('label').text,
             :provider  => n.xpath('provider').text,
             :username => n.xpath('username').text,
        Severity: Major
        Found in src/features/step_definitions/provider_account_steps.rb and 1 other location - About 2 hrs to fix
        src/features/step_definitions/provider_account_steps.rb on lines 122..136

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

        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

          PRESET_FILTERS_OPTIONS = [
            {:title => "instances.preset_filters.other_than_stopped", :id => "other_than_stopped", :query => where("instances.state != ?", "stopped")},
            {:title => "instances.preset_filters.new", :id => "new", :query => where("instances.state" => "new")},
            {:title => "instances.preset_filters.pending", :id => "pending", :query => where("instances.state" => "pending")},
            {:title => "instances.preset_filters.running", :id => "running", :query => where("instances.state" => "running")},
        Severity: Major
        Found in src/app/models/instance.rb and 1 other location - About 2 hrs to fix
        src/app/models/deployment.rb on lines 505..515

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

        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

          PRESET_FILTERS_OPTIONS = [
            {:title => "deployments.preset_filters.other_than_stopped", :id => "other_than_stopped", :query => where("deployments.state != ?", "stopped")},
            {:title => "deployments.preset_filters.new", :id => "new", :query => where("deployments.state" => "new")},
            {:title => "deployments.preset_filters.pending", :id => "pending", :query => where("deployments.state" => "pending")},
            {:title => "deployments.preset_filters.running", :id => "running", :query => where("deployments.state" => "running")},
        Severity: Major
        Found in src/app/models/deployment.rb and 1 other location - About 2 hrs to fix
        src/app/models/instance.rb on lines 532..542

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

        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

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

          def add_provider_accounts
            @pool_family = PoolFamily.find(params[:id])
            require_privilege(Privilege::MODIFY, @pool_family)
        
            if ProviderAccount.count == 0
        Severity: Minor
        Found in src/app/controllers/pool_families_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 set_permission_object has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

          def set_permission_object (required_role=Privilege::PERM_SET)
            obj_type = params[:permission_object_type]
            id = params[:permission_object_id]
            @return_path = params[:return_path]
            @path_prefix = params[:path_prefix]
        Severity: Minor
        Found in src/app/controllers/permissions_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 statistics has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

          def statistics
            @statistics = Hash.new
            @providers.each do |provider|
              @statistics[provider.id] = {
                "running_instances" => 0,
        Severity: Minor
        Found in src/app/controllers/providers_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 multi_destroy has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

          def multi_destroy
            deleted = []
            not_deleted = []
            not_deleted_perms = []
            catalogs = Catalog.find(params[:catalogs_selected])
        Severity: Minor
        Found in src/app/controllers/catalogs_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 multi_update has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

          def multi_update
            set_permission_object
            modified=[]
            not_modified=[]
            params[:permission_role_selected].each do |permission_role|
        Severity: Minor
        Found in src/app/controllers/permissions_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

        Severity
        Category
        Status
        Source
        Language