You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Defined public on the top level, without being inside a class. But rubocop gives an error. Though if the file only has the one line that says "public" it doesn't error out.
error appears when:
public
def create_key_asymmetric_decrypt project_id:, location_id:, key_ring_id:, id:
# [START kms_create_key_asymmetric_decrypt]
# TODO(developer): uncomment these values before running the sample.
# project_id = "my-project"
# location_id = "us-east1"
# key_ring_id = "my-key-ring"
# id = "my-asymmetric-decrypt-key"
# Require the library.
require "google/cloud/kms"
# Create the client.
client = Google::Cloud::Kms.key_management_service
# Build the parent key ring name.
key_ring_name = client.key_ring_path project: project_id, location: location_id, key_ring: key_ring_id
# Build the key.
key = {
purpose: :ASYMMETRIC_DECRYPT,
version_template: {
algorithm: :RSA_DECRYPT_OAEP_2048_SHA256
}
}
# Call the API.
created_key = client.create_crypto_key parent: key_ring_name, crypto_key_id: id, crypto_key: key
puts "Created asymmetric decryption key: #{created_key.name}"
# [END kms_create_key_asymmetric_decrypt]
created_key
end
no errors:
public
error:
public
def test_method
puts "testing if it errors out"
end
Fixesrubocop#9606.
This PR fixes the following error for `Layout/IndentationConsistency`
when using access modifier at the top level.
```console
% cat example.rb
public
def foo
end
% bundle exec rubocop --only Layout/IndentationConsistency example.rb -d
(snip)
Scanning /Users/koic/src/github.com/koic/rubocop-issues/9606/example.rb
An error occurred while Layout/IndentationConsistency cop was inspecting
/Users/koic/src/github.com/koic/rubocop-issues/9606/example.rb:1:0.
undefined method `source_range' for nil:NilClass
/Users/koic/src/github.com/rubocop/rubocop/lib/rubocop/cop/layout/indentation_consistency.rb:165:in
`base_column_for_normal_style'
/Users/koic/src/github.com/rubocop/rubocop/lib/rubocop/cop/layout/indentation_consistency.rb:181:in
`check_normal_style'
/Users/koic/src/github.com/rubocop/rubocop/lib/rubocop/cop/layout/indentation_consistency.rb:174:in
`check'
/Users/koic/src/github.com/rubocop/rubocop/lib/rubocop/cop/layout/indentation_consistency.rb:129:in
`on_begin'
```
Fixes#9606.
This PR fixes the following error for `Layout/IndentationConsistency`
when using access modifier at the top level.
```console
% cat example.rb
public
def foo
end
% bundle exec rubocop --only Layout/IndentationConsistency example.rb -d
(snip)
Scanning /Users/koic/src/github.com/koic/rubocop-issues/9606/example.rb
An error occurred while Layout/IndentationConsistency cop was inspecting
/Users/koic/src/github.com/koic/rubocop-issues/9606/example.rb:1:0.
undefined method `source_range' for nil:NilClass
/Users/koic/src/github.com/rubocop/rubocop/lib/rubocop/cop/layout/indentation_consistency.rb:165:in
`base_column_for_normal_style'
/Users/koic/src/github.com/rubocop/rubocop/lib/rubocop/cop/layout/indentation_consistency.rb:181:in
`check_normal_style'
/Users/koic/src/github.com/rubocop/rubocop/lib/rubocop/cop/layout/indentation_consistency.rb:174:in
`check'
/Users/koic/src/github.com/rubocop/rubocop/lib/rubocop/cop/layout/indentation_consistency.rb:129:in
`on_begin'
```
Defined public on the top level, without being inside a class. But rubocop gives an error. Though if the file only has the one line that says "public" it doesn't error out.
error appears when:
no errors:
error:
Steps to reproduce the problem
file and code can be found here: https://github.com/googleapis/google-cloud-ruby/blob/master/google-cloud-kms/samples/snippets.rb
RuboCop version
The text was updated successfully, but these errors were encountered: