Skip to content

Change deprecated File.exists? to File.exist?#399

Merged
ko1 merged 1 commit intoruby:masterfrom
ybiquitous:fix-file-exists
Nov 18, 2021
Merged

Change deprecated File.exists? to File.exist?#399
ko1 merged 1 commit intoruby:masterfrom
ybiquitous:fix-file-exists

Conversation

@ybiquitous
Copy link
Contributor

Description

The File.exists? method has been deprecated.
See https://docs.ruby-lang.org/en/2.7.0/File.html#method-c-exists-3F

FYI. I found the problem via RuboCop as below:

$ bundle add rubocop
...

$ bundle exec rubocop --only Lint/DeprecatedClassMethods
...
lib/debug/console.rb:162:26: W: [Correctable] Lint/DeprecatedClassMethods: File.exists? is deprecated in favor of File.exist?.
      if history && File.exists?(path = history_file)
                         ^^^^^^^

62 files inspected, 1 offense detected, 1 offense auto-correctable

The `File.exists?` method has been deprecated.
See https://docs.ruby-lang.org/en/2.7.0/File.html#method-c-exists-3F

FYI. I found the problem via RuboCop as below:

```console
$ bundle add rubocop
...

$ bundle exec rubocop --only Lint/DeprecatedClassMethods
...
lib/debug/console.rb:162:26: W: [Correctable] Lint/DeprecatedClassMethods: File.exists? is deprecated in favor of File.exist?.
      if history && File.exists?(path = history_file)
                         ^^^^^^^

62 files inspected, 1 offense detected, 1 offense auto-correctable
```
@ko1 ko1 merged commit 8f6f026 into ruby:master Nov 18, 2021
@ko1
Copy link
Collaborator

ko1 commented Nov 18, 2021

Thank you!

@ybiquitous ybiquitous deleted the fix-file-exists branch November 18, 2021 14:51
@ybiquitous
Copy link
Contributor Author

@ko1 Thank you for the quick merge! 😄

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