-
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
Mihail Sokurenko-0 #26
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.
Mihail Sokurenko/0/hw0.rb
Outdated
|
||
s = Price.new | ||
s.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.
Layout/TrailingBlankLines: 1 trailing blank lines detected.
Mihail Sokurenko/0/hw0.rb
Outdated
puts "For similar price u can buy #{str}" | ||
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.
Layout/EmptyLinesAroundClassBody: Extra empty line detected at class body end.
Mihail Sokurenko/0/hw0.rb
Outdated
puts"No product with similar price" | ||
else | ||
str = a.map{|r| "#{r.capitalize.gsub(/\s+/, " ").gsub(/\n/, " ")}"}.join(', ') | ||
puts "For similar price u can buy #{str}" |
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/TrailingWhitespace: Trailing whitespace detected.
Mihail Sokurenko/0/hw0.rb
Outdated
if a.empty? | ||
puts"No product with similar price" | ||
else | ||
str = a.map{|r| "#{r.capitalize.gsub(/\s+/, " ").gsub(/\n/, " ")}"}.join(', ') |
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/SpaceBeforeBlockBraces: Space missing to the left of {.
Layout/SpaceInsideBlockBraces: Space between { and | missing.
Style/UnneededInterpolation: Prefer to_s over string interpolation.
Style/StringLiteralsInInterpolation: Prefer single-quoted strings inside interpolations.
Performance/StringReplacement: Use tr instead of gsub.
Layout/SpaceInsideBlockBraces: Space missing inside }.
Layout/TrailingWhitespace: Trailing whitespace detected.
Mihail Sokurenko/0/hw0.rb
Outdated
def similar_out(a) | ||
if a.empty? | ||
puts"No product with similar price" | ||
else |
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/TrailingWhitespace: Trailing whitespace detected.
Mihail Sokurenko/0/hw0.rb
Outdated
@all | ||
end | ||
|
||
def out() |
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/DefWithParentheses: Omit the parentheses in defs when the method doesn't accept any arguments.
Mihail Sokurenko/0/hw0.rb
Outdated
def all_files | ||
Dir.foreach('./date').each do |file| | ||
case File.extname(file) | ||
when '.xlsx' then |
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/TrailingWhitespace: Trailing whitespace detected.
Mihail Sokurenko/0/hw0.rb
Outdated
|
||
def old_price(file) | ||
date = get_date(file) | ||
if date[1].to_i < 2017 |
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/GuardClause: Use a guard clause instead of wrapping the code inside a conditional expression.
Style/IfUnlessModifier: Favor modifier if usage when having a single-line body. Another good alternative is the usage of control flow &&/||.
Mihail Sokurenko/0/hw0.rb
Outdated
def get_date(file) | ||
dates = file.row(3)[0].split(' ') | ||
@date.each do |d, t| | ||
if dates[1] == d.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/IfUnlessModifier: Favor modifier if usage when having a single-line body. Another good alternative is the usage of control flow &&/||.
Mihail Sokurenko/0/hw0.rb
Outdated
a = [] | ||
@c.each do |mas| | ||
mas.each do |arr| | ||
if arr == @pr && mas[0] !~ /#{@name.upcase}[.,) ]{1}/ && mas[0] != @name.upcase && !arr.nil? |
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 &&/||.
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.
Please, re-read https://github.com/rubocop-hq/ruby-style-guide and fix rubocop issues.
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.
Mihail Sokurenko/0/hw0.rb
Outdated
end | ||
|
||
s = Price.new | ||
s.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.
Layout/TrailingBlankLines: Final newline missing.
Mihail Sokurenko/0/hw0.rb
Outdated
if a.empty? | ||
puts"No product with similar price" | ||
else | ||
str = a.map { |r| "#{r.to_s.capitalize.gsub(/\s+/, " ")}" }.join(', ') |
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.
Style/StringLiteralsInInterpolation: Prefer single-quoted strings inside interpolations.
Mihail Sokurenko/0/hw0.rb
Outdated
|
||
def old_price(file) | ||
date = get_date(file) | ||
(true) if date[1].to_i < 2017 |
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/RedundantParentheses: Don't use parentheses around a literal.
max_out(max, @max_dat) | ||
end | ||
|
||
def similar |
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.
Metrics/AbcSize: Assignment Branch Condition size for similar is too high. [15.65/15]
Mihail Sokurenko/0/hw0.rb
Outdated
dat = get_date(f) | ||
old_price(f) ? coef = 0.0001 : coef = 1 | ||
f.each_with_index do |_, i| | ||
if f.row(i)[0] == @name.upcase || f.row(i)[0] =~ /#{@name.upcase}[.,) ]{1}/ |
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/Next: Use next to skip iteration.
Mihail Sokurenko/0/hw0.rb
Outdated
out | ||
end | ||
|
||
def 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.
Metrics/AbcSize: Assignment Branch Condition size for min is too high. [28.3/15]
Metrics/CyclomaticComplexity: Cyclomatic complexity for min is too high. [7/6]
Metrics/MethodLength: Method has too many lines. [17/10]
Mihail Sokurenko/0/hw0.rb
Outdated
@l = 0 | ||
@c.each_with_index do |mas, i| | ||
mas.each_with_index do |arr, j| | ||
if mas[0] != nil && mas[0] == @name.upcase || mas[0] =~ /#{@name.upcase}[.,) ]{1}/ |
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 &&/||.
Style/NonNilCheck: Prefer !expression.nil? over expression != nil.
'декабрь': '12'} | ||
end | ||
|
||
def 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.
Metrics/AbcSize: Assignment Branch Condition size for find is too high. [16.31/15]
Metrics/MethodLength: Method has too many lines. [12/10]
Mihail Sokurenko/0/hw0.rb
Outdated
@date = { 'январь': '01', 'февраль': '02', 'март': '03', 'апрель': '04', | ||
'май': '05', 'июнь': '06', 'июль': '07', 'август': '08', | ||
'сентябрь': '09', 'октябрь': '10', 'ноябрь': '11', | ||
'декабрь': '12'} |
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/SpaceInsideHashLiteralBraces: Space inside } missing.
require 'roo' | ||
require 'roo-xls' | ||
|
||
class 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.
Metrics/ClassLength: Class has too many lines. [121/100]
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.
Mihail Sokurenko/0/hw0.rb
Outdated
max = @pr | ||
all_files | ||
@all.each do |f| | ||
unless f.nil? |
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/Next: Use next to skip iteration.
Mihail Sokurenko/0/hw0.rb
Outdated
min_out(min, @min_dat) | ||
end | ||
|
||
def max |
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.
Metrics/AbcSize: Assignment Branch Condition size for max is too high. [27.35/15]
Metrics/CyclomaticComplexity: Cyclomatic complexity for max is too high. [7/6]
Metrics/MethodLength: Method has too many lines. [17/10]
Mihail Sokurenko/0/hw0.rb
Outdated
min = @pr | ||
all_files | ||
@all.each do |f| | ||
unless f.nil? |
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/Next: Use next to skip iteration.
Mihail Sokurenko/0/hw0.rb
Outdated
out | ||
end | ||
|
||
def 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.
Metrics/AbcSize: Assignment Branch Condition size for min is too high. [27.35/15]
Metrics/CyclomaticComplexity: Cyclomatic complexity for min is too high. [7/6]
Metrics/MethodLength: Method has too many lines. [17/10]
'декабрь': '12' } | ||
end | ||
|
||
def 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.
Metrics/AbcSize: Assignment Branch Condition size for find is too high. [17.23/15]
require 'roo' | ||
require 'roo-xls' | ||
|
||
class 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.
Metrics/ClassLength: Class has too many lines. [117/100]
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.
Name
Valentine Zavadskiy
Homework#
0
Link to video with demo
https://www.youtube.com/watch?v=ecIWPzGEbFc
Comment
Level 1 and 2.