this post was submitted on 24 Jul 2023
8 points (100.0% liked)

Ruby

525 readers
1 users here now

A community for discussion and news about Ruby programming.

Learning Ruby?

Tools

Documentation

Books

Screencasts

News and updates

founded 1 year ago
MODERATORS
 

Hey guys, I use rubocop linter with vs code extension. I have a rails 6 app with ruby 3 but some files in vendor/ are symlinks from legacy code which were written in ruby 2. I have to make sure my team doesn't write any ruby 3 specific methods inside this folder cuz since it's a symlink, it's used by other apps with ruby 2 as well. How do i configure my linter for this?

top 2 comments
sorted by: hot top controversial new old
[–] Synthead@lemmy.world 2 points 1 year ago* (last edited 1 year ago)

Assuming it's properly tested, I would simply run the tests that apply to the code in this directory with the versions of Ruby you're trying to ensure compatibility with.

If you're using GitHub Actions for CI, then you can create jobs for each version of Ruby you're trying to use. Then, ensure your default branch is protected, and set your branch protections only allows PRs to merge that pass CI.

This will also ensure that Ruby 3.x.x works with your current code, too. Some things have been deprecated, i.e. File#exists? has been removed in favor of File#exist?

Also, this sounds like a good case of submodules, if this code is used for various projects.

[–] Glarrf@midwest.social 1 points 1 year ago

Oof, that's a bit odd. My personal preference would be to write your code as a gem and that way you can easily control all of its behaviors. That's what gems are for

load more comments
view more: next ›