nesquena/gitdocs

View on GitHub
test/unit/repository_test.rb

Summary

Maintainability
D
1 day
Test Coverage

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

describe Gitdocs::Repository do
  before do
    FileUtils.rm_rf(GitFactory.working_directory)
    GitFactory.init(:local)
    GitFactory.init_bare(:remote)
Severity: Minor
Found in test/unit/repository_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.

File repository_test.rb has 608 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require File.expand_path('../test_helper', __FILE__)

describe Gitdocs::Repository do
  before do
    FileUtils.rm_rf(GitFactory.working_directory)
Severity: Major
Found in test/unit/repository_test.rb - About 1 day to fix

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

      describe '#merge' do
        subject { repository.merge }
    
        before { repository.stubs(:author_count).returns(:author_counts) }
    
    
    Severity: Minor
    Found in test/unit/repository_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. [75/25]
    Open

      describe '#push' do
        subject { repository.push }
    
        before { repository.stubs(:author_count).returns(:author_counts) }
    
    
    Severity: Minor
    Found in test/unit/repository_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. [47/25]
    Open

      describe '#fetch' do
        subject { repository.fetch }
    
        describe 'when invalid' do
          let(:path_or_share) { 'tmp/unit/missing' }
    Severity: Minor
    Found in test/unit/repository_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. [45/25]
    Open

      describe '#synchronize' do
        subject { repository.synchronize(type) }
    
        describe 'invalid repository' do
          let(:type) { :noop }
    Severity: Minor
    Found in test/unit/repository_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. [43/25]
    Open

      describe '#need_sync' do
        subject { repository.need_sync? }
    
        describe 'when invalid' do
          let(:path_or_share) { 'tmp/unit/missing' }
    Severity: Minor
    Found in test/unit/repository_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. [40/25]
    Open

      describe '#dirty?' do
        subject { repository.dirty? }
    
        describe 'when invalid' do
          let(:path_or_share) { 'tmp/unit/missing' }
    Severity: Minor
    Found in test/unit/repository_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. [37/25]
    Open

        describe 'with remote' do
          before { clone_remote }
    
          describe 'and times out' do
            before do
    Severity: Minor
    Found in test/unit/repository_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. [35/25]
    Open

        describe 'remote exists with commits' do
          before { clone_remote_with_commit }
    
          describe 'and no local commits' do
            it { subject.must_equal :nothing }
    Severity: Minor
    Found in test/unit/repository_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. [32/25]
    Open

      describe '#grep' do
        subject { repository.grep('foo') { |file, context| @grep_result << "#{file} #{context}" } }
    
        before { @grep_result = [] }
    
    
    Severity: Minor
    Found in test/unit/repository_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. [31/25]
    Open

      describe 'initialize' do
        subject { repository }
    
        describe 'with a missing path' do
          let(:path_or_share) { expand_path(:missing) }
    Severity: Minor
    Found in test/unit/repository_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. [27/25]
    Open

        describe 'remote exists with no commits' do
          before { clone_remote }
    
          describe 'and no local commits' do
            it { subject.must_equal :nothing }
    Severity: Minor
    Found in test/unit/repository_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 'side effects' do
            before { subject }
            it { GitInspector.commit_count(:local).must_equal 2 }
            it { GitInspector.file_count(:local).must_equal 3 }
            it { GitInspector.file_content(:local, 'file1 (f6ea049 original)').must_equal 'foobar' }
    Severity: Minor
    Found in test/unit/repository_test.rb and 1 other location - About 55 mins to fix
    test/unit/repository_test.rb on lines 401..407

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

    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 'side effects' do
            before { subject }
            it { GitInspector.commit_count(:local).must_equal 2 }
            it { GitInspector.file_count(:local).must_equal 3 }
            it { GitInspector.file_content(:local, 'file1 (f6ea049 original)').must_equal 'foobar' }
    Severity: Minor
    Found in test/unit/repository_test.rb and 1 other location - About 55 mins to fix
    test/unit/repository_test.rb on lines 422..428

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

    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 '#available_branches' do
        subject { repository.available_branches }
    
        describe 'when invalid' do
          let(:path_or_share) { 'tmp/unit/missing' }
    Severity: Minor
    Found in test/unit/repository_test.rb and 1 other location - About 20 mins to fix
    test/unit/repository_test.rb on lines 88..97

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

    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 '#available_remotes' do
        subject { repository.available_remotes }
    
        describe 'when invalid' do
          let(:path_or_share) { 'tmp/unit/missing' }
    Severity: Minor
    Found in test/unit/repository_test.rb and 1 other location - About 20 mins to fix
    test/unit/repository_test.rb on lines 101..110

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

    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

    Add an empty line after magic comments.
    Open

    require File.expand_path('../test_helper', __FILE__)
    Severity: Minor
    Found in test/unit/repository_test.rb by rubocop

    Checks for a newline after the final magic comment.

    Example:

    # good
    # frozen_string_literal: true
    
    # Some documentation for Person
    class Person
      # Some code
    end
    
    # bad
    # frozen_string_literal: true
    # Some documentation for Person
    class Person
      # Some code
    end

    Unnecessary utf-8 encoding comment.
    Open

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

    There are no issues that match your filters.

    Category
    Status