Skip to content
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

Use add_global_offense for ForbidRBIOutsideOfAllowedPaths #251

Merged
merged 1 commit into from
Jul 30, 2024

Conversation

Earlopain
Copy link
Contributor

The previous add_offense errors when the file is empty: Range 0..1 makes no sense in that context. The error occurs during output:

test.rbi:1:1: C: Sorbet/ForbidRBIOutsideOfAllowedPaths: RBI file path should match one of: rbi/**, sorbet/rbi/**
index 0 outside of array bounds: 0...0

add_global_offense was added for Rubocop v1 which is great since 1.0.0 is now the minimum required version.

Why even bother?

I created a new rbi file for testing and ruby-lsp runs over it with rubocop immediatly which means it will error.

The previous `add_offense` errors when the file is empty: Range 0..1 makes no sense in that context.

`add_global_offense` was added for Rubocop v1 which is great since 1.0.0 is now the minimum required version
@Earlopain Earlopain requested a review from a team as a code owner July 29, 2024 15:19
Copy link
Contributor

@KaanOzkan KaanOzkan left a comment

Choose a reason for hiding this comment

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

It makes sense to me to not have a location for these offenses.

@KaanOzkan KaanOzkan merged commit c29f633 into Shopify:main Jul 30, 2024
5 checks passed
@andyw8
Copy link
Contributor

andyw8 commented Jul 30, 2024

This makes me realize that Ruby LSP doesn't have a way to show 'global' offenses:

Shopify/ruby-lsp#2388

@Earlopain Earlopain deleted the global-offense-rbi-path branch July 30, 2024 15:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants