nesquena/gitdocs

View on GitHub
lib/gitdocs/share.rb

Summary

Maintainability
A
35 mins
Test Coverage

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

    def self.update_all(updated_shares)
      updated_shares.each do |index, share_config|
        # Skip the share update if there is no path specified.
        next unless share_config['path'] && !share_config['path'].empty?

Severity: Minor
Found in lib/gitdocs/share.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

Favor a normal if-statement over a modifier clause in a multiline statement.
Open

        share_config['remote_name'], share_config['branch_name'] =
          remote_branch.split('/', 2) if remote_branch
Severity: Minor
Found in lib/gitdocs/share.rb by rubocop

Checks for uses of if/unless modifiers with multiple-lines bodies.

Example:

# bad
{
  result: 'this should not happen'
} unless cond

# good
{ result: 'ok' } if cond

Unnecessary utf-8 encoding comment.
Open

# -*- encoding : utf-8 -*-
Severity: Minor
Found in lib/gitdocs/share.rb by rubocop

There are no issues that match your filters.

Category
Status