tumugi/tumugi-plugin-google_cloud_storage

View on GitHub

Showing 8 of 8 total issues

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

      class FileSystem < Tumugi::FileSystem
        attr_reader :client

        def initialize(config)
          save_config(config)
Severity: Minor
Found in lib/tumugi/plugin/google_cloud_storage/file_system.rb - About 2 hrs to fix

    File file_system.rb has 268 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'uri'
    require 'json'
    require 'googleauth/service_account'
    require 'google/apis/storage_v1'
    require 'google/apis/drive_v3'
    Severity: Minor
    Found in lib/tumugi/plugin/google_cloud_storage/file_system.rb - About 2 hrs to fix

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

              def remove(path, recursive: true)
                bucket, key = path_to_bucket_and_key(path)
                raise Tumugi::FileSystemError.new("Cannot delete root of bucket at path '#{path}'") if root?(key)
      
                if obj_exist?(bucket, key)
      Severity: Minor
      Found in lib/tumugi/plugin/google_cloud_storage/file_system.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 directory? has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

              def directory?(path)
                bucket, key = path_to_bucket_and_key(path)
                if root?(key)
                  bucket_exist?(bucket)
                else
      Severity: Minor
      Found in lib/tumugi/plugin/google_cloud_storage/file_system.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 entries has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

              def entries(path)
                bucket, key = path_to_bucket_and_key(path)
                obj = add_path_delimiter(key)
                results = []
                next_page_token = ''
      Severity: Minor
      Found in lib/tumugi/plugin/google_cloud_storage/file_system.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 mkdir has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

              def mkdir(path, parents: true, raise_if_exist: false)
                if exist?(path)
                  if raise_if_exist
                    raise Tumugi::FileAlreadyExistError.new("Path #{path} is already exist")
                  elsif !directory?(path)
      Severity: Minor
      Found in lib/tumugi/plugin/google_cloud_storage/file_system.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 copy has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

              def copy(src_path, dest_path, raise_if_exist: false)
                if raise_if_exist && exist?(dest_path)
                  raise Tumugi::FileAlreadyExistError.new("Path #{dest_path} is already exist")
                end
      
      
      Severity: Minor
      Found in lib/tumugi/plugin/google_cloud_storage/file_system.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

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

              def download(path, download_path: nil, mode: 'r', &block)
                bucket, key = path_to_bucket_and_key(path)
                if download_path.nil?
                  download_path = Tempfile.new('tumugi_gcs_file_system').path
                end
      Severity: Minor
      Found in lib/tumugi/plugin/google_cloud_storage/file_system.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