Showing 26 of 28 total issues
File 0pdd.rb
has 491 lines of code (exceeds 250 allowed). Consider refactoring. Open
$stdout.sync = true
require 'mail'
require 'haml'
require 'json'
Method extract_features
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def extract_features(puzzles, samples = {}, level = 1)
puzzles = [puzzles] unless puzzles.is_a?(Array)
puzzles.each do |puzzle|
next if puzzle.nil?
prev_puzzle = samples[samples.keys.last]
- Read upRead up
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 interate
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def interate(vector, best, perfect, speed)
if vector == perfect
out = generate_random_noise_particle
new_vec = vector + ((best - vector).normalize * 0.2) + (out * rand * 0.05) + (speed * 0.05)
minimal = @f.f(vector, **@options) > @f.f(new_vec, **@options)
- Read upRead up
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 proceed
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def proceed
@job.proceed
rescue Exception => e
yaml = @vcs.repo.config
emails = yaml['errors'] || []
Method submit
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def submit(puzzle)
submitted = @tickets.submit(puzzle)
config = @vcs.repo.config
if config['tickets']&.include?('inherit-milestone') &&
puzzle.xpath('ticket')[0].text =~ /[0-9]+/
- Read upRead up
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 process_request
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def process_request(vcs)
JobDetached.new(
vcs,
JobCommitErrors.new(
vcs,
Method run
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run
c = [
'set -x',
'set -e',
'set -o pipefail',
Method expose
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def expose(xml, tickets)
seen = []
Kernel.loop do
puzzles = xml.xpath(
[
Method run
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def run
c = [
'set -x',
'set -e',
'set -o pipefail',
- Read upRead up
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 summary
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def summary(xml, ticket)
all = issues(
xml,
"//puzzle[ticket='#{ticket}']/children//puzzle",
"//puzzle[ticket='#{ticket}']"
- Read upRead up
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
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def submit(puzzle)
issue = @tickets.submit(puzzle)
issue_id = issue[:number]
yaml = @vcs.repo.config
if yaml['tags'].is_a?(Array)
Method submit
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def submit(puzzle)
submitted = @tickets.submit(puzzle)
config = @vcs.repo.config
if config['tickets']&.include?('inherit-milestone') &&
puzzle.xpath('ticket')[0].text =~ /[0-9]+/
Method expose
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def expose(xml, tickets)
seen = []
Kernel.loop do
puzzles = xml.xpath(
[
- Read upRead up
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 storage
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def storage(repo, vcs)
file_name = vcs == 'github' ? repo : "#{vcs}-#{repo}"
SyncStorage.new(
UpgradedStorage.new(
SafeStorage.new(
Method solve
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def solve(precision: 100, threads: 1, debug: false)
n_iterations = 0
Array.new(threads).map do
Thread.new do
((precision / @swarm.size) / threads).times do |_interation_number|
- Read upRead up
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 summary
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def summary(xml, ticket)
all = issues(
xml,
"//puzzle[ticket='#{ticket}']/children//puzzle",
"//puzzle[ticket='#{ticket}']"
Method extract_features
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def extract_features(puzzles, samples = {}, level = 1)
puzzles = [puzzles] unless puzzles.is_a?(Array)
puzzles.each do |puzzle|
next if puzzle.nil?
prev_puzzle = samples[samples.keys.last]
Method title
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def title(puzzle)
yaml = @vcs.repo.config
format = []
format += yaml['format'].map(&:strip).map(&:downcase) if !yaml.nil? && yaml['format'].is_a?(Array)
len = format.find { |i| i =~ /title-length=\d+/ }
- Read upRead up
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(ocket, bucket, region, key, secret)
Method initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(ocket, bucket, region, key, secret)