summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)Author
2025-03-13[ruby/prism] Optimize array inclusion checks in the parser translatorEarlopain
I see `Array.include?` as 2.4% runtime. Probably because of `LPAREN_CONVERSION_TOKEN_TYPES` but the others will be faster as well. Also remove some inline array checks. They are specifically optimized in Ruby since 3.4, but for now prism is for >= 2.7 https://github.com/ruby/prism/commit/ca9500a3fc
2025-03-13[ruby/prism] Ensure backwards compatibility with the custom parser builderEarlopain
Temoprary backwards-compat code so that current users don't break. Eventually the Translation::Parser initializer should asser that the correct class is passed in. https://github.com/ruby/prism/commit/66b0162b35
2025-03-13[rubygems/rubygems] Remove array allocation from Candidate#<=>Hartley McGuire
In a large application I profiled allocations while running `bundle update` and found that this method was ~60% of allocations while resolving (and Candidate#<=> is almost half of the total runtime). This commit removes the array allocation in Candidate#<=> (and similar methods since the implementations are so simple). The array is always the same two elements so they can just be compared directly. https://github.com/rubygems/rubygems/commit/6a7c411ba7
2025-03-12[ruby/prism] Revert "Mark extension as Ractor-safe"Kevin Newton
https://github.com/ruby/prism/commit/56eaf53732
2025-03-12[ruby/prism] Mark extension as Ractor-safeKevin Newton
https://github.com/ruby/prism/commit/10e5431b38
2025-03-12[rubygems/rubygems] Update docs for with/without consistencyJacob Atzen
The with and without flags accepts both comma and space separated values. https://github.com/rubygems/rubygems/commit/b6149f61e3
2025-03-12[rubygems/rubygems] Fix `ENAMETOOLONG` error when creating compact index cacheDavid Rodríguez
If a custom rubygems source URI is long enough, Bundler may end up raising an `ENAMETOOLONG` error and crash. This commit fixes the problem by trimming the cache slug size to fit usual OS requirements. https://github.com/rubygems/rubygems/commit/df40ff1e14 Co-authored-by: mbclu <[email protected]> Co-authored-by: martinemde <[email protected]>
2025-03-10[ruby/prism] Support `itblock` for `Prism::Translation::Parser`Koichi ITO
## Summary `itblock` node is added to support the `it` block parameter syntax introduced in Ruby 3.4. ```console $ ruby -Ilib -rprism -rprism/translation/parser34 -e 'buffer = Parser::Source::Buffer.new("path"); buffer.source = "proc { it }"; \ p Prism::Translation::Parser34.new.tokenize(buffer)[0]' s(:itblock, s(:send, nil, :proc), :it, s(:lvar, :it)) ``` This node design is similar to the `numblock` node, which was introduced for the numbered parameter syntax in Ruby 2.7. ``` $ ruby -Ilib -rprism -rprism/translation/parser34 -e 'buffer = Parser::Source::Buffer.new("path"); buffer.source = "proc { _1 }"; \ p Prism::Translation::Parser34.new.tokenize(buffer)[0]' s(:numblock, s(:send, nil, :proc), 1, s(:lvar, :_1)) ``` The difference is that while numbered parameters can have multiple parameters, the `it` block parameter syntax allows only a single parameter. In Ruby 3.3, the conventional node prior to the `it` block parameter syntax is returned. ```console $ ruby -Ilib -rprism -rprism/translation/parser33 -e 'buffer = Parser::Source::Buffer.new("path"); buffer.source = "proc { it }"; \ p Prism::Translation::Parser33.new.tokenize(buffer)[0]' s(:block, s(:send, nil, :proc), s(:args), s(:send, nil, :it)) ``` ## Development Note The Parser gem does not yet support the `it` block parameter syntax. This is the first case where Prism's node design precedes that of the Parser gem. When implementing https://github.com/whitequark/parser/issues/962, this node design will need to be taken into consideration. https://github.com/ruby/prism/commit/c141e1420a
2025-03-10[ruby/optparse] bump up to 0.7.0.dev.1 [ci skip]Nobuyoshi Nakada
https://github.com/ruby/optparse/commit/f4d64b0b17
2025-03-10[ruby/optparse] [DOC] Extract description from READMENobuyoshi Nakada
https://github.com/ruby/optparse/commit/83e8c23d68
2025-03-10[ruby/optparse] Fix LESS environment variable setup in OptionParser#help_exitKouhei Yanagita
If the original value of LESS ends with an option starting with "--", simply appending "Fe" would result in an invalid option string. https://github.com/ruby/optparse/commit/30571f91d3
2025-03-10[ruby/optparse] Make the result of `tty?` obtainable with flexible stdoutKoichi ITO
In mock testing for stdout, `StringIO.new` is sometimes used to redirect the output. In such cases, the assignment is done with `$stdout = StringIO.new`, not the constant `STDOUT`. e.g., https://github.com/rubocop/rubocop/blob/v1.71.1/lib/rubocop/rspec/shared_contexts.rb#L154-L164 After assigning `StringIO.new`, `$stdout.tty?` returns `false`, allowing the standard output destination to be switched during test execution. ```ruby STDOUT.tty? # => true StringIO.new.tty? # => false ``` However, since `STDOUT.tty?` returns `true`, a failure occurred in environments where the environment variables `RUBY_PAGER` or `PAGER` are set. e.g., https://github.com/rubocop/rubocop/pull/13784 To address this, `STDOUT` has been updated to `$stdout` so that the result of `tty?` can be flexibly overridden. A potential concern is that `$stdout`, unlike `STDOUT`, does not always represent the standard output at the time the Ruby process started. However, no concrete examples of issues related to this have been identified. `STDOUT.tty?` is the logic of optparse introduced in https://github.com/ruby/optparse/pull/70. This PR replaces `STDOUT` with `$stdout` throughout, based on the assumption that `$stdout` is sufficient for use with optparse. https://github.com/ruby/optparse/commit/262cf6f9ac
2025-03-10[ruby/optparse] Add post-check of valueNobuyoshi Nakada
Fix https://github.com/ruby/optparse/pull/80 https://github.com/ruby/optparse/commit/050a87d029
2025-03-10[ruby/optparse] Update argument check with save navigation operatorNobuyoshi Nakada
https://github.com/ruby/optparse/commit/71e2b31824
2025-03-10[ruby/optparse] Remove extra blank lines [ci skip]Nobuyoshi Nakada
https://github.com/ruby/optparse/commit/d7dec6808f
2025-03-10[ruby/optparse] [DOC] Update documents to use single quotes instead of ↵Nobuyoshi Nakada
backqoutes https://github.com/ruby/optparse/commit/5e71a70cb5
2025-03-10[rubygems/rubygems] Fix `gem rdoc` not working with newer versions of rdocDavid Rodríguez
https://github.com/rubygems/rubygems/commit/369f9b9311 Notes: Merged: https://github.com/ruby/ruby/pull/12890
2025-03-10[rubygems/rubygems] Don't treat a git-sourced gem install as complete if ↵Tara Bass
only the '.git' directory is present. This recovers cases where a git-sourced install can be left in a partially installed state. https://github.com/rubygems/rubygems/commit/d132b7008d Notes: Merged: https://github.com/ruby/ruby/pull/12890
2025-03-10[rubygems/rubygems] Switch inject to use shorthand hash syntaxSean Collins
https://github.com/rubygems/rubygems/commit/ba5a62fd04 Notes: Merged: https://github.com/ruby/ruby/pull/12890
2025-03-10[rubygems/rubygems] Use shorthand hash syntax for bundle addSean Collins
https://github.com/rubygems/rubygems/commit/9691097036 Notes: Merged: https://github.com/ruby/ruby/pull/12890
2025-03-09[ruby/optparse] Allow non-string enum list #79Nobuyoshi Nakada
Command line arguments are strings, convert enum list elements to strings to match. https://github.com/ruby/optparse/commit/c5ec052efc
2025-03-09[ruby/optparse] Use `\A` instead of `^` as the beginning of stringNobuyoshi Nakada
https://github.com/ruby/optparse/commit/a3f1029815
2025-03-09[ruby/optparse] [DOC] Manage rdoc options only in .rdoc_options fileNobuyoshi Nakada
Make `rdoc .` and `rake rdoc` consistent. https://github.com/ruby/optparse/commit/61b4ea0704
2025-03-03[rubygems/rubygems] docs(bundle-exec): recommend non-deprecated methodsMichael Chui
https://github.com/rubygems/rubygems/commit/3b4934fb69 Notes: Merged: https://github.com/ruby/ruby/pull/12840
2025-03-03[rubygems/rubygems] docs(bundle-config): hint default group when using only ↵Mateo
option https://github.com/rubygems/rubygems/commit/c258e45b44 Notes: Merged: https://github.com/ruby/ruby/pull/12840
2025-03-03[rubygems/rubygems] Bring man pages up to dateJosef Šimánek
https://github.com/rubygems/rubygems/commit/591d2c0503 Notes: Merged: https://github.com/ruby/ruby/pull/12840
2025-03-03[rubygems/rubygems] Update vendored uri to 1.0.3Hiroshi SHIBATA
https://github.com/rubygems/rubygems/commit/176dc7421c Notes: Merged: https://github.com/ruby/ruby/pull/12840
2025-02-28[rubygems/rubygems] Retry gracefully on blank partial response in compact indexMartin Emde
https://github.com/rubygems/rubygems/commit/fafb9ae090
2025-02-27[ruby/cgi] Bump up v0.4.2Hiroshi SHIBATA
https://github.com/ruby/cgi/commit/ab84b7fe66
2025-02-27[ruby/cgi] Bump up 0.4.2.beta2Hiroshi SHIBATA
https://github.com/ruby/cgi/commit/8e6fb1041b
2025-02-27[rubygems/rubygems] Remove MD5 digesting of compact index responsesMartin Emde
It has been over a year since the release, so let's stop MD5ing everything https://github.com/rubygems/rubygems/commit/29ef4ca30b
2025-02-27[rubygems/rubygems] Improve error message when on read-only filesystemsDavid Rodríguez
If we fail to write the lockfile, give a better error. https://github.com/rubygems/rubygems/commit/81a08d6eda
2025-02-27[ruby/uri] Use a fully qualified name in warning messagesyuuji.yaginuma
Currently, some warning messages don't contain a `URI` like the following. ```ruby warning: URI::ABS_URI is obsolete. Use RFC2396_PARSER.regexp[:ABS_URI] explicitly. ``` But, without `URI` prefix, the suggested value doesn't work. So I think we should use a fully qualified name to avoid confusion. https://github.com/ruby/uri/commit/428eb10e44
2025-02-27[ruby/uri] Fix the mention to removed `URI.escape/URI::Escape`Yuji Yaginuma
This was removed by #9. https://github.com/ruby/uri/commit/fec924238f
2025-02-26[ruby/cgi] Escape/unescape unclosed tags as wellHiroshi SHIBATA
https://github.com/ruby/cgi/commit/cd1eb08076 Co-authored-by: Nobuyoshi Nakada <[email protected]>
2025-02-26[ruby/cgi] Use String#concat instead of String#+ for reducing cpu usageHiroshi SHIBATA
https://github.com/ruby/cgi/commit/9907b76dad Co-authored-by: "Yusuke Endoh" <[email protected]>
2025-02-26[ruby/uri] Bump up v1.0.3Hiroshi SHIBATA
https://github.com/ruby/uri/commit/3213f4a0f8
2025-02-26[ruby/uri] Fix merger of URI with authority componentHiroshi SHIBATA
https://hackerone.com/reports/2957667 https://github.com/ruby/uri/commit/2789182478 Co-authored-by: Nobuyoshi Nakada <[email protected]>
2025-02-26[ruby/uri] Truncate userinfo with URI#join, URI#merge and URI#+Hiroshi SHIBATA
https://github.com/ruby/uri/commit/3675494839
2025-02-26[ruby/cgi] Bump up 0.4.2.beta1Hiroshi SHIBATA
https://github.com/ruby/cgi/commit/3f5b4ed9e9
2025-02-25[ruby/prism] Restore a comment for `Prism::Translation::Parser#initialize`Koichi ITO
This restores the missing method comments in https://github.com/ruby/prism/pull/3479. https://github.com/ruby/prism/commit/78b8f67dee
2025-02-25[ruby/prism] Fix merge mishapEarlopain
Caused by https://github.com/ruby/prism/pull/3478 and https://github.com/ruby/prism/pull/3443 I also made the builder reference more explicit to clearly distinquish between `::Parser` and `Prism::Translation::Parser` https://github.com/ruby/prism/commit/d52aaa75b6
2025-02-25[ruby/prism] Add a custom builder class for the parser translatorEarlopain
I want to add new node types to the parser translator, for example `itblock`. The bulk of the work is already done by prism itself. In the `parser` builder, this would be a 5-line change at most but we don't control that here. Instead, we can add our own builder and either overwrite the few methods we need, or just inline the complete builder. I'm not sure yet which would be better. `rubocop-ast` uses its own builder for `parser`. For this to correctly work, it must explicitly choose to extend the prism builder and use it, same as it currently chooses to use a different parser when prism is used. I'd like to enforce that the builder for prism extends its custom one since it will lead to some pretty weird issues otherwise. But first, I'd like to change `rubocop-ast` to make use of this. https://github.com/ruby/prism/commit/b080e608a8
2025-02-25[ruby/prism] Support custom parser in `Prism::Translation::Parser`Koichi ITO
Follow-up to https://github.com/Shopify/ruby-lsp/pull/1849. This is an extension of `Prism::Translation::Parser` to implement https://github.com/Shopify/ruby-lsp/pull/1849. It is based on the comments in https://github.com/Shopify/ruby-lsp/pull/1849#pullrequestreview-1966020868, but also adds a default argument for delegation to `Parser::Base` super class. Using this API, https://github.com/rubocop/rubocop-ast/pull/359 has been implemented in RuboCop AST. As detailed in https://github.com/rubocop/rubocop-ast/pull/359, this change is expected to improve performance by 1.3x for some source code. Achieving a 1.3x speedup with such this simple modification is a significant improvement for Ruby LSP and its users. https://github.com/ruby/prism/commit/925725291c
2025-02-25[rubygems/rubygems] Improve log message about adding a new platformDavid Rodríguez
This message is printed when running `bundle lock --add-platform`. This command affects the lockfile, not the gemfile, and I think it's better to use "You are adding" rather than "You added", because the addition is happening during the current invocation (as opposed to other log messages that talk about a change made to the Gemfile prior to running the command). https://github.com/rubygems/rubygems/commit/aba1e55f5b Notes: Merged: https://github.com/ruby/ruby/pull/12804
2025-02-25[rubygems/rubygems] Refactor handling platform removalsDavid Rodríguez
And make it consistent with platform additions. https://github.com/rubygems/rubygems/commit/64342ae404 Notes: Merged: https://github.com/ruby/ruby/pull/12804
2025-02-25[rubygems/rubygems] Improve log message when resolving due to local platform ↵David Rodríguez
not in lockfile Current it says "you added a new platform to your gemfile", but that's not actually the case here. https://github.com/rubygems/rubygems/commit/1e39527a38 Notes: Merged: https://github.com/ruby/ruby/pull/12804
2025-02-25[rubygems/rubygems] Modify `bundle doctor` to not report issue when files ↵Edouard CHIN
aren't writable: - ### Problem Running `bundle doctor` warn about files that aren't writable. This makes the output of `bundle doctor` very verbose for something I believe isn't really an issue. ### Context Rubygems keeps the files original permission at the time the gem is packaged. Many gem maintainers have decided that the permissions of the files in their bundled would be 0444, this includes amongst others: minitest, selenium, brakeman... Any git gems that had a 0444 permissions at some point in its git history would also be reported (as bundle doctor look in the `cache/bundler/git/<gem>/object` path). While it completely make sense to report when files aren't readable, maybe it's worth questioning the usefulness of reporting files that can't be written and what problem this causes to the user (if any). ### Solution Removed the check for unwritable file. ### Side note I also tweaked the "No issues ..." message logic as it was doing the opposite (reporting an issue when there is none and vice versa). This wasn't caught in tests because as a stub on `Bundler.ui.info` was missing. https://github.com/rubygems/rubygems/commit/9a426b9495 Notes: Merged: https://github.com/ruby/ruby/pull/12804
2025-02-25[ruby/pp] Ensure the thread local state is always set up.Samuel Williams
(https://github.com/ruby/pp/pull/38) https://github.com/ruby/pp/commit/5b5d483ac2
2025-02-21[ruby/cgi] Use license files same as ruby/rubyHiroshi SHIBATA
https://github.com/ruby/cgi/commit/defbdf9a30