ruby-llvm/ruby-llvm

View on GitHub

Showing 12 of 52 total issues

Class Builder has 106 methods (exceeds 100 allowed). Consider refactoring.
Open

  class Builder
    # Important: Call #dispose to free backend memory after use.
    def initialize
      @ptr = C.create_builder()
    end
Severity: Major
Found in lib/llvm/core/builder.rb - About 3 hrs to fix

    Method struct has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        def self.struct(elt_types, is_packed, name = nil)
          elt_types.map! { |ty| LLVM::Type(ty) }
          elt_types_ptr = FFI::MemoryPointer.new(FFI.type_size(:pointer) * elt_types.size)
          elt_types_ptr.write_array_of_pointer(elt_types)
          if name
    Severity: Minor
    Found in lib/llvm/core/type.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 invoke2 has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def invoke2(type, fun, args, normal, exception, name = "")
    Severity: Minor
    Found in lib/llvm/core/builder.rb - About 45 mins to fix

      Method create_machine has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def create_machine(triple, cpu = "", features = "",
                             opt_level = :default, reloc = :default, code_model = :default)
      Severity: Minor
      Found in lib/llvm/target.rb - About 45 mins to fix

        Method integer_conversion_assertion has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

          def integer_conversion_assertion(operation, operand, return_type, signed, expected_result)
        Severity: Minor
        Found in test/conversions_test.rb - About 35 mins to fix

          Method integer_comparison_assertion has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

            def integer_comparison_assertion(operation, operand1, operand2, signed, expected_result)
          Severity: Minor
          Found in test/comparisons_test.rb - About 35 mins to fix

            Method different_type_assertion has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

              def different_type_assertion(operation, operand, return_type, assertion_type, expected_result)
            Severity: Minor
            Found in test/conversions_test.rb - About 35 mins to fix

              Method invoke has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def invoke(fun, args, normal, exception, name = "")
              Severity: Minor
              Found in lib/llvm/core/builder.rb - About 35 mins to fix

                Method run_comparison_operation has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                  def run_comparison_operation(comparison_operation, comparison_operator,
                                               operand1, operand2, return_type)
                Severity: Minor
                Found in test/comparisons_test.rb - About 35 mins to fix

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

                      private def call2_infer_function_and_type(type, fun)
                        fun2 = fun.is_a?(LLVM::Value) ? fun : insert_block.parent.global_parent.functions[fun.to_s]
                  
                        msg = "Function provided to call instruction was neither a value nor a function name:"
                        raise ArgumentError, "#{msg} #{fun}" if fun2.nil?
                  Severity: Minor
                  Found in lib/llvm/core/builder.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

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

                      def initialize(mod, options)
                        FFI::MemoryPointer.new(FFI.type_size(:pointer)) do |ptr|
                          error   = FFI::MemoryPointer.new(FFI.type_size(:pointer))
                          status  = create_execution_engine_for_module(ptr, mod, error, options)
                          errorp  = error.read_pointer
                  Severity: Minor
                  Found in lib/llvm/execution_engine.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

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

                        def each
                          return to_enum :each unless block_given?
                          inst, last = first, last
                  
                          while inst
                  Severity: Minor
                  Found in lib/llvm/core/value.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