-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Maria Cheprasova - 0 #31
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some files could not be reviewed due to errors:
Error: We found some problems with your configuration file: [/IrresponsibleMo...
Error: We found some problems with your configuration file: [/IrresponsibleModule] key 'IrresponsibleModule:' is undefined., [/DuplicateMethodCall] key 'DuplicateMethodCall:' is undefined., [/UtilityFunction] key 'UtilityFunction:' is undefined.
Maria Cheprasova/New folder/lvl1.rb
Outdated
else puts "#{arr_seek}" | ||
end | ||
puts "#{count_files} files were found" | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Layout/TrailingBlankLines: Final newline missing.
Maria Cheprasova/New folder/lvl1.rb
Outdated
puts "nothing" | ||
else puts "#{arr_seek}" | ||
end | ||
puts "#{count_files} files were found" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Layout/IndentationConsistency: Inconsistent indentation detected.
Maria Cheprasova/New folder/lvl1.rb
Outdated
end | ||
if arr_seek.empty? | ||
puts "nothing" | ||
else puts "#{arr_seek}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Layout/ElseAlignment: Align else with if.
Style/UnneededInterpolation: Prefer to_s over string interpolation.
Maria Cheprasova/New folder/lvl1.rb
Outdated
end | ||
end | ||
if arr_seek.empty? | ||
puts "nothing" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
Maria Cheprasova/New folder/lvl1.rb
Outdated
workbook.each do |worksheet_rows| | ||
worksheet_rows.select { |row| row&.cells&.at(0)&.value }.each_with_index do |row, index| | ||
if row&.cells[14]&.value==seek | ||
arr_seek.push(row&.cells[0]&.value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lint/SafeNavigationChain: Do not chain ordinary method call after safe navigation operator.
Maria Cheprasova/New folder/lvl1.rb
Outdated
end | ||
end | ||
arr_seek=Array.new | ||
if num_rows!=0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/IfUnlessModifier: Favor modifier if usage when having a single-line body. Another good alternative is the usage of control flow &&/||.
Layout/SpaceAroundOperators: Surrounding space missing for operator !=.
Maria Cheprasova/New folder/lvl1.rb
Outdated
ind_min=i | ||
end | ||
end | ||
arr_seek=Array.new |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Layout/SpaceAroundOperators: Surrounding space missing for operator =.
Style/EmptyLiteral: Use array literal [] instead of Array.new.
Maria Cheprasova/New folder/lvl1.rb
Outdated
if arr_price[i]<min | ||
min=arr_price[i] | ||
ind_min=i | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Layout/EndAlignment: end at 64, 4 is not aligned with if at 61, 2.
Maria Cheprasova/New folder/lvl1.rb
Outdated
end | ||
if arr_price[i]<min | ||
min=arr_price[i] | ||
ind_min=i |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Layout/SpaceAroundOperators: Surrounding space missing for operator =.
Maria Cheprasova/New folder/lvl1.rb
Outdated
ind_max=i | ||
end | ||
if arr_price[i]<min | ||
min=arr_price[i] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Layout/SpaceAroundOperators: Surrounding space missing for operator =.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Таблицы надо удалить из репозитория
@@ -0,0 +1,10 @@ | |||
[LocalizedFileNames] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove file
Maria Cheprasova/New folder/lvl1.rb
Outdated
puts " #{item_name}: #{price}" | ||
end | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix indent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some files could not be reviewed due to errors:
Error: We found some problems with your configuration file: [/IrresponsibleMo...
Error: We found some problems with your configuration file: [/IrresponsibleModule] key 'IrresponsibleModule:' is undefined., [/DuplicateMethodCall] key 'DuplicateMethodCall:' is undefined., [/UtilityFunction] key 'UtilityFunction:' is undefined.
Maria Cheprasova/New folder/lvl1.rb
Outdated
puts 'nothing' | ||
else | ||
arr_seek.to_s | ||
puts "#{arr_seek.to_s}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/UnneededInterpolation: Prefer to_s over string interpolation.
Lint/StringConversionInInterpolation: Redundant use of Object#to_s in interpolation.
Maria Cheprasova/New folder/lvl1.rb
Outdated
ind_min = i | ||
end | ||
end | ||
arr_seek = Array.new |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/EmptyLiteral: Use array literal [] instead of Array.new.
Maria Cheprasova/New folder/lvl1.rb
Outdated
num_rows = 0 | ||
arr_name = Array.new | ||
arr_price = Array.new | ||
arr_date = Array.new |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/EmptyLiteral: Use array literal [] instead of Array.new.
Maria Cheprasova/New folder/lvl1.rb
Outdated
count_files = 0 | ||
num_rows = 0 | ||
arr_name = Array.new | ||
arr_price = Array.new |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/EmptyLiteral: Use array literal [] instead of Array.new.
Maria Cheprasova/New folder/lvl1.rb
Outdated
seek = price_to_seek | ||
count_files = 0 | ||
num_rows = 0 | ||
arr_name = Array.new |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/EmptyLiteral: Use array literal [] instead of Array.new.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some files could not be reviewed due to errors:
Error: We found some problems with your configuration file: [/IrresponsibleMo...
Error: We found some problems with your configuration file: [/IrresponsibleModule] key 'IrresponsibleModule:' is undefined., [/DuplicateMethodCall] key 'DuplicateMethodCall:' is undefined., [/UtilityFunction] key 'UtilityFunction:' is undefined.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some files could not be reviewed due to errors:
Error: We found some problems with your configuration file: [/IrresponsibleMo...
Error: We found some problems with your configuration file: [/IrresponsibleModule] key 'IrresponsibleModule:' is undefined., [/DuplicateMethodCall] key 'DuplicateMethodCall:' is undefined., [/UtilityFunction] key 'UtilityFunction:' is undefined.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some files could not be reviewed due to errors:
Error: We found some problems with your configuration file: [/IrresponsibleMo...
Error: We found some problems with your configuration file: [/IrresponsibleModule] key 'IrresponsibleModule:' is undefined., [/DuplicateMethodCall] key 'DuplicateMethodCall:' is undefined., [/UtilityFunction] key 'UtilityFunction:' is undefined.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some files could not be reviewed due to errors:
Error: We found some problems with your configuration file: [/IrresponsibleMo...
Error: We found some problems with your configuration file: [/IrresponsibleModule] key 'IrresponsibleModule:' is undefined., [/DuplicateMethodCall] key 'DuplicateMethodCall:' is undefined., [/UtilityFunction] key 'UtilityFunction:' is undefined.
Maria Cheprasova/0/lvl1.rb
Outdated
puts "Lowest #{min} #{arr_date[ind_min]}" | ||
puts ", highest was #{max} #{arr_date[ind_max]}" | ||
end | ||
puts 'You can also buy '.chomp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
chomp not needed
Maria Cheprasova/0/lvl1.rb
Outdated
ans = gets.chomp | ||
worksheets.each do |worksheet_rows| | ||
worksheet_rows.select { |row| row.at(0).value }.each_with_index do |row, _| | ||
row.each_with_index do |_, cell_index| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you don't need to iterate over row, you only use row[14] and row[0]
Maria Cheprasova/0/lvl1.rb
Outdated
end | ||
end | ||
end | ||
seek = price_to_seek |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you don't need another variable, just use price_to_seek
ind_max = 0 | ||
max = arr_price[0] | ||
min = arr_price[0] | ||
arr_price.each_index do |i| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ind_min = arr_price.index(arr_price.min)
min = arr_price[ind_min]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These two are interchangeable?
+What does this statement mean? (arr_price.min)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2.5.1 (main):0 > arr_price = ["f", "c", "d", "f", "h", "b", "i"];
2.5.1 (main):0 > arr_price.index("f")
=> 0
2.5.1 (main):0 > arr_price.index("d")
=> 2
2.5.1 (main):0 > arr_price.min
=> "b"
https://ruby-doc.org/core-2.2.0/Array.html#method-i-index
https://ruby-doc.org/core-2.5.3/Enumerable.html#method-i-min
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, but houndci-bot left such a remark for me "Error: We found some problems with your configuration file: [/IrresponsibleModule] key 'IrresponsibleModule:' is undefined., [/DuplicateMethodCall] key 'DuplicateMethodCall:' is undefined., [/UtilityFunction] key 'UtilityFunction:' is undefined."
as I understood one of te errors happened due to several duplicate parts of code. but I don't know exactly where they are. mb u can help me with the reason why this error happens?
Maria Cheprasova/0/lvl1.rb
Outdated
ind_min = i | ||
end | ||
end | ||
arr_seek [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shouldn't work, did you mean arr_seek = []?
Maria Cheprasova/0/lvl1.rb
Outdated
end | ||
puts 'You can also buy '.chomp | ||
workbook.each do |worksheet_rows| | ||
worksheet_rows.select { |row| row.at(0).value }.each_with_index do |row, _| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use each if you don't care about index
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some files could not be reviewed due to errors:
Error: We found some problems with your configuration file: [/IrresponsibleMo...
Error: We found some problems with your configuration file: [/IrresponsibleModule] key 'IrresponsibleModule:' is undefined., [/DuplicateMethodCall] key 'DuplicateMethodCall:' is undefined., [/UtilityFunction] key 'UtilityFunction:' is undefined.
Maria Cheprasova/0/lvl1.rb
Outdated
item_name = row[0].value | ||
price = row[14].value || 'unknown' | ||
price_to_seek = price | ||
puts " #{item_name}: #{price}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Layout/IndentationConsistency: Inconsistent indentation detected.
Maria Cheprasova/0/lvl1.rb
Outdated
|
||
item_name = row[0].value | ||
price = row[14].value || 'unknown' | ||
price_to_seek = price |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Layout/IndentationConsistency: Inconsistent indentation detected.
Maria Cheprasova/0/lvl1.rb
Outdated
next if row[0].value.include?(ans) | ||
|
||
item_name = row[0].value | ||
price = row[14].value || 'unknown' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Layout/IndentationConsistency: Inconsistent indentation detected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some files could not be reviewed due to errors:
Error: We found some problems with your configuration file: [/IrresponsibleMo...
Error: We found some problems with your configuration file: [/IrresponsibleModule] key 'IrresponsibleModule:' is undefined., [/DuplicateMethodCall] key 'DuplicateMethodCall:' is undefined., [/UtilityFunction] key 'UtilityFunction:' is undefined.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couldn't run the program.
Please, check your code before commit.
@@ -0,0 +1,4 @@ | |||
source 'https://rubygems.org' | |||
|
|||
gem 'find' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gem not found
% bundle install
Fetching gem metadata from https://rubygems.org/..............
Fetching gem metadata from https://rubygems.org/.
Could not find gem 'find' in any of the gem sources listed in your Gemfile.
puts 'What price are you looking for?' | ||
ans = gets | ||
worksheets.each do |worksheet_rows| | ||
worksheet_rows.select { |row| row.at(0).value }.each do |row| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What price are you looking for?
Соль
Traceback (most recent call last):
7: from lvl1.rb:8:in `<main>'
6: from lvl1.rb:8:in `each'
5: from lvl1.rb:9:in `block in <main>'
4: from lvl1.rb:9:in `select'
3: from /home/oleg/.rvm/rubies/ruby-2.5.3/lib/ruby/gems/2.5.0/gems/rubyXL-3.3.31/lib/rubyXL/worksheet.rb:23:in `each'
2: from /home/oleg/.rvm/rubies/ruby-2.5.3/lib/ruby/gems/2.5.0/gems/rubyXL-3.3.31/lib/rubyXL/worksheet.rb:23:in `each'
1: from /home/oleg/.rvm/rubies/ruby-2.5.3/lib/ruby/gems/2.5.0/gems/rubyXL-3.3.31/lib/rubyXL/worksheet.rb:23:in `block in each'
lvl1.rb:9:in `block (2 levels) in <main>': undefined method `at' for #<RubyXL::Row:0x000055f6c3c9e158> (NoMethodError)
ans = gets | ||
worksheets.each do |worksheet_rows| | ||
worksheet_rows.select { |row| row.at(0).value }.each do |row| | ||
next if cell_index.positive? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cell_index unedfined local variable
workbook = RubyXL::Parser.parse './data/Average_prices(serv)-10-2018.xlsx' | ||
worksheets = workbook.worksheets | ||
puts 'What price are you looking for?' | ||
ans = gets |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gets.chomp
Name
Maria Cheprasova
Homework#
0
Link to video with demo
https://www.youtube.com/watch?v=ecIWPzGEbFc
Comment
Level 1, 2 and 3