Skip to content

Address Rubocop Performance Offenses - #26112

Merged
tisba merged 6 commits into
devfrom
rubocop-performance-offenses
Oct 19, 2026
Merged

tisba merged 6 commits into
devfrom
rubocop-performance-offenses

Conversation

@tisba

@tisba tisba commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Ticket

Passion Time? :)

What are you trying to accomplish?

Improving code quality and performance.

I removed the no-op config to disable Performance/Casecmp, as it has been retired (disabled by default) some years ago (see rubocop/rubocop-performance#443).

What approach did you choose and why?

I ran rubocop with --only Performance app modules, skipping Specs for now, to keep changes smaller. Every commit addresses only offenses of one cop.

While I don't know how hot these code paths are, basically all changes reduce object allocations.

Using Object.method for mapping or in other cases is very expensive (about ~2x slower compared to direct invocation) and should generally be avoided if possible. As an added benefit it makes code navigation for IDE/LSP better.

AI involvement

none

Merge checklist

  • Added/updated tests
  • Added/updated documentation in Lookbook (patterns, previews, etc)
  • Tested major browsers (Chrome, Firefox, Edge, ...)

@github-actions

Copy link
Copy Markdown

Warning

This pull request does not link an OpenProject work package.

Please add a link to the work package in the description, or reference it in the
title in square brackets, e.g. [SLUG-123] My title here.

@myabc myabc added ruby Pull requests that update Ruby code rubocop 👮 Just rubocop fixes labels Oct 16, 2026
@tisba
tisba force-pushed the rubocop-performance-offenses branch from 845dc38 to d81ee11 Compare October 16, 2026 16:00
@tisba
tisba force-pushed the rubocop-performance-offenses branch from d81ee11 to dcab0bd Compare October 16, 2026 16:00

@myabc myabc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess it would be worth quietening some of the pre-existing, non-performance Rubocop issues (e.g. AbcSize) – just to get a green build.

@tisba
tisba force-pushed the rubocop-performance-offenses branch from dcab0bd to f1f5004 Compare October 16, 2026 16:13
@tisba

tisba commented Oct 16, 2026

Copy link
Copy Markdown
Contributor Author

I guess it would be worth quietening some of the pre-existing, non-performance Rubocop issues (e.g. AbcSize) – just to get a green build.

yeah, I touched code that's 16 years old in some cases.

@myabc

myabc commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

yeah, I touched code that's 16 years old in some cases.

I know! that deserves extra kudos!

@klaustopher klaustopher left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@tisba
tisba merged commit 687b613 into dev Oct 19, 2026
14 of 15 checks passed
@tisba
tisba deleted the rubocop-performance-offenses branch October 19, 2026 07:41
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 19, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

rubocop 👮 Just rubocop fixes ruby Pull requests that update Ruby code

Development

Successfully merging this pull request may close these issues.

3 participants