Genki-S/clicoder

View on GitHub

Showing 4 of 6 total issues

Method submit has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    def submit
      login do |mechanize, _contest_page|
        problem_page = mechanize.get(problem_url)
        submit_page = problem_page.link_with(href: /submit\?task_id/).click
        submit_page.form_with(action: /submit/) do |f|
Severity: Minor
Found in lib/clicoder/sites/atcoder.rb - About 1 hr 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 judge has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def judge
      load_local_config
      accepted = true
      judge = Judge.new(options)
      Dir.glob("#{OUTPUTS_DIRNAME}/*").each do |output|
Severity: Minor
Found in lib/clicoder/cli.rb - About 55 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 initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def initialize(argv, stdin = STDIN, stdout = STDOUT, stderr = STDERR, kernel = Kernel)
Severity: Minor
Found in lib/clicoder/cli.rb - About 35 mins to fix

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

        def initialize
          global_config_file = "#{global_config_dir}/config.yml"
          @default = File.exists?(default_config_file) ? YAML::load_file(default_config_file) : {}
          @global = File.exists?(global_config_file) ? YAML::load_file(global_config_file) : {}
          local_config_file = ".config.yml"
    Severity: Minor
    Found in lib/clicoder/config.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

    Severity
    Category
    Status
    Source
    Language