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

Fix ruby keyword parameter deprecation warnings #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kindrowboat
Copy link

@kindrowboat kindrowboat commented Jun 9, 2020

In ruby 2.7, using the last argument as keyword parameters became
deprecated in preparation for ruby 3.0. When running the tests, we saw
numerous deprecation warnings. This commit fixes up those deprecation
warnings by explicitly passing the last argument(s) as keyword
argument(s).

See: https://www.ruby-lang.org/en/news/2019/12/12/separation-of-positional-and-keyword-arguments-in-ruby-3-0/

Fixes #4

Side note: this commit did not fix the #binread method because it was
untested, and when attempting to add tests, we got the following failing
test:

1) Pathutil#binread when set to normalize should use encode to convert CRLF to LF
   Failure/Error:
     File.binread(self, *args, kwd).encode({
       :universal_newline => true
     })

   TypeError:
     no implicit conversion of Hash into Integer
   # ./lib/pathutil.rb:509:in `binread'
   # ./lib/pathutil.rb:509:in `binread'
   # ./spec/tests/lib/pathutil_spec.rb:943:in `block (4 levels) in <top (required)>'

...which appears to be occuring because of an interface mismatch as
IO#binread does not take keyword arguments.

https://ruby-doc.org/core-2.7.1/IO.html#method-c-binread

  • I have added or updated the specs/tests.
  • I have verified that the specs/tests pass on my computer.
  • I have not attempted to bump, or alter versions.
  • This is a documentation change.
  • This is a source change.

In ruby 2.7, using the last argument as keyword parameters became
deprecated in preparation for ruby 3.0. When running the tests, we saw
numerous deprecation warnings. This commit fixes up those deprecation
warnings by explicitly passing the last argument(s) as keyword
argument(s).

See: https://www.ruby-lang.org/en/news/2019/12/12/separation-of-positional-and-keyword-arguments-in-ruby-3-0/

Fixes envygeeks#4

Side note: this commit did not fix the `#binread` method because it was
untested, and when attempting to add tests, we got the following failing
test:

```
1) Pathutil#binread when set to normalize should use encode to convert CRLF to LF
   Failure/Error:
     File.binread(self, *args, kwd).encode({
       :universal_newline => true
     })

   TypeError:
     no implicit conversion of Hash into Integer
   # ./lib/pathutil.rb:509:in `binread'
   # ./lib/pathutil.rb:509:in `binread'
   # ./spec/tests/lib/pathutil_spec.rb:943:in `block (4 levels) in <top (required)>'
```

...which appears to be occuring because of an interface mismatch as
`IO#binread` does not take keyword arguments.

https://ruby-doc.org/core-2.7.1/IO.html#method-c-binread
@sdogruyol
Copy link

sdogruyol commented Mar 27, 2021

This now breaks in Ruby 3.0.0, can we get this merged please? @envygeeks

@sukrosono
Copy link

One year and still waiting to be merge, so sad. The author working time is less now for an open-source project?

@martinmorando
Copy link

#5 (comment) @envygeeks

@envygeeks
Copy link
Owner

Hey, I'll take a peek today and try and get this merged for ya'll!

@dancju
Copy link

dancju commented Aug 29, 2021

Any update on this issue? Is there any walkaround?

@7yl4r
Copy link

7yl4r commented Oct 1, 2021

bummmp 🐛

dominicsayers added a commit to dominicsayers/dominicsayers.github.com that referenced this pull request Oct 6, 2021
Jekyll depends on `pathutils` and that contains code that won't run on
Ruby 3. This PR needs to be merged and the maintainer has gone away (?)

envygeeks/pathutil#5
@danielhjacobs
Copy link

danielhjacobs commented Oct 8, 2021

Any update on this issue? Is there any walkaround?

The only walk-around is to make the changes in this PR locally on your pathutil file. Otherwise, if you encountered this issue trying to build Jekyll using Ruby version 3, you'll have to downgrade to Ruby version 2.7.x.

I hope this gets merged soon, but it looks like the owner of this repository is MIA.

@danielhjacobs
Copy link

danielhjacobs commented Feb 20, 2022

@envygeeks Any chance this might be merged? Jekyll depends on pathutil, so it doesn't work on Ruby 3 because of this issue. I don't want to hound you about this issue, but it's been over a year and a half since this PR opened.

@danielhjacobs
Copy link

Jekyll v3.9.2 finally removed Jekyll's main dependency on pathutil (jekyll/jekyll@55e3648). Now that Github Pages updated to that version of Jekyll (see github/pages-gem#833), this issue shouldn't affect Github pages or Jekyll anymore.

@npjohnson
Copy link

@envygeeks this is still very much needed.

22.04 with a bare standard Wiki based on jekyl freaks out without it.

@7yl4r
Copy link

7yl4r commented May 1, 2022

This looks kind of ridiculous. The diff looks small and simple. Why has this been open for over 2 years?

slotThe added a commit to xmonad/xmonad-web that referenced this pull request Aug 30, 2022
So far, what stopped ruby 3.0 working with jekyll was an unmerged PR in
the pathutil package[1].  The maintainer being inactive, jekyll chose to
instead remove this dependency[2] and GitHub pages has also upgraded its
jekyll version to something recent enough now[3].

All that's left to do for us is to add webrick[4] as a dependency to
the Gemfile.

Fixes: #37

[1]: envygeeks/pathutil#5
[2]: jekyll/jekyll@55e3648
[3]: github/pages-gem#833
[4]: jekyll/jekyll#8523
@PeterJCLaw
Copy link

@envygeeks is there anything that external contributors can help with to get this merged?

PeterJCLaw added a commit to srobo/website that referenced this pull request Jan 5, 2023
This isn't officially supported by Jekyll and is a bit hacky, so
I'm deliberately not documenting the support, however as recent
Ubuntu versions now ship with Ruby 3 (not 2.7) and Jekyll isn't
showing any signs of moving towards supporting Ruby 3 we're not
left with many alternatives.

This works around:
- github/pages-gem#752
- envygeeks/pathutil#5
PeterJCLaw added a commit to srobo/website that referenced this pull request Jan 5, 2023
This isn't officially supported by Jekyll and is a bit hacky, so
I'm deliberately not documenting the support, however as recent
Ubuntu versions now ship with Ruby 3 (not 2.7) and Jekyll isn't
showing any signs of moving towards supporting Ruby 3 we're not
left with many alternatives.

This works around:
- github/pages-gem#752
- envygeeks/pathutil#5
dominicsayers added a commit to dominicsayers/dominicsayers.github.com that referenced this pull request Oct 26, 2023
Jekyll depends on `pathutils` and that contains code that won't run on
Ruby 3. This PR needs to be merged and the maintainer has gone away (?)

envygeeks/pathutil#5
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.

pathutil.rb:502: warning: Using the last argument as keyword parameters is deprecated
10 participants