Skip to content

Conversation

fabienalbi
Copy link

No description provided.

lib/questions.rb Outdated
# add all the keys and all the values together, e.g.
# {1 => 1, 2 => 2} becomes 6
def add_together_keys_and_values(hash)
hash.flatten.inject{ |sum, ele| sum += ele }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Space missing to the left of {.

lib/questions.rb Outdated
hash_count[word.length] ||= 0
hash_count[word.length] += 1
end
return hash_count

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redundant return detected.

lib/questions.rb Outdated
# the list of bank holidays is here:
# https://www.gov.uk/bank-holidays
def is_a_2014_bank_holiday?(date)
bank_holidays_2014 = [Time.new(2014, 1, 1), Time.new(2014, 4, 18), Time.new(2014, 1, 21), Time.new(2014, 5, 5), Time.new(2014, 8, 25), Time.new(2014, 12, 25), Time.new(2014, 12, 26)]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line is too long. [184/80]

lib/questions.rb Outdated
elsif i == 1
puts "1 bottle of beer on the wall, 1 bottle of beer.\nTake one down and pass it around, no more bottles of beer on the wall.\n\n"
else
puts "#{i} bottles of beer on the wall, #{i} bottles of beer.\nTake one down and pass it around, #{i - 1} bottles of beer on the wall.\n\n"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line is too long. [145/80]

lib/questions.rb Outdated
# 'The Lion the Witch and the Wardrobe'
def titleize_a_string(string)
string.capitalize.split(' ').each do |ele|
ele.capitalize! unless ['a', 'and', 'the'].index(ele)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use %w or %W for an array of words.

lib/questions.rb Outdated
"#{i} bottles of beer.\n"\
"Take one down and pass it around, "\
"#{i - 1} bottles of beer on the wall.\n\n"
puts string

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move puts string out of the conditional.

lib/questions.rb Outdated
def is_a_2014_bank_holiday?(date)
bank_holidays_2014 = [Time.new(2014, 1, 1), Time.new(2014, 4, 18),
Time.new(2014, 1, 21), Time.new(2014, 5, 5), Time.new(2014, 8, 25),
Time.new(2014, 12, 25), Time.new(2014, 12, 26)]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Align the elements of an array literal if they span more than one line.

lib/questions.rb Outdated
Time.new(2014, 8, 25),
Time.new(2014, 12, 25),
Time.new(2014, 12, 26)
]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indent the right bracket the same as the start of the line where the left bracket is.

lib/questions.rb Outdated
# the list of bank holidays is here:
# https://www.gov.uk/bank-holidays
def is_a_2014_bank_holiday?(date)
bank_holidays_2014 = [

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary spacing detected.
Operator = should be surrounded by a single space.

@bu7ch
Copy link
Member

bu7ch commented Apr 9, 2016

au moins c'est utile à produire du code plus performant...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants