sometimesfood/wright

View on GitHub

Showing 5 of 5 total issues

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

    class User < Wright::Provider
      # Creates or updates the user.
      #
      # @return [void]
      def create
Severity: Minor
Found in lib/wright/provider/user.rb - About 2 hrs to fix

    Method safe_constantize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

          def self.safe_constantize(camel_cased_word)
            return nil if camel_cased_word.nil?
    
            constantize(camel_cased_word)
          rescue NameError => e
    Severity: Minor
    Found in lib/wright/util/stolen_from_activesupport.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 to_id has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

          def self.to_id(object, type)
            raise ArgumentError unless [:group, :user].include?(type)
            return nil if object.nil?
            return object.to_i unless object.is_a?(String)
            type == :user ? Etc.getpwnam(object).uid : Etc.getgrnam(object).gid
    Severity: Minor
    Found in lib/wright/util/user.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 mode= has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

          def mode=(mode)
            if mode.nil?
              @mode = nil
              return
            end
    Severity: Minor
    Found in lib/wright/util/file_permissions.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 run_script has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def run_script(arguments)
          if commands.empty? && arguments.any?
            script = File.expand_path(arguments.shift)
            load script
          else
    Severity: Minor
    Found in lib/wright/cli.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