aeolusproject/conductor

View on GitHub
src/app/controllers/provider_accounts_controller.rb

Summary

Maintainability
B
5 hrs
Test Coverage

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

  def create
    @provider = Provider.find(params[:provider_id] || params[:provider_account][:provider_id])
    require_privilege(Alberich::Privilege::CREATE, ProviderAccount, @provider)
    credentials_hash = credentials_hash_prepare

Severity: Minor
Found in src/app/controllers/provider_accounts_controller.rb - About 1 hr to fix

    Method update has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def update
        @provider_account = ProviderAccount.find(params[:id])
        require_privilege(Alberich::Privilege::MODIFY, @provider_account.provider)
        require_privilege(Alberich::Privilege::MODIFY, @provider_account)
        credentials_hash = credentials_hash_prepare
    Severity: Minor
    Found in src/app/controllers/provider_accounts_controller.rb - About 1 hr to fix

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

        def show
          @tab_captions = [_('Properties'), _('Credentials'), _('History'), _('Permissions')]
          @provider_account = ProviderAccount.find(params[:id])
          @title = _('Account: %s') % @provider_account.name
          @provider = Provider.find_by_id(params[:provider_id])
      Severity: Minor
      Found in src/app/controllers/provider_accounts_controller.rb - 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

      Method show has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def show
          @tab_captions = [_('Properties'), _('Credentials'), _('History'), _('Permissions')]
          @provider_account = ProviderAccount.find(params[:id])
          @title = _('Account: %s') % @provider_account.name
          @provider = Provider.find_by_id(params[:provider_id])
      Severity: Minor
      Found in src/app/controllers/provider_accounts_controller.rb - About 1 hr to fix

        Method multi_destroy has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          def multi_destroy
            @provider = Provider.find(params[:provider_id])
        
            if params[:accounts_selected].blank?
              flash[:warning] = _('You must select some accounts first.')
        Severity: Minor
        Found in src/app/controllers/provider_accounts_controller.rb - About 35 mins 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

        There are no issues that match your filters.

        Category
        Status