nesquena/gitdocs

View on GitHub
test/unit/browser_app_test.rb

Summary

Maintainability
B
5 hrs
Test Coverage

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

describe Gitdocs::BrowserApp do
  include Rack::Test::Methods
  def app
    Gitdocs::BrowserApp
  end
Severity: Minor
Found in test/unit/browser_app_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. [222/25]
Open

  describe 'resource methods' do
    let(:repository)      { stub(root: 'root_path') }
    let(:repository_path) { stub }
    before do
      Gitdocs::Share
Severity: Minor
Found in test/unit/browser_app_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. [131/25]
Open

    describe 'get /:id' do
      describe 'meta' do
        before do
          repository_path.stubs(:meta).returns(key: :value)

Severity: Minor
Found in test/unit/browser_app_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. [60/25]
Open

      describe 'simple show' do
        describe 'directory' do
          before do
            repository_path.stubs(
              directory?:   directory,
Severity: Minor
Found in test/unit/browser_app_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 browser_app_test.rb has 301 lines of code (exceeds 250 allowed). Consider refactoring.
Open

ENV['RACK_ENV'] = 'test'
require File.expand_path('../test_helper', __FILE__)
require 'rack/test'

describe Gitdocs::BrowserApp do
Severity: Minor
Found in test/unit/browser_app_test.rb - About 3 hrs to fix

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

            describe 'directory' do
              before do
                repository_path.stubs(
                  directory?:   directory,
                  readme_path:  :readme_path,
    Severity: Minor
    Found in test/unit/browser_app_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. [34/25]
    Open

      describe 'get /search' do
        before do
          Gitdocs::Search.stubs(:search).with('term').returns(results)
    
          get '/search', q: 'term'
    Severity: Minor
    Found in test/unit/browser_app_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. [34/25]
    Open

        describe 'post /:id' do
          before { repository_path.stubs(relative_path: 'path1/path2/new') }
    
          describe 'upload' do
            before do
    Severity: Minor
    Found in test/unit/browser_app_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 'revisions' do
            before do
              repository_path.stubs(revisions: revisions)
    
              get '/1234/path1/path2', mode: 'revisions'
    Severity: Minor
    Found in test/unit/browser_app_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. [30/25]
    Open

      describe 'get /' do
        describe 'with one share' do
          before do
            Gitdocs::Share.stubs(:all).returns([:one])
            Gitdocs::Share.stubs(:first).returns(stub(id: :id))
    Severity: Minor
    Found in test/unit/browser_app_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 'empty file' do
            before do
              repository_path.expects(:join).with('new')
              repository_path.expects(:touch)
    
    
    Severity: Minor
    Found in test/unit/browser_app_test.rb and 1 other location - About 35 mins to fix
    test/unit/browser_app_test.rb on lines 288..297

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

    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 'directory' do
            before do
              repository_path.expects(:join).with('new')
              repository_path.expects(:mkdir)
    
    
    Severity: Minor
    Found in test/unit/browser_app_test.rb and 1 other location - About 35 mins to fix
    test/unit/browser_app_test.rb on lines 275..284

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

    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

                specify do
                  last_response.status.must_equal(200)
                  last_response.body.must_include('/img/file.png')
                  last_response.body.must_include('filename')
                  last_response.body.must_include('/img/folder.png')
    Severity: Minor
    Found in test/unit/browser_app_test.rb and 1 other location - About 20 mins to fix
    test/unit/browser_app_test.rb on lines 38..44

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

    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

          specify do
            last_response.status.must_equal(200)
            last_response.body.must_include('Select a share to browse')
            last_response.body.must_include('id1')
            last_response.body.must_include('path1')
    Severity: Minor
    Found in test/unit/browser_app_test.rb and 1 other location - About 20 mins to fix
    test/unit/browser_app_test.rb on lines 225..231

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

    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

    Unnecessary utf-8 encoding comment.
    Open

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

    There are no issues that match your filters.

    Category
    Status