thomis/db_meta

View on GitHub

Showing 22 of 22 total issues

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

      def extract(args = {})
        buffer = [block(@name)]
        buffer << "CREATE#{" #{@temporary}" if @temporary} TABLE #{@name}"
        buffer << "("

Severity: Minor
Found in lib/db_meta/oracle/types/table.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 handle_table_data has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

      def handle_table_data(args)
        Log.info("Handling table data...")

        @exclude_data = args[:exclude_data] if args[:exclude_data]
        @include_data = args[:include_data] if args[:include_data]
Severity: Minor
Found in lib/db_meta/oracle/objects.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

  module Oracle
    class SynonymCollection
      include DbMeta::Oracle::Helper

      attr_reader :name, :type, :status, :extract_type, :collection
Severity: Major
Found in lib/db_meta/oracle/types/synonym_collection.rb and 1 other location - About 2 hrs to fix
lib/db_meta/oracle/types/grant_collection.rb on lines 2..36

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

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

  module Oracle
    class GrantCollection
      include DbMeta::Oracle::Helper

      attr_reader :name, :type, :status, :extract_type, :collection
Severity: Major
Found in lib/db_meta/oracle/types/grant_collection.rb and 1 other location - About 2 hrs to fix
lib/db_meta/oracle/types/synonym_collection.rb on lines 2..36

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

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 extract has 48 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def extract(args = {})
        buffer = [block(@name)]
        buffer << "CREATE#{" #{@temporary}" if @temporary} TABLE #{@name}"
        buffer << "("

Severity: Minor
Found in lib/db_meta/oracle/types/table.rb - About 1 hr to fix

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

      module Oracle
        class Procedure < Base
          register_type("PROCEDURE")
    
          attr_reader :source
    Severity: Major
    Found in lib/db_meta/oracle/types/procedure.rb and 1 other location - About 1 hr to fix
    lib/db_meta/oracle/types/function.rb on lines 2..26

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

    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

      module Oracle
        class Function < Base
          register_type("FUNCTION")
    
          attr_reader :source
    Severity: Major
    Found in lib/db_meta/oracle/types/function.rb and 1 other location - About 1 hr to fix
    lib/db_meta/oracle/types/procedure.rb on lines 2..26

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

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

          def fetch(args = {})
            @include_pattern = args[:include]
            @exclude_pattern = args[:exclude]
    
            Objects.all.each do |object|
    Severity: Minor
    Found in lib/db_meta/oracle/oracle.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 convert_type has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

          def convert_type
            case @type
            when "FLOAT"
              buffer = @type.to_s
              buffer << "(#{@data_precision})" unless @data_precision == 0
    Severity: Minor
    Found in lib/db_meta/oracle/types/column.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 fetch has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

          def fetch
            @comment = Comment.find(type: "TABLE", name: @name)
            @columns = Column.all(object_name: @name)
    
            connection = Connection.instance.get
    Severity: Minor
    Found in lib/db_meta/oracle/types/table.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 extract_summary has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def extract_summary
            Log.info("Summarizing...")
    
            buffer = [block("Summary of #{@username}"), nil]
    
    
    Severity: Minor
    Found in lib/db_meta/oracle/oracle.rb - About 1 hr to fix

      Method format_values has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def format_values(name_type_map, item)
              buffer = []
      
              item.each_pair do |key, value|
                if value.nil?
      Severity: Minor
      Found in lib/db_meta/oracle/types/table_data_collection.rb - About 1 hr to fix

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

              def fetch(args = {})
                connection_class = args[:connection_class] || Connection
                connection = connection_class.instance.get
                cursor = connection.exec("select username, password, host from user_db_links where db_link = '#{@name}'")
                while (row = cursor.fetch)
        Severity: Minor
        Found in lib/db_meta/oracle/types/database_link.rb and 1 other location - About 1 hr to fix
        lib/db_meta/oracle/types/synonym.rb on lines 14..26

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

        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 fetch(args = {})
                connection_class = args[:connection_class] || Connection
                connection = connection_class.instance.get
                cursor = connection.exec("select table_owner, table_name, db_link from user_synonyms where synonym_name = '#{@name}'")
                while (row = cursor.fetch)
        Severity: Minor
        Found in lib/db_meta/oracle/types/synonym.rb and 1 other location - About 1 hr to fix
        lib/db_meta/oracle/types/database_link.rb on lines 8..20

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

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

              def default_each
                @data.keys.sort_by { |type| type_sequence(type) }.each do |type|
                  @data[type].keys.sort.each do |name|
                    object = @data[type][name]
                    next if object.system_object?
        Severity: Minor
        Found in lib/db_meta/oracle/objects.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 reverse_default_each has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

              def reverse_default_each
                @data.keys.sort_by { |type| type_sequence(type) }.reverse_each do |type|
                  @data[type].keys.sort.each do |name|
                    object = @data[type][name]
                    next if object.system_object?
        Severity: Minor
        Found in lib/db_meta/oracle/objects.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 detect_system_objects has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

              def detect_system_objects
                Log.info("Detecting system objects...")
        
                # detect materialized view tables
                @data["MATERIALZIED VIEW"].values.each do |object|
        Severity: Minor
        Found in lib/db_meta/oracle/objects.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 extract_summary has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

              def extract_summary
                Log.info("Summarizing...")
        
                buffer = [block("Summary of #{@username}"), nil]
        
        
        Severity: Minor
        Found in lib/db_meta/oracle/oracle.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 fetch has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

              def fetch(args = {})
                # fetch details in parallel
                # number of threads = physical connections / 2 to prevent application locking
                worker = (1..Connection.instance.worker / 2).map {
                  Thread.new do
        Severity: Minor
        Found in lib/db_meta/oracle/objects.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 extract has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

              def extract(args = {})
                buffer = [block(@name)]
                buffer << "CREATE OR REPLACE VIEW #{@name}"
                buffer << "("
        
        
        Severity: Minor
        Found in lib/db_meta/oracle/types/view.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