-
Notifications
You must be signed in to change notification settings - Fork 3
Rubocop files #42
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
base: main
Are you sure you want to change the base?
Rubocop files #42
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,23 @@ | ||||||||||||||||||||||||||||||||||
def doStuff(input) # bad method name, camelCase | ||||||||||||||||||||||||||||||||||
foo = 1 | ||||||||||||||||||||||||||||||||||
foo = 2 # useless reassignment | ||||||||||||||||||||||||||||||||||
Comment on lines
+2
to
+3
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove useless variable assignments. The variable - foo = 1
- foo = 2 # useless reassignment 📝 Committable suggestion
Suggested change
🧰 Tools🪛 RuboCop (1.76.1)[warning] 2-2: Useless assignment to variable - (Lint/UselessAssignment) [warning] 3-3: Useless assignment to variable - (Lint/UselessAssignment) 🤖 Prompt for AI Agents
|
||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
if input == true | ||||||||||||||||||||||||||||||||||
puts "value is true" # double quotes used unnecessarily | ||||||||||||||||||||||||||||||||||
Comment on lines
+5
to
+6
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Simplify boolean comparison and use single quotes. The comparison - if input == true
- puts "value is true" # double quotes used unnecessarily
+ if input
+ puts 'value is true' 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
|
||||||||||||||||||||||||||||||||||
end | ||||||||||||||||||||||||||||||||||
end | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
def long_method | ||||||||||||||||||||||||||||||||||
puts 'line1' | ||||||||||||||||||||||||||||||||||
puts 'line2' | ||||||||||||||||||||||||||||||||||
puts 'line3' | ||||||||||||||||||||||||||||||||||
puts 'line4' | ||||||||||||||||||||||||||||||||||
puts 'line5' | ||||||||||||||||||||||||||||||||||
puts 'line6' | ||||||||||||||||||||||||||||||||||
puts 'line7' | ||||||||||||||||||||||||||||||||||
puts 'line8' | ||||||||||||||||||||||||||||||||||
puts 'line9' | ||||||||||||||||||||||||||||||||||
puts 'line10' | ||||||||||||||||||||||||||||||||||
puts 'line11' | ||||||||||||||||||||||||||||||||||
end | ||||||||||||||||||||||||||||||||||
Comment on lines
+10
to
+22
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Refactor repetitive code using a loop. The method contains repetitive puts statements that violate the DRY principle. This can be refactored to use a loop for better maintainability. def long_method
- puts 'line1'
- puts 'line2'
- puts 'line3'
- puts 'line4'
- puts 'line5'
- puts 'line6'
- puts 'line7'
- puts 'line8'
- puts 'line9'
- puts 'line10'
- puts 'line11'
+ (1..11).each { |i| puts "line#{i}" }
end 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
|
||||||||||||||||||||||||||||||||||
|
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.
🛠️ Refactor suggestion
Use snake_case for method names.
Ruby convention uses snake_case for method names, not camelCase.
📝 Committable suggestion
🤖 Prompt for AI Agents