postmodern · @postmodern
1346 followers · 2071 posts · Server ruby.social

Go home rubocop, you are drunk:

undefined method `value' for s(:send,
s(:lvar, :gemspec), :[],
s(:str, "required_ruby_version")):RuboCop::AST::SendNode

#rubocop

Last updated 1 year ago

Chris C · @chrisc
5 followers · 9 posts · Server hachyderm.io

Saturday MP Show #10: Finally get a System Tests Working for the Standard Ruby Linter ToDo Bug

I get my system test working but the problem is it works so well that it still passes even after I re-introduce the bug when it should have failed. Crap!

youtu.be/DWhabjiqc4o

Question you want answered in a future video? Pair on a problem? Constructive feedback? DM me or email ask@saturdaymp.com.

#systemtesting #ruby #standardrb #rubocop #testdrivendevelopment #saturdaympshow #saturdaymp

Last updated 1 year ago

kluka ❌ · @kluka
16 followers · 50 posts · Server ruby.social

@klaustopher Metrics were a bit of a mistake. I still want my methods with 10 lines but there's no point in having hundreds of warnings because of it

#rubocop

Last updated 1 year ago

masukomi · @masukomi
310 followers · 5226 posts · Server connectified.com

/ geeks

It took me a while to figure out the collection of magical incantations required to get to run on ONLY the changed files in a GitHub Workflow. So, I made a quick blog post with the details. I also included a variation for when you're ready to have it run on _all_ your files. I recommend the latter.

weblog.masukomi.org/2023/06/19

#ruby #rails #rubocop

Last updated 1 year ago

Todd A. Jacobs · @todd_a_jacobs
8 followers · 73 posts · Server ruby.social

@aesthetikx Since I think the untuned defaults are often silly, I avoid it and didn't realize this was even a question until I saw your post. I think you should always do whatever clearly expresses the programmer's intent most clearly to the rest of your team, but a famous writer (RAH?) once said something like "obsessive consistency is the hobgoblin of little minds."

Be semantically clear. Don' let It prevent you from raising or failing when that makes more sense, though.

#rubocop

Last updated 1 year ago

François · @francois
46 followers · 170 posts · Server ruby.social

Has anyone built a to assert that all event handlers are subscribed to the domain events they expect to receive? If not, I wrote something that might be extractable.

I found 5 event handlers out of 20 that expected some domain events but weren’t wired up properly!

#rubocop #railseventstore

Last updated 1 year ago

deSilva · @aesthetikx
43 followers · 259 posts · Server ruby.social

I'm wondering about the communities preference on the controversial EnforcedStyle for Style/SignalException... I want to switch to semantic, where you `fail` exceptions, but then `raise` them if you are already in a rescue block.

#rubocop #ruby

Last updated 1 year ago

Camilo · @cam
234 followers · 1662 posts · Server hachyderm.io

All right, StandardRb v1.29.0 is up and out!

A whole host of rules enabled to simplify your life and reduce code redundancy, like array constructors with arrays in them! regex constructors with regex in them! kablow! gone!

Standard-performance is now up to date with rubocop-performance as well, so enjoy those bugfixes.

🔗 rubygems.org/gems/standard/ver

#ruby #rails #rubyonrails #standardrails #rubocop

Last updated 1 year ago

postmodern · @postmodern
1261 followers · 1726 posts · Server ruby.social

Ugh, rubocop is claiming `URI.regexp` is obsolete, and that I should use `URI::DEFAULT_PARSER.make_regexp('https')`. Is this true? The official Ruby 3.2 docs don't seem to mention this.
docs.ruby-lang.org/en/3.2/URI.

#rubocop

Last updated 1 year ago

Shane Becker · @veganstraightedge
72 followers · 64 posts · Server ruby.social

help!?

I have a Rails app.
It has an engine (/engines/admin).

When I run `rubocop --auto-gen-config`, it doesn't create entries for failures in the admin engine.

When I run `rubocop`, it tells me about the failures (that weren't added to the root todo file).

How do I tell Rubocop about my engine at `todo` time and at `check` time?

#lazyweb #rails #rubocop

Last updated 1 year ago

postmodern · @postmodern
1242 followers · 1559 posts · Server ruby.social

I'm curious if there's a rubocop rule for checking if a `to_s` method contains memoization. This could cause problems if an object is converted to a String and then the String is mutated, which then modifies the cached version of the String.

#rubocop

Last updated 2 years ago

Derek Robinson · @paterasilk
6 followers · 10 posts · Server fosstodon.org

Is there a tool for or to check for deprecated code? I’m migrating some code from 2.5 to 3.2 and I’ve only found this article from 2014 that mentions it’s a difficult problem (understandably!)

batsov.com/articles/2014/02/05

#ruby #rubocop

Last updated 2 years ago

Carlos A. · @gerbosan
13 followers · 21 posts · Server ruby.social

This is interesting: 🤔 reddit.com/r/rails/comments/11
well, not just the topic but the content too.

#ruby #rubocop #codestyle

Last updated 2 years ago

postmodern · @postmodern
1159 followers · 1188 posts · Server ruby.social

Awesome. Made my first rubocop gem that contains all of the custom configuration and overrides.
github.com/ronin-rb/rubocop-ro

#rubocop

Last updated 2 years ago

postmodern · @postmodern
1159 followers · 1184 posts · Server ruby.social

Or maybe I should try creating my own rubocop extension gem? Apparently it's possible to package one's `.rubocop.yml` up into a gem.
github.com/Shopify/ruby-style-

#rubocop

Last updated 2 years ago

postmodern · @postmodern
1159 followers · 1181 posts · Server ruby.social

Another rubocop bummer, `Layout/ExtraSpacing` only checks non-commented lines of code. If you have one line of code followed by commented out lines, all of which are vertically aligned with each other, rubocop will claim the first line has excess spacing in between it's arguments.

```ruby
gem 'foo', '~> 0.1'
# gem 'bar', '~> 0.2'
# gem 'baz', '~> 0.3'
```

#rubocop

Last updated 2 years ago

postmodern · @postmodern
1158 followers · 1179 posts · Server ruby.social

I wish rubocop's `Layout/ParameterAlignment` could be aware of vertically aligned keyword arguments that follow a positional argument:

```ruby
def foo(a,b, bar: nil,
baz: nil,
qux: nil)
end
```

Aligning the keyword arguments to the first argument breaks the alignment with the keyword argument names.

#rubocop

Last updated 2 years ago

postmodern · @postmodern
1158 followers · 1178 posts · Server ruby.social

Found an interesting bug in rubocop: `%{%{0}}`. This time I am pretty sure this is a bug. Ruby does allow `%{} to exist within `%{ ... }` string literals. However, rubocop seems to think it's a format string of some sort?
github.com/rubocop/rubocop/iss

#rubocop

Last updated 2 years ago

postmodern · @postmodern
1158 followers · 1177 posts · Server ruby.social

Ugh, `Lint/MissingSuper` should not flag code where the superclass does not define it's own initialize method.

#rubocop

Last updated 2 years ago

postmodern · @postmodern
1158 followers · 1174 posts · Server ruby.social

I'm also curious whether `Style/MutableConstant` actually catches legitimate bugs? I feel like most people either intend a constant to be mutable, or never intentionally modify a constant.

#rubocop

Last updated 2 years ago