nesquena/gitdocs

View on GitHub
test/unit/manager_test.rb

Summary

Maintainability
A
55 mins
Test Coverage

Block has too many lines. [95/25]
Open

describe 'Gitdocs::Manager' do
  describe '.start' do
    subject { Gitdocs::Manager.start(:arg1, :arg2, :arg3) }

    before do
Severity: Minor
Found in test/unit/manager_test.rb by rubocop

This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

Block has too many lines. [64/25]
Open

  describe '.start' do
    subject { manager.start(:host, :port) }

    let(:celluloid_fascade) { mock }
    before do
Severity: Minor
Found in test/unit/manager_test.rb by rubocop

This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

Block has too many lines. [41/25]
Open

    describe 'exit' do
      before do
        celluloid_fascade.expects(:start)
        manager.expects(:sleep).raises(expected_exception)
      end
Severity: Minor
Found in test/unit/manager_test.rb by rubocop

This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

Similar blocks of code found in 2 locations. Consider refactoring.
Open

      describe 'Interrupt' do
        let(:expected_exception) { Interrupt }

        before do
          Gitdocs.expects(:log_info).with('Interrupt received...')
Severity: Minor
Found in test/unit/manager_test.rb and 1 other location - About 25 mins to fix
test/unit/manager_test.rb on lines 95..105

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

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

      describe 'SystemExit' do
        let(:expected_exception) { SystemExit }

        before do
          Gitdocs.expects(:log_info).with('Interrupt received...')
Severity: Minor
Found in test/unit/manager_test.rb and 1 other location - About 25 mins to fix
test/unit/manager_test.rb on lines 82..92

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

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

Incorrect indentation detected (column 0 instead of 6).
Open

#      manager.expects(:sleep).raises(expected_exception)
Severity: Minor
Found in test/unit/manager_test.rb by rubocop

This cops checks the indentation of comments.

Example:

# bad
  # comment here
def method_name
end

  # comment here
a = 'hello'

# yet another comment
  if true
    true
  end

# good
# comment here
def method_name
end

# comment here
a = 'hello'

# yet another comment
if true
  true
end

Put a space before an end-of-line comment.
Open

        celluloid_fascade.expects(:terminate)#.twice
Severity: Minor
Found in test/unit/manager_test.rb by rubocop

This cop checks for missing space between a token and a comment on the same line.

Example:

# bad
1 + 1# this operation does ...

# good
1 + 1 # this operation does ...

Unnecessary utf-8 encoding comment.
Open

# -*- encoding : utf-8 -*-
Severity: Minor
Found in test/unit/manager_test.rb by rubocop

Align .returns with .expects on line 55.
Open

        .returns(celluloid_fascade)
Severity: Minor
Found in test/unit/manager_test.rb by rubocop

This cop checks the indentation of the method name part in method calls that span more than one line.

Example: EnforcedStyle: aligned

# bad
while myvariable
.b
  # do something
end

# good
while myvariable
      .b
  # do something
end

# good
Thing.a
     .b
     .c

Example: EnforcedStyle: indented

# good
while myvariable
  .b

  # do something
end

Example: EnforcedStyle: indentedrelativeto_receiver

# good
while myvariable
        .a
        .b

  # do something
end

# good
myvariable = Thing
               .a
               .b
               .c

Align .with with .expects on line 55.
Open

        .with(:host, :port)
Severity: Minor
Found in test/unit/manager_test.rb by rubocop

This cop checks the indentation of the method name part in method calls that span more than one line.

Example: EnforcedStyle: aligned

# bad
while myvariable
.b
  # do something
end

# good
while myvariable
      .b
  # do something
end

# good
Thing.a
     .b
     .c

Example: EnforcedStyle: indented

# good
while myvariable
  .b

  # do something
end

Example: EnforcedStyle: indentedrelativeto_receiver

# good
while myvariable
        .a
        .b

  # do something
end

# good
myvariable = Thing
               .a
               .b
               .c

%w-literals should be delimited by [ and ].
Open

          expected_exception.stubs(:backtrace).returns(%w(foo bar))
Severity: Minor
Found in test/unit/manager_test.rb by rubocop

This cop enforces the consistent usage of %-literal delimiters.

Specify the 'default' key to set all preferred delimiters at once. You can continue to specify individual preferred delimiters to override the default.

Example:

# Style/PercentLiteralDelimiters:
#   PreferredDelimiters:
#     default: '[]'
#     '%i':    '()'

# good
%w[alpha beta] + %i(gamma delta)

# bad
%W(alpha #{beta})

# bad
%I(alpha beta)

Missing space after #.
Open

        celluloid_fascade.expects(:terminate)#.twice
Severity: Minor
Found in test/unit/manager_test.rb by rubocop

This cop checks whether comments have a leading space after the # denoting the start of the comment. The leading space is not required for some RDoc special syntax, like #++, #--, #:nodoc, =begin- and =end comments, "shebang" directives, or rackup options.

Example:

# bad
#Some comment

# good
# Some comment

There are no issues that match your filters.

Category
Status