abarrak/volume_sweeper

View on GitHub

Showing 6 of 8 total issues

Method process has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def self.process
      # Process user input ..
      opts = VolumeSweeper::Cli.run
      cloud = opts.cloud
      mode = opts.mode&.to_sym
Severity: Minor
Found in lib/volume_sweeper/core.rb - About 1 hr to fix

    Method scan_block_volumes has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def scan_block_volumes
            volumes = Array.new
            opts = { compartment_id: @compartment_id, limit: DEFAULT_PAGE_SIZE, lifecycle_state: 'AVAILABLE' }
    
            run_api_call do |config|
    Severity: Minor
    Found in lib/volume_sweeper/providers/oci.rb - About 1 hr to fix

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

            def formlate_meessage volumes, active_count: nil
              active_list = volumes[:active_ids]
              unused_list = volumes[:unused_ids]
              active_count = active_count || volumes[:active_ids] || 0
      
      
      Severity: Minor
      Found in lib/volume_sweeper/utils/notification_formatter.rb - About 1 hr to fix

        Method process has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def self.process  block_volumes, persistent_volumes
              unused_volumes = []
              active_volumes = []
              counters = { active: 0, unused: 0 }
        
        
        Severity: Minor
        Found in lib/volume_sweeper/comparer.rb - About 55 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

        Method delete_block_volumes has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

              def delete_block_volumes ids_list
                @log.msg "oci: #{ids_list&.count || 0} block volumes are eligible for cleanup."
                return if ids_list.blank?
        
                unless @run_mode == :delete
        Severity: Minor
        Found in lib/volume_sweeper/providers/oci.rb - About 45 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

        Method formlate_meessage has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

              def formlate_meessage volumes, active_count: nil
                active_list = volumes[:active_ids]
                unused_list = volumes[:unused_ids]
                active_count = active_count || volumes[:active_ids] || 0
        
        
        Severity: Minor
        Found in lib/volume_sweeper/utils/notification_formatter.rb - About 25 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

        Severity
        Category
        Status
        Source
        Language