Skip to content

Conversation

skryukov
Copy link
Contributor

@skryukov skryukov commented Sep 1, 2025

TODO is something we should actually do. This PR fixes all RuboCop offenses.

else
# This gem supports Rails 5 or later
module InertiaRails
module InertiaDebugExceptions
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Dropped the patch for Rails < 5.1 since Inertia Rails requires Rails 6+

@BrandonShar BrandonShar requested a review from Copilot October 11, 2025 03:17
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR removes the RuboCop todo configuration and fixes all outstanding RuboCop offenses in the codebase. The changes bring the code into compliance with the project's style guidelines by addressing formatting, syntax, and naming issues across numerous Ruby files.

  • Adds frozen_string_literal comments to all Ruby files
  • Fixes string literal consistency (single quotes preferred)
  • Corrects spacing, indentation, and hash syntax issues

Reviewed Changes

Copilot reviewed 71 out of 78 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
.rubocop_todo.yml Removed entire RuboCop todo configuration file
.rubocop.yml Removed inheritance from rubocop_todo.yml
spec/support/shared_examples.rb Added frozen_string_literal comment
spec/rails_helper.rb Fixed string literals and file path expansion
spec/inertia/rspec_helper_spec.rb Corrected hash spacing, block syntax, and string literals
spec/inertia/response_spec.rb Fixed string literal consistency
spec/inertia/request_spec.rb Improved hash syntax and block formatting
spec/inertia/rendering_spec.rb Fixed line length issues with array formatting
spec/inertia/rails_mimic_spec.rb Cleaned up hash syntax and whitespace
lib files Added frozen_string_literal and fixed various style issues
spec/dummy files Added frozen_string_literal and standardized string literals

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +37 to +43
expect(JSON.parse(response.body)['props'].symbolize_keys).to eq(show_only_props.merge(normal_shared_prop: 1))

get conditional_share_index_path, headers: {'X-Inertia' => true}
expect(JSON.parse(response.body)['props'].deep_symbolize_keys).to eq(index_only_props.merge(normal_shared_prop: 1))
get conditional_share_index_path, headers: { 'X-Inertia' => true }
expect(JSON.parse(response.body)['props'].symbolize_keys).to eq(index_only_props.merge(normal_shared_prop: 1))

get conditional_share_edit_path, headers: { 'X-Inertia' => true }
expect(JSON.parse(response.body)['props'].deep_symbolize_keys).to eq(edit_only_props.merge(normal_shared_prop: 1))
expect(JSON.parse(response.body)['props'].symbolize_keys).to eq(edit_only_props.merge(normal_shared_prop: 1))
Copy link

Copilot AI Oct 11, 2025

Choose a reason for hiding this comment

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

The method symbolize_keys should be deep_symbolize_keys to match the original functionality. The change from deep_symbolize_keys to symbolize_keys could cause test failures if nested hash keys need to be symbolized.

Copilot uses AI. Check for mistakes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

there are no nested keys present in the test data

'`lazy` is deprecated and will be removed in InertiaRails 4.0, use `optional` instead.'
)

@value = value
Copy link

Copilot AI Oct 11, 2025

Choose a reason for hiding this comment

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

The line @block = block was removed and replaced with super(&block), but the @block instance variable is still referenced in line 16 (@block&.call(params)). This will cause the call method to fail.

Suggested change
@value = value
@value = value
@block = block

Copilot uses AI. Check for mistakes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

block is set in the base class

Comment on lines +13 to +15
module InertiaRails
module InertiaDebugExceptions
def render_for_browser_request(request, wrapper)
Copy link

Copilot AI Oct 11, 2025

Choose a reason for hiding this comment

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

The patch consolidation removes separate version-specific patches but may break compatibility with older Rails versions. The code now assumes all Rails versions support render_for_browser_request method.

Copilot uses AI. Check for mistakes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we do not support Rails < 6, so it's fine

@BrandonShar
Copy link
Collaborator

@skryukov what do you think about the copilot review? the keys change does jump out, was that not needed or is rubocop getting heavy handed?

Copy link
Contributor Author

@skryukov skryukov left a comment

Choose a reason for hiding this comment

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

@BrandonShar nope, the PR looks good

'`lazy` is deprecated and will be removed in InertiaRails 4.0, use `optional` instead.'
)

@value = value
Copy link
Contributor Author

Choose a reason for hiding this comment

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

block is set in the base class

Comment on lines +13 to +15
module InertiaRails
module InertiaDebugExceptions
def render_for_browser_request(request, wrapper)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

we do not support Rails < 6, so it's fine

Comment on lines +37 to +43
expect(JSON.parse(response.body)['props'].symbolize_keys).to eq(show_only_props.merge(normal_shared_prop: 1))

get conditional_share_index_path, headers: {'X-Inertia' => true}
expect(JSON.parse(response.body)['props'].deep_symbolize_keys).to eq(index_only_props.merge(normal_shared_prop: 1))
get conditional_share_index_path, headers: { 'X-Inertia' => true }
expect(JSON.parse(response.body)['props'].symbolize_keys).to eq(index_only_props.merge(normal_shared_prop: 1))

get conditional_share_edit_path, headers: { 'X-Inertia' => true }
expect(JSON.parse(response.body)['props'].deep_symbolize_keys).to eq(edit_only_props.merge(normal_shared_prop: 1))
expect(JSON.parse(response.body)['props'].symbolize_keys).to eq(edit_only_props.merge(normal_shared_prop: 1))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

there are no nested keys present in the test data

@BrandonShar
Copy link
Collaborator

Thanks for double checking! Good luck anyone with an open PR, here come spacing conflicts 😄

@BrandonShar BrandonShar merged commit 8ed3740 into inertiajs:master Oct 12, 2025
33 checks passed
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.

2 participants