nesquena/gitdocs

View on GitHub

Showing 676 of 676 total issues

Avoid too many return statements within this function.
Open

      if (distance_in_minutes < 525960) { return Math.floor(distance_in_minutes / 43200) + ' months ago'; }
Severity: Major
Found in lib/gitdocs/public/js/util.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

          return 'over ' + Math.floor(distance_in_minutes / 525960) + ' years ago';
    Severity: Major
    Found in lib/gitdocs/public/js/util.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

            if (distance_in_minutes < 1440) { return Math.floor(distance_in_minutes / 60) + ' hours ago'; }
      Severity: Major
      Found in lib/gitdocs/public/js/util.js - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

              return :conflict if e.err[/\[rejected\]/]
        Severity: Major
        Found in lib/gitdocs/repository.rb - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                if (distance_in_minutes < 86400) { return '1 month ago'; }
          Severity: Major
          Found in lib/gitdocs/public/js/util.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                  if (distance_in_minutes < 2880) { return '1 day ago'; }
            Severity: Major
            Found in lib/gitdocs/public/js/util.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                    if (distance_in_minutes < 43200) { return Math.floor(distance_in_minutes / 1440) + ' days ago'; }
              Severity: Major
              Found in lib/gitdocs/public/js/util.js - About 30 mins to fix

                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

                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

                Method for_push has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    def for_push(result)
                      return if result.nil?
                      return if result == :no_remote
                      return if result == :nothing
                
                
                Severity: Minor
                Found in lib/gitdocs/git_notifier.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

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

                    it 'should allow file revert' do
                      within('table#revisions') do
                        within('tbody') do
                          page.must_have_css('tr', count: 2)
                          within(:xpath, '//tr[2]') do
                Severity: Minor
                Found in test/integration/web/browse_test.rb and 1 other location - About 25 mins to fix
                test/integration/web/browse_test.rb on lines 51..62

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

                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

                Method status has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    def status
                      say "GitDoc v#{VERSION}"
                      say "Running: #{running?}"
                      say "File System Watch Method: #{Gitdocs::Manager.listen_method}"
                      say 'Watched repositories:'
                Severity: Minor
                Found in lib/gitdocs/cli.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

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

                    it 'should be able to browser a file revision' do
                      within('table#revisions') do
                        within('tbody') do
                          page.must_have_css('tr', count: 2)
                          within(:xpath, '//tr[2]') do
                Severity: Minor
                Found in test/integration/web/browse_test.rb and 1 other location - About 25 mins to fix
                test/integration/web/browse_test.rb on lines 65..76

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

                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

                Method synchronize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    def synchronize(type)
                      result = { merge: nil, push: nil }
                      return result unless valid?
                
                      case type
                Severity: Minor
                Found in lib/gitdocs/repository.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

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

                      describe 'directory non-zero size' do
                        let(:relative_path) { 'directory' }
                        it { subject[:author].must_equal :name }
                        it { subject[:size].must_equal(6) }
                        it { subject[:modified].must_equal :time }
                Severity: Minor
                Found in test/unit/repository_path_test.rb and 1 other location - About 25 mins to fix
                test/unit/repository_path_test.rb on lines 206..210

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

                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 size 0' do
                        let(:relative_path) { 'directory0' }
                        it { subject[:author].must_equal :name }
                        it { subject[:size].must_equal(-1) }
                        it { subject[:modified].must_equal :time }
                Severity: Minor
                Found in test/unit/repository_path_test.rb and 1 other location - About 25 mins to fix
                test/unit/repository_path_test.rb on lines 213..217

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

                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

                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

                      Gitdocs.log_error("#{title}: #{message}")
                
                      if show_notification
                        instance.notify(title, message, :failed)
                      else
                Severity: Minor
                Found in lib/gitdocs/notifier.rb and 1 other location - About 20 mins to fix
                lib/gitdocs/notifier.rb on lines 30..36

                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('/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

                Severity
                Category
                Status
                Source
                Language