RiotGames/berkshelf

View on GitHub
lib/berkshelf/config.rb

Summary

Maintainability
A
3 hrs
Test Coverage

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

    def initialize(path = self.class.path)
      # this is a bit tricky, mixlib-config wants to extend a class and create effectively a global config object while
      # what we want to do is use an instance, so we create an anonymous class and shove it into an instance variable.
      # this is actually similar to what mixlib-config itself does to create config contexts.
      @klass = Class.new
Severity: Minor
Found in lib/berkshelf/config.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 extended has 44 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def self.extended(base)
        base.class_exec do
          config_strict_mode true
          config_context :api do
            default :timeout, "30"
Severity: Minor
Found in lib/berkshelf/config.rb - About 1 hr to fix

    There are no issues that match your filters.

    Category
    Status