-
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
Ivan Shishkov #21
base: master
Are you sure you want to change the base?
Ivan Shishkov #21
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.
Shishkov_Ivan/0/WorkWithData.rb
Outdated
} | ||
return result | ||
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/TrailingBlankLines: Final newline missing.
Shishkov_Ivan/0/WorkWithData.rb
Outdated
result['price'] = maxYearPrice; | ||
end | ||
} | ||
return result |
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/RedundantReturn: Redundant return detected.
Shishkov_Ivan/0/WorkWithData.rb
Outdated
if(maxMonthPrice > maxYearPrice) | ||
maxYearPrice = maxMonthPrice; | ||
result['year'] = year; | ||
result['price'] = maxYearPrice; |
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/Semicolon: Do not use semicolons to terminate expressions.
Shishkov_Ivan/0/WorkWithData.rb
Outdated
} | ||
if(maxMonthPrice > maxYearPrice) | ||
maxYearPrice = maxMonthPrice; | ||
result['year'] = year; |
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/Semicolon: Do not use semicolons to terminate expressions.
Shishkov_Ivan/0/WorkWithData.rb
Outdated
end | ||
} | ||
if(maxMonthPrice > maxYearPrice) | ||
maxYearPrice = maxMonthPrice; |
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.
Naming/VariableName: Use snake_case for variable names.
Style/Semicolon: Do not use semicolons to terminate expressions.
Shishkov_Ivan/0/WorkWithData.rb
Outdated
result = Hash.new; | ||
maxYearPrice = 0; | ||
|
||
hash.each{|year, yearHash| |
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/BlockDelimiters: Avoid using {...} for multi-line blocks.
Naming/UncommunicativeBlockParamName: Only use lowercase characters for block parameter.
Naming/VariableName: Use snake_case for variable names.
Shishkov_Ivan/0/WorkWithData.rb
Outdated
|
||
def getMaxPrice(hash) | ||
result = Hash.new; | ||
maxYearPrice = 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.
Naming/VariableName: Use snake_case for variable names.
Style/Semicolon: Do not use semicolons to terminate expressions.
Shishkov_Ivan/0/WorkWithData.rb
Outdated
end | ||
|
||
def getMaxPrice(hash) | ||
result = Hash.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 hash literal {} instead of Hash.new.
Style/Semicolon: Do not use semicolons to terminate expressions.
Shishkov_Ivan/0/WorkWithData.rb
Outdated
return result | ||
end | ||
|
||
def getMaxPrice(hash) |
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/MethodLength: Method has too many lines. [18/10]
Naming/MethodName: Use snake_case for method names.
Shishkov_Ivan/0/WorkWithData.rb
Outdated
result['price'] = minYearPrice; | ||
end | ||
} | ||
return result |
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/RedundantReturn: Redundant return 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.
Shishkov_Ivan/0/WorkWithData.rb
Outdated
end | ||
} | ||
if(min_Month_Price < min_Year_Price) | ||
min_Year_Price = min_Month_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.
Naming/VariableName: Use snake_case for variable names.
Shishkov_Ivan/0/WorkWithData.rb
Outdated
end | ||
end | ||
} | ||
if(min_Month_Price < min_Year_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/SpaceAroundKeyword: Space after keyword if is missing.
Style/Next: Use next to skip iteration.
Shishkov_Ivan/0/WorkWithData.rb
Outdated
min_Month_Price = price | ||
result['month'] = month | ||
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/TrailingWhitespace: Trailing whitespace detected.
Shishkov_Ivan/0/WorkWithData.rb
Outdated
price = month_Hash['Minsk'] | ||
if price | ||
if(price < min_Month_Price) | ||
min_Month_Price = 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.
Naming/VariableName: Use snake_case for variable names.
Shishkov_Ivan/0/WorkWithData.rb
Outdated
year_Hash.each{|month, month_Hash| | ||
price = month_Hash['Minsk'] | ||
if price | ||
if(price < min_Month_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/SpaceAroundKeyword: Space after keyword if is missing.
Shishkov_Ivan/0/WorkWithData.rb
Outdated
} | ||
end | ||
|
||
def get_Min_Price(hash) |
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/MethodLength: Method has too many lines. [20/10]
Naming/MethodName: Use snake_case for method names.
Shishkov_Ivan/0/WorkWithData.rb
Outdated
return { | ||
"price" => product_Month_Data[monthKey]["Minsk"], | ||
"year" => yearKey, | ||
"month" => monthKey |
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.
Shishkov_Ivan/0/WorkWithData.rb
Outdated
|
||
return { | ||
"price" => product_Month_Data[monthKey]["Minsk"], | ||
"year" => yearKey, |
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.
Shishkov_Ivan/0/WorkWithData.rb
Outdated
end | ||
|
||
return { | ||
"price" => product_Month_Data[monthKey]["Minsk"], |
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.
Shishkov_Ivan/0/WorkWithData.rb
Outdated
monthKey = product_Month_Data.keys.max{|a,b| months[a] <=> months[b]} | ||
end | ||
|
||
return { |
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/RedundantReturn: Redundant return 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.
Shishkov_Ivan/0/WorkWithData.rb
Outdated
if(min_Month_Price < min_Year_Price) | ||
min_Year_Price = min_Month_Price | ||
result['year'] = year | ||
result['price'] = min_Year_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.
Style/Semicolon: Do not use semicolons to terminate expressions.
Shishkov_Ivan/0/WorkWithData.rb
Outdated
} | ||
if(min_Month_Price < min_Year_Price) | ||
min_Year_Price = min_Month_Price | ||
result['year'] = year |
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/Semicolon: Do not use semicolons to terminate expressions.
Shishkov_Ivan/0/WorkWithData.rb
Outdated
end | ||
} | ||
if(min_Month_Price < min_Year_Price) | ||
min_Year_Price = min_Month_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.
Naming/VariableName: Use snake_case for variable names.
Style/Semicolon: Do not use semicolons to terminate expressions.
Shishkov_Ivan/0/WorkWithData.rb
Outdated
if(price < min_Month_Price) | ||
min_Month_Price = price | ||
result['month'] = month | ||
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.
Style/Semicolon: Do not use semicolons to terminate expressions.
Shishkov_Ivan/0/WorkWithData.rb
Outdated
if price | ||
if(price < min_Month_Price) | ||
min_Month_Price = price | ||
result['month'] = month |
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.
Naming/VariableName: Use snake_case for variable names.
Shishkov_Ivan/0/WorkWithData.rb
Outdated
} | ||
end | ||
|
||
def get_Min_Price(hash) |
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/MethodLength: Method has too many lines. [18/10]
Naming/MethodName: Use snake_case for method names.
Shishkov_Ivan/0/WorkWithData.rb
Outdated
if product_Month_Data[current_Month] | ||
monthKey = current_Month | ||
else | ||
monthKey = product_Month_Data.keys.max{|a,b| months[a] <=> months[b]} |
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.
Naming/VariableName: Use snake_case for variable names.
Layout/SpaceBeforeBlockBraces: Space missing to the left of {.
Layout/SpaceInsideBlockBraces: Space between { and | missing.
Layout/SpaceAfterComma: Space missing after comma.
Layout/SpaceInsideBlockBraces: Space missing inside }.
Shishkov_Ivan/0/WorkWithData.rb
Outdated
product_Month_Data = product_Year_Data[yearKey] | ||
|
||
if product_Month_Data[current_Month] | ||
monthKey = current_Month |
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.
Naming/VariableName: Use snake_case for variable names.
Style/Semicolon: Do not use semicolons to terminate expressions.
Shishkov_Ivan/0/WorkWithData.rb
Outdated
|
||
product_Month_Data = product_Year_Data[yearKey] | ||
|
||
if product_Month_Data[current_Month] |
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/ConditionalAssignment: Use the return of the conditional for variable assignment and comparison.
Shishkov_Ivan/0/WorkWithData.rb
Outdated
yearKey = product_Year_Data.keys.max{|a,b| a.to_i <=> b.to_i} | ||
end | ||
|
||
product_Month_Data = product_Year_Data[yearKey] |
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.
Naming/VariableName: Use snake_case for variable names.
Style/Semicolon: Do not use semicolons to terminate expressions.
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.
Shishkov_Ivan/0/WorkWithData.rb
Outdated
result | ||
end | ||
|
||
def get_Max_Price(hash) |
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.
Naming/MethodName: Use snake_case for method names.
Shishkov_Ivan/0/WorkWithData.rb
Outdated
end | ||
end | ||
|
||
def get_Min_Price(hash) |
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.
Naming/MethodName: Use snake_case for method names.
result = val.to_f | ||
|
||
if year.to_i < 2017 | ||
result = result / 10000 |
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/SelfAssignment: Use self-assignment shorthand /=.
Style/NumericLiterals: Use underscores(_) as decimal mark and separate every 3 digits with them.
if val | ||
result = val.to_f | ||
|
||
if year.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/IfUnlessModifier: Favor modifier if usage when having a single-line body. Another good alternative is the usage of control flow &&/||.
end | ||
|
||
def format_Value(val, year) | ||
if val |
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.
Shishkov_Ivan/0/WorkWithData.rb
Outdated
def find_Keys(word, products) | ||
keys = [] | ||
products.keys.each{ |key| | ||
if(key.include?(word)) |
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/SpaceAroundKeyword: Space after keyword if is missing.
Style/IfUnlessModifier: Favor modifier if usage when having a single-line body. Another good alternative is the usage of control flow &&/||.
Shishkov_Ivan/0/WorkWithData.rb
Outdated
|
||
def find_Keys(word, products) | ||
keys = [] | ||
products.keys.each{ |key| |
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 {.
Style/BlockDelimiters: Avoid using {...} for multi-line blocks.
Shishkov_Ivan/0/WorkWithData.rb
Outdated
file; | ||
end | ||
|
||
def find_Keys(word, products) |
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.
Naming/MethodName: Use snake_case for method names.
Shishkov_Ivan/0/WorkWithData.rb
Outdated
else | ||
puts 'unsupported file type: ' + file_Path | ||
end | ||
file; |
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/Semicolon: Do not use semicolons to terminate expressions.
Shishkov_Ivan/0/WorkWithData.rb
Outdated
{"price" => product_Month_Data[month_Key]["Minsk"], "year" => year_Key, "month" => month_Key } | ||
end | ||
|
||
def get_File(file_Path) |
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.
Naming/MethodName: Use snake_case for method names.
Naming/UncommunicativeMethodParamName: Only use lowercase characters for method parameter.
Naming/VariableName: Use snake_case for variable names.
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.
Shishkov_Ivan/0/WorkWithData.rb
Outdated
regions[3] => format_Value(file.cell('M', index), year), | ||
regions[4] => format_Value(file.cell('O', index), year), | ||
regions[5] => format_Value(file.cell('Q', index), year), | ||
regions[6] => format_Value(file.cell('S', index), year)} |
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.
Naming/VariableName: Use snake_case for variable names.
Performance/CompareWithBlock: Use max_by(&:to_i) instead of max { |a, b| a.to_i <=> b.to_i }.
Layout/SpaceBeforeBlockBraces: Space missing to the left of {.
Layout/SpaceInsideBlockBraces: Space between { and | missing.
Layout/SpaceAfterComma: Space missing after comma.
Layout/SpaceInsideBlockBraces: Space missing inside }.
Shishkov_Ivan/0/WorkWithData.rb
Outdated
regions[1] => format_Value(file.cell('I', index), year), | ||
regions[2] => format_Value(file.cell('K', index), year), | ||
regions[3] => format_Value(file.cell('M', index), year), | ||
regions[4] => format_Value(file.cell('O', index), year), |
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.
Naming/VariableName: Use snake_case for variable names.
Shishkov_Ivan/0/WorkWithData.rb
Outdated
regions[0] => format_Value(file.cell('G', index), year), | ||
regions[1] => format_Value(file.cell('I', index), year), | ||
regions[2] => format_Value(file.cell('K', index), year), | ||
regions[3] => format_Value(file.cell('M', index), year), |
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/ConditionalAssignment: Use the return of the conditional for variable assignment and comparison.
Shishkov_Ivan/0/WorkWithData.rb
Outdated
products[key][year] = {} unless products[key][year] | ||
products[key][year][month] = { | ||
regions[0] => format_Value(file.cell('G', index), year), | ||
regions[1] => format_Value(file.cell('I', index), year), |
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.
Naming/VariableName: Use snake_case for variable names.
Shishkov_Ivan/0/WorkWithData.rb
Outdated
end | ||
end | ||
|
||
def add_Products(products, year, month, key, regions, file, 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.
Style/IfUnlessModifier: Favor modifier if usage when having a single-line body. Another good alternative is the usage of control flow &&/||.
Shishkov_Ivan/0/WorkWithData.rb
Outdated
def find_Keys(word, products) | ||
keys = [] | ||
products.keys.each{ |key| | ||
if(key.include?(word)) |
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.
Shishkov_Ivan/0/WorkWithData.rb
Outdated
|
||
def find_Keys(word, products) | ||
keys = [] | ||
products.keys.each{ |key| |
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.
Naming/MethodName: Use snake_case for method names.
Shishkov_Ivan/0/WorkWithData.rb
Outdated
else | ||
puts 'unsupported file type: ' + file_Path | ||
end | ||
file; |
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.
file = Roo::Excelx.new(file_Path) | ||
else | ||
puts 'unsupported file type: ' + file_Path | ||
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.
Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
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.
Переназови PR
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.
Shishkov_Ivan/0/WorkWithData.rb
Outdated
regions[4] => format_value(file.cell('O', index), year), | ||
regions[5] => format_value(file.cell('Q', index), year), | ||
regions[6] => format_value(file.cell('S', index), year) | ||
} |
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/IndentHash: Indent the right brace the same as the start of the line where the left brace is.
Shishkov_Ivan/0/WorkWithData.rb
Outdated
regions[3] => format_value(file.cell('M', index), year), | ||
regions[4] => format_value(file.cell('O', index), year), | ||
regions[5] => format_value(file.cell('Q', index), year), | ||
regions[6] => format_value(file.cell('S', index), year) |
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.
Shishkov_Ivan/0/WorkWithData.rb
Outdated
def add_products(products, year, month, key, regions, file, index) | ||
products[key] = {} unless products[key] | ||
products[key][year] = {} unless products[key][year] | ||
products[key][year][month] = { |
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.
end | ||
end | ||
|
||
def add_products(products, year, month, key, regions, file, 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.
Metrics/AbcSize: Assignment Branch Condition size for add_products is too high. [27.24/15]
Metrics/MethodLength: Method has too many lines. [11/10]
Metrics/ParameterLists: Avoid parameter lists longer than 5 parameters. [7/5]
def find_keys(word, products) | ||
keys = [] | ||
products.keys.each do |key| | ||
keys.push(key) if (key.include?(word)) |
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/ParenthesesAroundCondition: Don't use parentheses around the condition of an if.
Style/RedundantParentheses: Don't use parentheses around a method call.
|
||
def get_month_key(product_month_data, current_months, month_Map) | ||
if product_month_data[current_months] | ||
return current_months |
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/RedundantReturn: Redundant return detected.
end | ||
|
||
def get_month_key(product_month_data, current_months, month_Map) | ||
if product_month_data[current_months] |
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.
end | ||
end | ||
|
||
def get_month_key(product_month_data, current_months, month_Map) |
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.
Naming/UncommunicativeMethodParamName: Only use lowercase characters for method parameter.
Naming/VariableName: Use snake_case for variable names.
if product_year_data[@current_year] | ||
return @current_year | ||
else | ||
return product_year_data.keys.max{|a,b| a.to_i <=> b.to_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.
Style/RedundantReturn: Redundant return detected.
Performance/CompareWithBlock: Use max_by(&:to_i) instead of max { |a, b| a.to_i <=> b.to_i }.
Layout/SpaceBeforeBlockBraces: Space missing to the left of {.
Layout/SpaceInsideBlockBraces: Space between { and | missing.
Layout/SpaceAfterComma: Space missing after comma.
Layout/SpaceInsideBlockBraces: Space missing inside }.
|
||
def get_year_key(products, key, product_year_data) | ||
if product_year_data[@current_year] | ||
return @current_year |
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/RedundantReturn: Redundant return 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.
end | ||
|
||
result.round(2) | ||
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.
Style/SelfAssignment: Use self-assignment shorthand /=.
Style/NumericLiterals: Use underscores(_) as decimal mark and separate every 3 digits with them.
result = result / 10000 | ||
end | ||
|
||
result.round(2) |
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 &&/||.
result = val.to_f | ||
|
||
if year.to_i < 2017 | ||
result = result / 10000 |
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.
year = file.cell('A', 3).split(' ')[2] | ||
month = file.cell('A', 3).split(' ')[1] | ||
key = file.cell('A', index).strip.downcase | ||
add_products(products, year, month, key, regions, file, 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.
Style/For: Prefer each over for.
year_Key = get_year_key(products, key, product_year_data) | ||
product_month_data = product_year_data[year_Key] | ||
month_key = get_month_key(product_month_data, current_months, month_Map) | ||
{'price' => product_month_data[month_key]['Minsk'], 'year' => year_Key, 'month' => month_key } |
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.
Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
end | ||
end | ||
|
||
def get_month_key(product_month_data, current_months, month_Map) |
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.
Naming/MethodName: Use snake_case for method names.
Naming/UncommunicativeMethodParamName: Only use lowercase characters for method parameter.
Naming/VariableName: Use snake_case for variable names.
end | ||
|
||
def get_year_key(products, key, product_year_data) | ||
if product_year_data[@current_year] |
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.
current_months | ||
end | ||
|
||
def get_year_key(products, key, product_year_data) |
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.
Naming/MethodName: Use snake_case for method names.
Lint/UnusedMethodArgument: Unused method argument - products. If it's necessary, use _ or _products as an argument name to indicate that it won't be used.
Lint/UnusedMethodArgument: Unused method argument - key. If it's necessary, use _ or _key as an argument name to indicate that it won't be used.
Naming/UncommunicativeMethodParamName: Only use lowercase characters for method parameter.
Naming/VariableName: Use snake_case for variable names.
def get_mount(month, monthNumber) | ||
current_months = @current_month | ||
if monthNumber == @current_month | ||
return current_months = month |
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.
Naming/VariableName: Use snake_case for variable names.
|
||
def get_mount(month, monthNumber) | ||
current_months = @current_month | ||
if monthNumber == @current_month |
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, use_snake_case.
this_Is_Not_Snake_Case!
|
||
require "roo-xls" | ||
|
||
require "./WorkWithData.rb" |
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 snake case for file naming
require "./WorkWithData.rb" | ||
|
||
funcs = FilesParse.new | ||
months = { |
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.
Make Constant
'декабрь' => 12, | ||
} | ||
|
||
regions = ['Brest', |
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.
Make Constant
Shishkov_Ivan/0/Main.rb
Outdated
'Minsk', | ||
'Grodno Region', | ||
'Mogilyov'] | ||
products = Hash.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.
{}
Shishkov_Ivan/0/Main.rb
Outdated
'Grodno Region', | ||
'Mogilyov'] | ||
products = Hash.new | ||
file_Paths = Dir['./data/*'] |
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_snake_case
Shishkov_Ivan/0/Main.rb
Outdated
file = funcs.get_File(file_Path) | ||
|
||
if file | ||
funcs.fetch_Products_Data(file, products, regions) |
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_snake_case
Shishkov_Ivan/0/WorkWithData.rb
Outdated
@@ -0,0 +1,182 @@ | |||
class FilesParse | |||
|
|||
attr_accessor :current_Month, |
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 extra spaces
Shishkov_Ivan/0/WorkWithData.rb
Outdated
extention = file_Path.split('.')[2] | ||
case extention | ||
when 'xls' | ||
file = Roo::Excel.new(file_Path) |
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 can use Roo::Spreadsheet, it reads both xls and xlsx
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.
|
||
if year.to_i < 2017 | ||
result = result / 10000 | ||
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.
Style/SelfAssignment: Use self-assignment shorthand /=.
Style/NumericLiterals: Use underscores(_) as decimal mark and separate every 3 digits with them.
result = val.to_f | ||
|
||
if year.to_i < 2017 | ||
result = result / 10000 |
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 &&/||.
|
||
def format_value(val, year) | ||
if val | ||
result = val.to_f |
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.
end | ||
|
||
def add_products(products, year, month, key, regions, file, index) | ||
products[key] = {} unless products[key] |
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 add_products is too high. [27.24/15]
Metrics/MethodLength: Method has too many lines. [11/10]
Metrics/ParameterLists: Avoid parameter lists longer than 5 parameters. [7/5]
|
||
def fetch_products_data(file, products, regions) | ||
for index in 9..file.last_row | ||
next if file.cell('E', index).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/For: Prefer each over for.
def get_month_key(product_month_data, current_months, month_Map) | ||
if product_month_data[current_months] | ||
return current_months | ||
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.
Style/RedundantReturn: Redundant return detected.
|
||
def get_month_key(product_month_data, current_months, month_Map) | ||
if product_month_data[current_months] | ||
return current_months |
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.
end | ||
|
||
def get_month_key(product_month_data, current_months, month_Map) | ||
if product_month_data[current_months] |
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.
Naming/UncommunicativeMethodParamName: Only use lowercase characters for method parameter.
Naming/VariableName: Use snake_case for variable names.
return @current_year | ||
else | ||
return product_year_data.keys.max{|a,b| a.to_i <=> b.to_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.
Style/RedundantReturn: Redundant return detected.
Performance/CompareWithBlock: Use max_by(&:to_i) instead of max { |a, b| a.to_i <=> b.to_i }.
Layout/SpaceBeforeBlockBraces: Space missing to the left of {.
Layout/SpaceInsideBlockBraces: Space between { and | missing.
Layout/SpaceAfterComma: Space missing after comma.
Layout/SpaceInsideBlockBraces: Space missing inside }.
def get_year_key(products, key, product_year_data) | ||
if product_year_data[@current_year] | ||
return @current_year | ||
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.
Style/RedundantReturn: Redundant return 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.
@current_year = Time.now.strftime('%Y').to_s | ||
end | ||
|
||
def get_mount(month, monthNumber) |
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.
Naming/UncommunicativeMethodParamName: Only use lowercase characters for method parameter.
Naming/VariableName: Use snake_case for variable names.
@@ -0,0 +1,177 @@ | |||
class FilesParse |
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/EndOfLine: Carriage return character detected.
Metrics/ClassLength: Class has too many lines. [157/100]
max_price = funcs.get_max_price(products[key]) | ||
puts 'Maximum was on ' + max_price['year'] + | ||
'/' + months[max_price['month']].to_s + | ||
' at price ' + max_price['price'].to_s + ' BYN' |
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/MultilineOperationIndentation: Align the operands of an expression spanning multiple lines.
' at price ' + min_Price['price'].to_s + ' BYN' | ||
max_price = funcs.get_max_price(products[key]) | ||
puts 'Maximum was on ' + max_price['year'] + | ||
'/' + months[max_price['month']].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.
Layout/MultilineOperationIndentation: Align the operands of an expression spanning multiple lines.
min_Price = funcs.get_min_price(products[key]) | ||
puts 'Lowest was on ' + min_Price['year'] + | ||
'/' + months[min_Price['month']].to_s + | ||
' at price ' + min_Price['price'].to_s + ' BYN' |
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/MultilineOperationIndentation: Align the operands of an expression spanning multiple lines.
products = {} | ||
file_paths = Dir['./data/*'] | ||
|
||
file_paths.each{ |file_path| |
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 {.
Style/BlockDelimiters: Avoid using {...} for multi-line blocks.
'Grodno Region', | ||
'Mogilyov'] | ||
products = {} | ||
file_paths = Dir['./data/*'] |
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: Operator = should be surrounded by a single space.
Layout/ExtraSpacing: Unnecessary spacing detected.
'Grodno', | ||
'Minsk', | ||
'Grodno Region', | ||
'Mogilyov'] |
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/AlignArray: Align the elements of an array literal if they span more than one line.
'Gomel', | ||
'Grodno', | ||
'Minsk', | ||
'Grodno Region', |
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/AlignArray: Align the elements of an array literal if they span more than one line.
'Vitebsk', | ||
'Gomel', | ||
'Grodno', | ||
'Minsk', |
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/AlignArray: Align the elements of an array literal if they span more than one line.
Layout/TrailingWhitespace: Trailing whitespace detected.
Name
Shishkov Ivan
Homework#
0