Skip to main content
0 votes
0 answers
52 views

I am using Ruby 3.3.1 and Rails 7.2. I have Rubocop and slim installed in my project. Right now, I have a .each in my html.slim but I am getting this error: Rails/FindEach: Use find_each instead of ...
NaguiHW's user avatar
  • 167
2 votes
1 answer
103 views

I have a class Invoice that belongs to an Entity. In the entity, the current period, meaning the business year, is set. When creating a new invoice I want to have an invoice number that is an ...
Ricky883249's user avatar
0 votes
0 answers
25 views

My goal is to allow the following single-line pattern without increasing cyclomatic complexity: somearray << somevalue if somecondition Ideally, I'd like to do this by adding something like '^\s*...
era's user avatar
  • 55
1 vote
1 answer
123 views

I'm looking for a way to make Rubocop linter for Ruby enforce explicit returns from function calls. This is a house rule I want to implement since it is easier for people coming from other languages. ...
Nikhil Razdan's user avatar
1 vote
1 answer
223 views

I'm currently using RuboCop in a Ruby on Rails project, and I have a question regarding code style enforcement for long lines with multiple arguments. We have set a line length maximum of 100 ...
Leticia Esperon's user avatar
0 votes
0 answers
41 views

❯ rubocop or rails s Ignoring racc-1.6.0 because its extensions are not built. Try: gem pristine racc --version 1.6.0 Ignoring racc-1.6.0 because its extensions are not built. Try: gem pristine racc --...
RahulOnRails's user avatar
  • 6,542
2 votes
1 answer
833 views

I can't run bundle exec rubocop -a because of the following error: /.asdf/installs/ruby/3.3.1/lib/ruby/gems/3.3.0/gems/rubocop-1.65.1/lib/rubocop/server/client_command/base.rb:28:in `initialize': ...
unnamed_road's user avatar
0 votes
1 answer
95 views

Rubocop does not swear at code where a hash with parentheses is passed to the method parameter, for example: user.set({ name: 'John', age: 45, permissions: { read: true } }) I would like him to ...
Anatoly Busygin's user avatar
0 votes
2 answers
130 views

Running RuboCop results in the following error $ rubocop Running RuboCop... Offenses: C: Metrics/MethodLength: Method has too many lines. [25/10] (https://rubystyle.guide#short-methods) def ...
Mr.'s user avatar
  • 10.2k
1 vote
1 answer
174 views

I'm doing this: class F def foo @x = Object.new def @x.bar(_t) true end end end Rubocop complains: a.rb:4:5: W: Lint/NestedMethodDefinition: Method definitions must not be ...
yegor256's user avatar
  • 106k
0 votes
1 answer
312 views

I have a class similar to this: class UsersController < ApplicationController before_action :user_authentication, except: :create include Crud end Rubocop Rails complains, "create is ...
Chiara Ani's user avatar
  • 1,135
2 votes
0 answers
434 views

I'm making a slowly upgrade on a huge rails app with rails 5 and ruby 2.7, to rails 7 and ruby 3. I want to add a rubocop rule that warns users of deprecated stuff in ruby 3 while still using ruby 2.7,...
Desert Eagle's user avatar
0 votes
0 answers
203 views

Is it possible to write a custom cop that would call out class definitions like this: MyError = Class.new(StandardError) And advise the author to format it like this? class MyError < StandardError;...
Igor_Marques's user avatar
  • 1,862
1 vote
1 answer
553 views

I'm working on a huge repo with many contributors, and many code changes happen daily. I'm tasked to update current Ruby 2.7.4 to Ruby 3+, and as a first step I have decided best to add some rules to ...
Guj Mil's user avatar
  • 345
2 votes
0 answers
87 views

With Ruby3.3.0 (rbenv global) and rubocop 1.60.2, I noticed that sometime 'useless assignements' are not detected. Below is an example where offense is detected for foo, but not for bar. #!/usr/bin/...
Ludovic Casarsa's user avatar

15 30 50 per page
1
2 3 4 5
32