jimjh/ruhoh-manager

View on GitHub

Showing 4 of 8 total issues

Method _delete has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

      def _delete(path)
        forbidden unless is_allowed? path
        not_found unless File.exists? path
        forbidden unless File.file? path
        File.delete path
Severity: Minor
Found in lib/ruhoh-manager/controllers/files_controller.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 _get has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def _get(path, types)
        forbidden unless is_visible? path and is_allowed? path
        not_found unless File.exists? path
        if File.file? path
          content_type File.extname(path), :default => 'text/plain;charset=utf-8'
Severity: Minor
Found in lib/ruhoh-manager/controllers/files_controller.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 _put has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def _put(path, contents)
        forbidden unless is_allowed? path
        existed = File.file? path
        # ensure path exists, and write to file
        FileUtils.mkdir_p File.dirname(path)
Severity: Minor
Found in lib/ruhoh-manager/controllers/files_controller.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 _get has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def _get(path, types)
        forbidden if not is_allowed? path
        types << json
        types.each { |type|
          case type
Severity: Minor
Found in lib/ruhoh-manager/controllers/settings_controller.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