rubinius/rubinius

View on GitHub
core/process.rb

Summary

Maintainability
F
3 days
Test Coverage

File process.rb has 575 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module Process
  def self.time
    Rubinius.primitive :vm_time
    raise PrimitiveFailure, "Process.time primitive failed"
  end
Severity: Major
Found in core/process.rb - About 1 day to fix

    Method kill has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

      def self.kill(signal, *pids)
        raise ArgumentError, "PID argument required" if pids.length == 0
    
        use_process_group = false
        signal = signal.to_s if signal.kind_of?(Symbol)
    Severity: Minor
    Found in core/process.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 euid= has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

      def self.euid=(uid)
        # the 4 rescue clauses below are needed
        # until respond_to? can be used to query the implementation of methods attached via FFI
        # atm respond_to returns true if a method is attached but not implemented on the platform
        uid = Rubinius::Type.coerce_to uid, Integer, :to_int
    Severity: Minor
    Found in core/process.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 uid= has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

      def self.uid=(uid)
        # the 4 rescue clauses below are needed
        # until respond_to? can be used to query the implementation of methods attached via FFI
        # atm respond_to returns true if a method is attached but not implemented on the platform
        uid = Rubinius::Type.coerce_to uid, Integer, :to_int
    Severity: Minor
    Found in core/process.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 fork has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

      def self.fork
        pid = Rubinius::Mirror::Process.fork
    
        if block_given? and pid.nil?
          begin
    Severity: Minor
    Found in core/process.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 coerce_rlimit_resource has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      def self.coerce_rlimit_resource(resource)
        case resource
        when Integer
          return resource
        when Symbol, String
    Severity: Minor
    Found in core/process.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 wait2 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      def self.wait2(input_pid=-1, flags=nil)
        input_pid = Rubinius::Type.coerce_to input_pid, Integer, :to_int
    
        if flags and (flags & WNOHANG) == WNOHANG
          value = Rubinius.invoke_primitive :vm_waitpid, input_pid, true
    Severity: Minor
    Found in core/process.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 daemon has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      def self.daemon(stay_in_dir=false, keep_stdio_open=false)
        # Do not run at_exit handlers in the parent
        exit!(0) if fork
    
        Process.setsid
    Severity: Minor
    Found in core/process.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

      module UID
        class << self
          def change_privilege(uid)
            uid = Rubinius::Type.coerce_to uid, Integer, :to_int
    
    
    Severity: Major
    Found in core/process.rb and 1 other location - About 4 hrs to fix
    core/process.rb on lines 732..788

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

    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 GID
        class << self
          def change_privilege(gid)
            gid = Rubinius::Type.coerce_to gid, Integer, :to_int
    
    
    Severity: Major
    Found in core/process.rb and 1 other location - About 4 hrs to fix
    core/process.rb on lines 669..725

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

    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 setresgid(rid, eid, sid)
            rid = Rubinius::Type.coerce_to rid, Integer, :to_int
            eid = Rubinius::Type.coerce_to eid, Integer, :to_int
            sid = Rubinius::Type.coerce_to sid, Integer, :to_int
    
    
    Severity: Minor
    Found in core/process.rb and 1 other location - About 40 mins to fix
    core/process.rb on lines 657..664

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

    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 setresuid(rid, eid, sid)
            rid = Rubinius::Type.coerce_to rid, Integer, :to_int
            eid = Rubinius::Type.coerce_to eid, Integer, :to_int
            sid = Rubinius::Type.coerce_to sid, Integer, :to_int
    
    
    Severity: Minor
    Found in core/process.rb and 1 other location - About 40 mins to fix
    core/process.rb on lines 647..654

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

    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 setreuid(rid, eid)
            rid = Rubinius::Type.coerce_to rid, Integer, :to_int
            eid = Rubinius::Type.coerce_to eid, Integer, :to_int
    
            ret = FFI::Platform::POSIX.setreuid rid, eid
    Severity: Minor
    Found in core/process.rb and 1 other location - About 25 mins to fix
    core/process.rb on lines 629..635

    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 setregid(rid, eid)
            rid = Rubinius::Type.coerce_to rid, Integer, :to_int
            eid = Rubinius::Type.coerce_to eid, Integer, :to_int
    
            ret = FFI::Platform::POSIX.setregid rid, eid
    Severity: Minor
    Found in core/process.rb and 1 other location - About 25 mins to fix
    core/process.rb on lines 638..644

    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

          rescue NotImplementedError
            begin
              ret = FFI::Platform::POSIX.setruid(uid)
            rescue NotImplementedError
              if Process.euid == uid
    Severity: Minor
    Found in core/process.rb and 1 other location - About 15 mins to fix
    core/process.rb on lines 230..237

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

    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

          rescue NotImplementedError
            begin
              ret = FFI::Platform::POSIX.seteuid(uid)
            rescue NotImplementedError
              if Process.uid == uid
    Severity: Minor
    Found in core/process.rb and 1 other location - About 15 mins to fix
    core/process.rb on lines 197..204

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

    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

    There are no issues that match your filters.

    Category
    Status