ruby-llvm/ruby-llvm

View on GitHub

Showing 52 of 52 total issues

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

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

                  def [](key)
                    case key
                    when String, Symbol then named(key)
                    when Integer then
                      i = 0
            Severity: Minor
            Found in lib/llvm/core/module.rb and 1 other location - About 35 mins to fix
            lib/llvm/core/module.rb on lines 221..231

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

            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 [](key)
                    case key
                    when String, Symbol then named(key)
                    when Integer
                      i = 0
            Severity: Minor
            Found in lib/llvm/core/module.rb and 1 other location - About 35 mins to fix
            lib/llvm/core/module.rb on lines 137..147

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

            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 test_const_double_bitcast
                assert_equal "i64 0", LLVM::Double.from_f(0).bitcast_to(LLVM::Int64).to_s
                assert_equal "i64 4607182418800017408", LLVM::Double.from_f(1).bitcast_to(LLVM::Int64).to_s
                assert_equal "i64 -4616189618054758400", LLVM::Double.from_f(-1).bitcast_to(LLVM::Int64).to_s
            Severity: Minor
            Found in test/double_test.rb and 1 other location - About 30 mins to fix
            test/integer_test.rb on lines 37..40

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

            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 test_const_int_bitcast
                assert_equal "double 0.000000e+00", LLVM::Int64.from_i(0).bitcast_to(LLVM::Double).to_s
                assert_equal "double 4.940660e-324", LLVM::Int64.from_i(1).bitcast_to(LLVM::Double).to_s
                assert_equal "double 0xFFFFFFFFFFFFFFFF", LLVM::Int64.from_i(-1).bitcast_to(LLVM::Double).to_s
            Severity: Minor
            Found in test/integer_test.rb and 1 other location - About 30 mins to fix
            test/double_test.rb on lines 17..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 32.

            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 test_target_machine_x86_64
                assert x86_64 = LLVM::Target.by_name('x86-64')
                assert mach = x86_64.create_machine('x86_64-pc-linux-gnu', 'i686')
            
                assert_equal x86_64, mach.target
            Severity: Minor
            Found in test/target_test.rb and 1 other location - About 25 mins to fix
            test/target_test.rb on lines 77..84

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

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

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

              def test_unpacked_constant_struct_from_size
                struct = LLVM::ConstantStruct.const(2, LLVM_UNPACKED) { |i| LLVM::Int(i) }
                assert_instance_of LLVM::ConstantStruct, struct
                assert_equal 2, struct.operands.size
                assert_predicate struct.type, :aggregate?
            Severity: Minor
            Found in test/struct_test.rb and 1 other location - About 25 mins to fix
            test/struct_test.rb on lines 120..125

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

            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 test_target_machine_x86
                assert x86 = LLVM::Target.by_name('x86')
                assert mach = x86.create_machine('x86-linux-gnu', 'i686')
            
                assert_equal x86, mach.target
            Severity: Minor
            Found in test/target_test.rb and 1 other location - About 25 mins to fix
            test/target_test.rb on lines 87..94

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

            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 test_packed_constant_struct_from_size
                struct = LLVM::ConstantStruct.const(2, LLVM_PACKED) { |i| LLVM::Int(i) }
                assert_instance_of LLVM::ConstantStruct, struct
                assert_equal 2, struct.operands.size
                assert_predicate struct.type, :aggregate?
            Severity: Minor
            Found in test/struct_test.rb and 1 other location - About 25 mins to fix
            test/struct_test.rb on lines 102..107

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

            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

                  FFI::MemoryPointer.new(FFI.type_size(:pointer) * indices.size) do |indices_ptr|
                    indices_ptr.write_array_of_pointer(indices)
                    ins = C.build_inbounds_gep2(self, type, ptr, indices_ptr, indices.size, name)
                    return Instruction.from_ptr(ins)
            Severity: Minor
            Found in lib/llvm/core/builder.rb and 1 other location - About 25 mins to fix
            lib/llvm/core/builder.rb on lines 598..601

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

            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

                  FFI::MemoryPointer.new(FFI.type_size(:pointer) * indices.size) do |indices_ptr|
                    indices_ptr.write_array_of_pointer(indices)
                    ins = C.build_gep2(self, type, ptr, indices_ptr, indices.size, name)
                    return Instruction.from_ptr(ins)
            Severity: Minor
            Found in lib/llvm/core/builder.rb and 1 other location - About 25 mins to fix
            lib/llvm/core/builder.rb on lines 625..628

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

            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 4 locations. Consider refactoring.
            Open

                assert_equalities :equal     => [fn1, fn2, fn4],
                                  :not_equal => [fn1, fn3],
                                  :same      => [fn1, fn1],
                                  :not_same  => [fn1, fn2, fn3, fn4],
                                  :eql       => [fn1, fn2],
            Severity: Minor
            Found in test/equality_test.rb and 3 other locations - About 25 mins to fix
            test/equality_test.rb on lines 39..45
            test/equality_test.rb on lines 53..59
            test/equality_test.rb on lines 67..73

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

            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 test_fptoui_to
                different_type_assertion(:fp2ui, LLVM::Double(123.3), LLVM::Int32, :integer, 123)
                different_type_assertion(:fp2ui, LLVM::Double(0.7), LLVM::Int32, :integer, 0)
                different_type_assertion(:fp2ui, LLVM::Double(1.7), LLVM::Int32, :integer, 1)
            Severity: Minor
            Found in test/conversions_test.rb and 1 other location - About 25 mins to fix
            test/conversions_test.rb on lines 41..44

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

            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

            Severity
            Category
            Status
            Source
            Language