sh19910711/git-contest

View on GitHub

Showing 77 of 77 total issues

Avoid too many return statements within this method.
Open

          return "objc"
Severity: Major
Found in lib/contest/driver/common.rb - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

              return "28"
    Severity: Major
    Found in lib/contest/driver/codeforces_driver.rb - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                return "6"
      Severity: Major
      Found in lib/contest/driver/codeforces_driver.rb - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                  return "delphi"
        Severity: Major
        Found in lib/contest/driver/common.rb - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                    return "D"
          Severity: Major
          Found in lib/contest/driver/aizu_online_judge_driver.rb - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                      return "python3"
            Severity: Major
            Found in lib/contest/driver/common.rb - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                        return "7"
              Severity: Major
              Found in lib/contest/driver/codeforces_driver.rb - About 30 mins to fix

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

                      def get_commit_message status
                        if @options[:message].nil?
                          message = @config["submit_rules"]["message"] || DEFAULT_COMMIT_MESSAGE
                          message = message.gsub '${site}', get_site_name
                          message = message.gsub '${problem-id}', get_problem_id(options)
                Severity: Minor
                Found in lib/contest/driver/base.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

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

                      def run
                        p options
                
                        unless has_next_token?
                          puts "Missing argument <name>"
                Severity: Minor
                Found in lib/git/contest/command_line/sub_commands/start_command.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

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

                def init_global
                  $git_contest_home   = File.expand_path(ENV['GIT_CONTEST_HOME'] || File.join("~", ".git-contest"))
                  $git_contest_config = File.expand_path(ENV['GIT_CONTEST_CONFIG'] || File.join($git_contest_home, "config.yml"))
                  if Git.do_no_echo 'branch'
                    $MASTER = Git.do 'config --get git.contest.branch.master'
                Severity: Minor
                Found in lib/git/contest/common.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

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

                      def submit_ext
                        trigger 'start'
                        problem_id = @options[:problem_id]
                
                        if (@options[:contest_id])
                Severity: Minor
                Found in lib/contest/driver/kattis_driver.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

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

                      def set_default_options
                        options[:edit] = true if options[:edit].nil?
                        options[:keep] = false if options[:keep].nil?
                        options[:rebase] = false if options[:rebase].nil?
                        options[:force_delete] = false if options[:force_delete].nil?
                Severity: Minor
                Found in lib/git/contest/command_line/sub_commands/finish_command.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

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

                      def run_site_add
                        # git-contest-config site add
                        if tokens.length == 1
                          puts "# input site config (password will be hidden)"
                
                
                Severity: Minor
                Found in lib/git/contest/command_line/sub_commands/config_command.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

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

                      def use_current_branch
                        current_branch = Git.current_branch
                        if current_branch.start_with? $PREFIX
                          $BRANCH = current_branch.strip
                          $NAME = $BRANCH[$PREFIX.length+1..-1]
                Severity: Minor
                Found in lib/git/contest/command_line/sub_commands/rebase_command.rb and 1 other location - About 25 mins to fix
                lib/git/contest/command_line/sub_commands/finish_command.rb on lines 111..119

                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

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

                      def use_current_branch
                        current_branch = Git.current_branch
                        if current_branch.start_with? $PREFIX
                          $BRANCH = current_branch.strip
                          $NAME = $BRANCH[$PREFIX.length+1..-1]
                Severity: Minor
                Found in lib/git/contest/command_line/sub_commands/finish_command.rb and 1 other location - About 25 mins to fix
                lib/git/contest/command_line/sub_commands/rebase_command.rb on lines 49..57

                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

                        5.times do
                          sleep 3
                          my_page = @client.get "http://codeforces.com/contest/#{contest_id}/my"
                          status = get_status(submission_id, my_page.body)
                          return status unless is_waiting(submission_id, my_page.body)
                Severity: Minor
                Found in lib/contest/driver/codeforces_driver.rb and 1 other location - About 20 mins to fix
                lib/contest/driver/aizu_online_judge_driver.rb on lines 118..123

                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

                        5.times do
                          sleep 3
                          status_page = @client.get "http://judge.u-aizu.ac.jp/onlinejudge/webservice/status_log?user_id=#{user_id}&limit=1"
                          status = get_status(submission_id, status_page.body)
                          return status unless is_waiting(submission_id, status_page.body)
                Severity: Minor
                Found in lib/contest/driver/aizu_online_judge_driver.rb and 1 other location - About 20 mins to fix
                lib/contest/driver/codeforces_driver.rb on lines 164..169

                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