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

Always freeze #arguments #91

Merged
merged 2 commits into from Aug 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/rubocop.yml
Expand Up @@ -25,9 +25,9 @@ jobs:
title: [ null ]
include:
- { os: windows, rubocop: master, ruby: mingw }
- { rubocop: '0.87.0', ruby: 2.4, os: ubuntu }
- { rubocop: '0.87.0', ruby: head, os: ubuntu }
- { rubocop: '0.87.0', ruby: 2.4, os: ubuntu, coverage: true, title: 'Coverage' }
- { rubocop: '0.89.0', ruby: 2.4, os: ubuntu }
- { rubocop: '0.89.0', ruby: head, os: ubuntu }
- { rubocop: '0.89.0', ruby: 2.4, os: ubuntu, coverage: true, title: 'Coverage' }
- { rubocop: master, ruby: 2.7, os: ubuntu, modern: true, title: 'Specs "modern"' }
- { rubocop: master, ruby: 2.7, os: ubuntu, internal_investigation: true, modern: true, title: 'Coding Style' }

Expand Down Expand Up @@ -87,7 +87,7 @@ jobs:
matrix:
os: [ ubuntu ]
ruby: [ 2.4, 2.7 ]
rubocop: [ '0.87.0', master ]
rubocop: [ '0.89.0', master ]

steps:
- name: checkout
Expand Down
10 changes: 5 additions & 5 deletions .mergify.yml
Expand Up @@ -14,14 +14,14 @@ pull_request_rules:
- 'status-success=Specs | RuboCop: master | 2.7 (ubuntu)'
- 'status-success=Specs | RuboCop: master | head (ubuntu)'
- 'status-success=Specs | RuboCop: master | mingw (windows)'
- 'status-success=Specs | RuboCop: 0.87.0 | 2.4 (ubuntu)'
- 'status-success=Specs | RuboCop: 0.87.0 | head (ubuntu)'
- 'status-success=Coverage | RuboCop: 0.87.0 | 2.4 (ubuntu)'
- 'status-success=Specs | RuboCop: 0.89.0 | 2.4 (ubuntu)'
- 'status-success=Specs | RuboCop: 0.89.0 | head (ubuntu)'
- 'status-success=Coverage | RuboCop: 0.89.0 | 2.4 (ubuntu)'
- 'status-success=Specs "modern" | RuboCop: master | 2.7 (ubuntu)'
- 'status-success=Coding Style | RuboCop: master | 2.7 (ubuntu)'
- 'status-success=Main Gem Specs | RuboCop: 0.87.0 | 2.4 (ubuntu)'
- 'status-success=Main Gem Specs | RuboCop: 0.89.0 | 2.4 (ubuntu)'
- 'status-success=Main Gem Specs | RuboCop: master | 2.4 (ubuntu)'
- 'status-success=Main Gem Specs | RuboCop: 0.87.0 | 2.7 (ubuntu)'
- 'status-success=Main Gem Specs | RuboCop: 0.89.0 | 2.7 (ubuntu)'
- 'status-success=Main Gem Specs | RuboCop: master | 2.7 (ubuntu)'

- name: delete head branch after auto-merge
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -13,6 +13,7 @@
### Changes

* [#94](https://github.com/rubocop-hq/rubocop-ast/pull/94): In Ruby 2.4, `Set#===` is harmonized with Ruby 2.5+ to call `include?`. ([@marcandre][])
* [#91](https://github.com/rubocop-hq/rubocop-ast/pull/91): **(Potentially breaking)** `Node#arguments` always returns a frozen array ([@marcandre][])

## 0.3.0 (2020-08-01)

Expand Down
2 changes: 1 addition & 1 deletion lib/rubocop/ast/node/block_node.rb
Expand Up @@ -25,7 +25,7 @@ def send_node
# @return [Array<Node>]
def arguments
if numblock_type?
[] # Numbered parameters have no block arguments.
[].freeze # Numbered parameters have no block arguments.
else
node_parts[1]
end
Expand Down
4 changes: 2 additions & 2 deletions lib/rubocop/ast/node/mixin/parameterized_node.rb
Expand Up @@ -82,9 +82,9 @@ def arguments
# and optimizes other calls
module RestArguments
include ParameterizedNode
# @return [Array] arguments, if any
# @return [Array<Node>] arguments, if any
def arguments
children[first_argument_index..-1]
children[first_argument_index..-1].freeze
end

# A shorthand for getting the first argument of the node.
Expand Down