diff --git a/Gemfile.lock b/Gemfile.lock index c83e158d198..36cdae8d310 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -225,9 +225,9 @@ PATH GEM remote: https://rubygems.org/ specs: - addressable (2.8.6) - public_suffix (>= 2.0.2, < 6.0) - ast (2.4.2) + addressable (2.8.8) + public_suffix (>= 2.0.2, < 8.0) + ast (2.4.3) aws-eventstream (1.3.0) aws-partitions (1.877.0) aws-sdk-codecommit (1.63.0) @@ -244,17 +244,17 @@ GEM aws-sigv4 (1.8.0) aws-eventstream (~> 1, >= 1.0.2) base64 (0.2.0) - benchmark (0.4.1) - bigdecimal (3.1.8) + benchmark (0.5.0) + bigdecimal (4.0.1) citrus (3.0.2) - commonmarker (2.3.1-arm64-darwin) - commonmarker (2.3.1-x86_64-linux) - crack (1.0.0) + commonmarker (2.6.3-arm64-darwin) + commonmarker (2.6.3-x86_64-linux) + crack (1.0.1) bigdecimal rexml - csv (3.3.0) - date (3.4.1) - debug (1.9.2) + csv (3.3.5) + date (3.5.1) + debug (1.11.1) irb (~> 1.10) reline (>= 0.3.8) diff-lcs (1.6.2) @@ -262,6 +262,7 @@ GEM docker_registry2 (1.18.2) rest-client (>= 1.8.0) domain_name (0.6.20231109) + erb (6.0.1) erubi (1.13.1) excon (1.2.5) logger @@ -276,9 +277,9 @@ GEM base64 (~> 0.2.0) httparty (~> 0.20) terminal-table (>= 1.5.1) - gpgme (2.0.25) + gpgme (2.0.26) mini_portile2 (~> 2.7) - hashdiff (1.1.0) + hashdiff (1.2.1) http-accept (1.7.0) http-cookie (1.0.5) domain_name (~> 0.5) @@ -286,13 +287,15 @@ GEM csv mini_mime (>= 1.0.0) multi_xml (>= 0.5.2) - io-console (0.8.0) - irb (1.12.0) - rdoc + io-console (0.8.2) + irb (1.17.0) + pp (>= 0.6.0) + prism (>= 1.3.0) + rdoc (>= 4.0.0) reline (>= 0.4.2) jmespath (1.6.2) json (2.11.3) - language_server-protocol (3.17.0.3) + language_server-protocol (3.17.0.5) lint_roller (1.1.0) logger (1.7.0) mime-types (3.5.2) @@ -300,8 +303,8 @@ GEM mime-types-data (3.2023.1205) mini_mime (1.1.5) mini_portile2 (2.8.9) - multi_xml (0.7.1) - bigdecimal (~> 3.1) + multi_xml (0.8.1) + bigdecimal (>= 3.1, < 5) netrc (0.11.0) nokogiri (1.19.1-arm64-darwin) racc (~> 1.4) @@ -319,40 +322,46 @@ GEM parallel_tests (4.10.1) parallel parseconfig (1.0.8) - parser (3.3.9.0) + parser (3.3.10.2) ast (~> 2.4.1) racc - prism (1.5.1) - psych (5.2.2) + pp (0.6.3) + prettyprint + prettyprint (0.2.0) + prism (1.9.0) + psych (5.3.1) date stringio - public_suffix (5.0.4) + public_suffix (7.0.2) racc (1.8.1) rainbow (3.1.1) - rake (13.2.1) - rbi (0.3.6) + rake (13.3.1) + rbi (0.3.9) prism (~> 1.0) rbs (>= 3.4.4) - rbs (4.0.0.dev.4) + rbs (4.0.0.dev.5) logger prism (>= 1.3.0) - rdoc (6.10.0) + tsort + rdoc (7.2.0) + erb psych (>= 4.0.0) + tsort regexp_parser (2.11.3) - reline (0.6.1) + reline (0.6.3) io-console (~> 0.5) - require-hooks (0.2.2) + require-hooks (0.2.3) rest-client (2.1.0) http-accept (>= 1.7.0, < 2.0) http-cookie (>= 1.0.2, < 2.0) mime-types (>= 1.16, < 4.0) netrc (~> 0.8) rexml (3.4.4) - rspec (3.13.1) + rspec (3.13.2) rspec-core (~> 3.13.0) rspec-expectations (~> 3.13.0) rspec-mocks (~> 3.13.0) - rspec-core (3.13.5) + rspec-core (3.13.6) rspec-support (~> 3.13.0) rspec-expectations (3.13.5) diff-lcs (>= 1.2.0, < 2.0) @@ -360,13 +369,13 @@ GEM rspec-its (1.3.0) rspec-core (>= 3.0.0) rspec-expectations (>= 3.0.0) - rspec-mocks (3.13.5) + rspec-mocks (3.13.7) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) rspec-sorbet (1.9.2) sorbet-runtime - rspec-support (3.13.4) - rubocop (1.80.2) + rspec-support (3.13.7) + rubocop (1.84.2) json (~> 2.3) language_server-protocol (~> 3.17.0.2) lint_roller (~> 1.1.0) @@ -374,20 +383,20 @@ GEM parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 2.9.3, < 3.0) - rubocop-ast (>= 1.46.0, < 2.0) + rubocop-ast (>= 1.49.0, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 4.0) - rubocop-ast (1.46.0) + rubocop-ast (1.49.0) parser (>= 3.3.7.2) - prism (~> 1.4) - rubocop-performance (1.26.0) + prism (~> 1.7) + rubocop-performance (1.26.1) lint_roller (~> 1.1) rubocop (>= 1.75.0, < 2.0) - rubocop-ast (>= 1.44.0, < 2.0) - rubocop-rspec (3.7.0) + rubocop-ast (>= 1.47.1, < 2.0) + rubocop-rspec (3.9.0) lint_roller (~> 1.1) - rubocop (~> 1.72, >= 1.72.1) - rubocop-sorbet (0.10.5) + rubocop (~> 1.81) + rubocop-sorbet (0.12.0) lint_roller rubocop (>= 1.75.2) ruby-progressbar (1.13.0) @@ -401,15 +410,15 @@ GEM simplecov_json_formatter (~> 0.1) simplecov-html (0.12.3) simplecov_json_formatter (0.1.4) - sorbet (0.6.12544) - sorbet-static (= 0.6.12544) - sorbet-runtime (0.6.12544) - sorbet-static (0.6.12544-universal-darwin) - sorbet-static (0.6.12544-x86_64-linux) - sorbet-static-and-runtime (0.6.12544) - sorbet (= 0.6.12544) - sorbet-runtime (= 0.6.12544) - spoom (1.7.6) + sorbet (0.6.12956) + sorbet-static (= 0.6.12956) + sorbet-runtime (0.6.12956) + sorbet-static (0.6.12956-universal-darwin) + sorbet-static (0.6.12956-x86_64-linux) + sorbet-static-and-runtime (0.6.12956) + sorbet (= 0.6.12956) + sorbet-runtime (= 0.6.12956) + spoom (1.7.11) erubi (>= 1.10.0) prism (>= 0.28.0) rbi (>= 0.3.3) @@ -418,35 +427,38 @@ GEM sorbet-static-and-runtime (>= 0.5.10187) thor (>= 0.19.2) stackprof (0.2.25) - stringio (3.1.2) - tapioca (0.17.7) + stringio (3.2.0) + tapioca (0.17.10) benchmark bundler (>= 2.2.25) netrc (>= 0.11.0) parallel (>= 1.21.0) - rbi (>= 0.3.1) + rbi (>= 0.3.7) require-hooks (>= 0.2.2) sorbet-static-and-runtime (>= 0.5.11087) - spoom (>= 1.7.0) + spoom (>= 1.7.9) thor (>= 1.2.0) yard-sorbet - terminal-table (3.0.2) - unicode-display_width (>= 1.1.1, < 3) - thor (1.4.0) + terminal-table (4.0.0) + unicode-display_width (>= 1.1.1, < 4) + thor (1.5.0) toml-rb (4.0.0) citrus (~> 3.0, > 3.0) racc (~> 1.7) + tsort (0.2.0) turbo_tests (2.2.5) parallel_tests (>= 3.3.0, < 5) rspec (>= 3.10) - unicode-display_width (2.5.0) - vcr (6.2.0) - webmock (3.25.1) + unicode-display_width (3.2.0) + unicode-emoji (~> 4.1) + unicode-emoji (4.2.0) + vcr (6.4.0) + webmock (3.26.1) addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) - webrick (1.9.1) - yard (0.9.37) + webrick (1.9.2) + yard (0.9.38) yard-sorbet (0.9.0) sorbet-runtime yard @@ -508,8 +520,8 @@ DEPENDENCIES zeitwerk (~> 2.7) CHECKSUMS - addressable (2.8.6) sha256=798f6af3556641a7619bad1dce04cdb6eb44b0216a991b0396ea7339276f2b47 - ast (2.4.2) sha256=1e280232e6a33754cde542bc5ef85520b74db2aac73ec14acef453784447cc12 + addressable (2.8.8) sha256=7c13b8f9536cf6364c03b9d417c19986019e28f7c00ac8132da4eb0fe393b057 + ast (2.4.3) sha256=954615157c1d6a382bc27d690d973195e79db7f55e9765ac7c481c60bdb4d383 aws-eventstream (1.3.0) sha256=f1434cc03ab2248756eb02cfa45e900e59a061d7fbdc4a9fd82a5dd23d796d3f aws-partitions (1.877.0) sha256=9552ed7bbd3700ed1eeb0121c160ceaf64fa5dbaff5a1ff5fe6fd8481ecd9cfd aws-sdk-codecommit (1.63.0) sha256=aa00135132d8e19525c0d48d1969861f5b018be4b4801024de88e2020dc33725 @@ -517,15 +529,15 @@ CHECKSUMS aws-sdk-ecr (1.68.0) sha256=86763b7291170dc6dbbf827f35d4142683622e68d7dff6719eeb98b13b677e80 aws-sigv4 (1.8.0) sha256=84dd99768b91b93b63d1d8e53ee837cfd06ab402812772a7899a78f9f9117cbc base64 (0.2.0) sha256=0f25e9b21a02a0cc0cea8ef92b2041035d39350946e8789c562b2d1a3da01507 - benchmark (0.4.1) sha256=d4ef40037bba27f03b28013e219b950b82bace296549ec15a78016552f8d2cce - bigdecimal (3.1.8) sha256=a89467ed5a44f8ae01824af49cbc575871fa078332e8f77ea425725c1ffe27be + benchmark (0.5.0) sha256=465df122341aedcb81a2a24b4d3bd19b6c67c1530713fd533f3ff034e419236c + bigdecimal (4.0.1) sha256=8b07d3d065a9f921c80ceaea7c9d4ae596697295b584c296fe599dd0ad01c4a7 citrus (3.0.2) sha256=4ec2412fc389ad186735f4baee1460f7900a8e130ffe3f216b30d4f9c684f650 - commonmarker (2.3.1-arm64-darwin) sha256=e1c8991b92ea971b8933621124f6461ef06ea64c031429d8b8ebd297dab790dc - commonmarker (2.3.1-x86_64-linux) sha256=afa0df3f64076f0fe996120783db6af28b6d634019ff3a954155884d409caf2a - crack (1.0.0) sha256=c83aefdb428cdc7b66c7f287e488c796f055c0839e6e545fec2c7047743c4a49 - csv (3.3.0) sha256=0bbd1defdc31134abefed027a639b3723c2753862150f4c3ee61cab71b20d67d - date (3.4.1) sha256=bf268e14ef7158009bfeaec40b5fa3c7271906e88b196d958a89d4b408abe64f - debug (1.9.2) sha256=48e026c0852c7a10c60263e2e527968308958e266231e36d64e3efcabec7e7fc + commonmarker (2.6.3-arm64-darwin) sha256=d6c1e4955619da3f68fed22de99dec49a24925611770c039bf870823846c8b21 + commonmarker (2.6.3-x86_64-linux) sha256=e861ba1812721113725ebd8e46e4fee20dc732842f5555db2cfb8dcd74056583 + crack (1.0.1) sha256=ff4a10390cd31d66440b7524eb1841874db86201d5b70032028553130b6d4c7e + csv (3.3.5) sha256=6e5134ac3383ef728b7f02725d9872934f523cb40b961479f69cf3afa6c8e73f + date (3.5.1) sha256=750d06384d7b9c15d562c76291407d89e368dda4d4fff957eb94962d325a0dc0 + debug (1.11.1) sha256=2e0b0ac6119f2207a6f8ac7d4a73ca8eb4e440f64da0a3136c30343146e952b6 dependabot-bazel (0.362.0) dependabot-bun (0.362.0) dependabot-bundler (0.362.0) @@ -562,29 +574,30 @@ CHECKSUMS docile (1.4.0) sha256=5f1734bde23721245c20c3d723e76c104208e1aa01277a69901ce770f0ebb8d3 docker_registry2 (1.18.2) sha256=2ace909110fbca29d69dd1cdec99f555024aa6f6577798638139c8e8e556910f domain_name (0.6.20231109) sha256=5127a1521ecca79d54accefc393f6d19db8600c6224416004414f7eaa28aecbe + erb (6.0.1) sha256=28ecdd99c5472aebd5674d6061e3c6b0a45c049578b071e5a52c2a7f13c197e5 erubi (1.13.1) sha256=a082103b0885dbc5ecf1172fede897f9ebdb745a4b97a5e8dc63953db1ee4ad9 excon (1.2.5) sha256=ca040bb61bc0059968f34a17115a00d2db8562e3c0c5c5c7432072b551c85a9d faraday (2.7.11) sha256=85dbf6bb776c66d2a03394d8fe535f90cb1c875e3c6ab9bb85d26ca13597c76e faraday-net_http (3.0.2) sha256=6882929abed8094e1ee30344a3369e856fe34530044630d1f652bf70ebd87e8d faraday-retry (2.2.0) sha256=80824a5454dd0ce7d8074013454d163569b909001a64bdb3499c9968df4f41c5 gitlab (5.1.0) sha256=021c27807a98f379c0cfeda459327c026d3756dbd6531dc1479f0e3df03572c7 - gpgme (2.0.25) sha256=9242408b28720513145deb6150f25f5fe5149f3728ebaea635050cc3fc84dc34 - hashdiff (1.1.0) sha256=b5465f0e7375f1ee883f53a766ece4dbc764b7674a7c5ffd76e79b2f5f6fc9c9 + gpgme (2.0.26) sha256=1aebfd2eb83b745341e6f416f318597568af5ad4d7d1f55bfab4f1078123abaa + hashdiff (1.2.1) sha256=9c079dbc513dfc8833ab59c0c2d8f230fa28499cc5efb4b8dd276cf931457cd1 http-accept (1.7.0) sha256=c626860682bfbb3b46462f8c39cd470fd7b0584f61b3cc9df5b2e9eb9972a126 http-cookie (1.0.5) sha256=73756d46c7dbdc7023deecdb8a171348ea95a1b99810b31cfe8b4fb4e9a6318f httparty (0.22.0) sha256=78652a5c9471cf0093d3b2083c2295c9c8f12b44c65112f1846af2b71430fa6c - io-console (0.8.0) sha256=cd6a9facbc69871d69b2cb8b926fc6ea7ef06f06e505e81a64f14a470fddefa2 - irb (1.12.0) sha256=07634937fbb7d28d07e46da50d0aa43b4d2f7258174d08de4e32dfb57c10539d + io-console (0.8.2) sha256=d6e3ae7a7cc7574f4b8893b4fca2162e57a825b223a177b7afa236c5ef9814cc + irb (1.17.0) sha256=168c4ddb93d8a361a045c41d92b2952c7a118fa73f23fe14e55609eb7a863aae jmespath (1.6.2) sha256=238d774a58723d6c090494c8879b5e9918c19485f7e840f2c1c7532cf84ebcb1 json (2.11.3) sha256=9a10f658a2de67c0eb837eb795dd48132ce797c403e52b5ebef87dcdc7f9ccc1 - language_server-protocol (3.17.0.3) sha256=3d5c58c02f44a20d972957a9febe386d7e7468ab3900ce6bd2b563dd910c6b3f + language_server-protocol (3.17.0.5) sha256=fd1e39a51a28bf3eec959379985a72e296e9f9acfce46f6a79d31ca8760803cc lint_roller (1.1.0) sha256=2c0c845b632a7d172cb849cc90c1bce937a28c5c8ccccb50dfd46a485003cc87 logger (1.7.0) sha256=196edec7cc44b66cfb40f9755ce11b392f21f7967696af15d274dde7edff0203 mime-types (3.5.2) sha256=c1299f10fa34c75a6f168e99e9dadbd11bc507d9d62dc5cf98c4e65f2af8c4e4 mime-types-data (3.2023.1205) sha256=8c4c79b29b03afdeb6a58c00ef0c5b856cf2371e2edc6cecf9ff33e9c7244a22 mini_mime (1.1.5) sha256=8681b7e2e4215f2a159f9400b5816d85e9d8c6c6b491e96a12797e798f8bccef mini_portile2 (2.8.9) sha256=0cd7c7f824e010c072e33f68bc02d85a00aeb6fce05bb4819c03dfd3c140c289 - multi_xml (0.7.1) sha256=4fce100c68af588ff91b8ba90a0bb3f0466f06c909f21a32f4962059140ba61b + multi_xml (0.8.1) sha256=addba0290bac34e9088bfe73dc4878530297a82a7bbd66cb44dcd0a4b86edf5a netrc (0.11.0) sha256=de1ce33da8c99ab1d97871726cba75151113f117146becbe45aa85cb3dabee3f nokogiri (1.19.1-arm64-darwin) sha256=dfe2d337e6700eac47290407c289d56bcf85805d128c1b5a6434ddb79731cb9e nokogiri (1.19.1-x86_64-linux-gnu) sha256=1a4902842a186b4f901078e692d12257678e6133858d0566152fe29cdb98456a @@ -595,57 +608,61 @@ CHECKSUMS parallel (1.27.0) sha256=4ac151e1806b755fb4e2dc2332cbf0e54f2e24ba821ff2d3dcf86bf6dc4ae130 parallel_tests (4.10.1) sha256=df05458c691462b210f7a41fc2651d4e4e8a881e8190e6d1e122c92c07735d70 parseconfig (1.0.8) sha256=b86e117fcb635eb850b6dbae2454fc7a5a7b3767482951a07a9eb06f667a222f - parser (3.3.9.0) sha256=94d6929354b1a6e3e1f89d79d4d302cc8f5aa814431a6c9c7e0623335d7687f2 - prism (1.5.1) sha256=b40c1b76ccb9fcccc3d1553967cda6e79fa7274d8bfea0d98b15d27a6d187134 - psych (5.2.2) sha256=a4a9477c85d3e858086c38cf64e7096abe40d1b1eed248b01020dec0ff9906ab - public_suffix (5.0.4) sha256=35cd648e0d21d06b8dce9331d19619538d1d898ba6d56a6f2258409d2526d1ae + parser (3.3.10.2) sha256=6f60c84aa4bdcedb6d1a2434b738fe8a8136807b6adc8f7f53b97da9bc4e9357 + pp (0.6.3) sha256=2951d514450b93ccfeb1df7d021cae0da16e0a7f95ee1e2273719669d0ab9df6 + prettyprint (0.2.0) sha256=2bc9e15581a94742064a3cc8b0fb9d45aae3d03a1baa6ef80922627a0766f193 + prism (1.9.0) sha256=7b530c6a9f92c24300014919c9dcbc055bf4cdf51ec30aed099b06cd6674ef85 + psych (5.3.1) sha256=eb7a57cef10c9d70173ff74e739d843ac3b2c019a003de48447b2963d81b1974 + public_suffix (7.0.2) sha256=9114090c8e4e7135c1fd0e7acfea33afaab38101884320c65aaa0ffb8e26a857 racc (1.8.1) sha256=4a7f6929691dbec8b5209a0b373bc2614882b55fc5d2e447a21aaa691303d62f rainbow (3.1.1) sha256=039491aa3a89f42efa1d6dec2fc4e62ede96eb6acd95e52f1ad581182b79bc6a - rake (13.2.1) sha256=46cb38dae65d7d74b6020a4ac9d48afed8eb8149c040eccf0523bec91907059d - rbi (0.3.6) sha256=577e94ddd123d7c83794dd62c06c5f9bf32a22e9a3a0d2f9baf32f7c81b2b5fa - rbs (4.0.0.dev.4) sha256=a4a22ba03d2450e2a18c312b0b05cdc7b8b5d5c9fe255fc32cfea12ff1dd058b - rdoc (6.10.0) sha256=db665021883ac9df3ba29cdf71aece960749888db1bf9615b4a584cfa3fa3eda + rake (13.3.1) sha256=8c9e89d09f66a26a01264e7e3480ec0607f0c497a861ef16063604b1b08eb19c + rbi (0.3.9) sha256=d6a187bd0b376e999d3d82a5e5798a61178be98b894b7b35741c14162c9ea015 + rbs (4.0.0.dev.5) sha256=273938e5a9c7f06b041be583588f2aa1976149bda2ce213e33e129c51534e174 + rdoc (7.2.0) sha256=8650f76cd4009c3b54955eb5d7e3a075c60a57276766ebf36f9085e8c9f23192 regexp_parser (2.11.3) sha256=ca13f381a173b7a93450e53459075c9b76a10433caadcb2f1180f2c741fc55a4 - reline (0.6.1) sha256=1afcc9d7cb1029cdbe780d72f2f09251ce46d3780050f3ec39c3ccc6b60675fb - require-hooks (0.2.2) sha256=effa81b61a669ca00cb1e8910411e0d6a8bb16b49a53d9e69b5e6372d6c90f31 + reline (0.6.3) sha256=1198b04973565b36ec0f11542ab3f5cfeeec34823f4e54cebde90968092b1835 + require-hooks (0.2.3) sha256=224be5b4be0fd2a47cb73286c500da366704a54ec195b6627366380c950efac8 rest-client (2.1.0) sha256=35a6400bdb14fae28596618e312776c158f7ebbb0ccad752ff4fa142bf2747e3 rexml (3.4.4) sha256=19e0a2c3425dfbf2d4fc1189747bdb2f849b6c5e74180401b15734bc97b5d142 - rspec (3.13.1) sha256=b9f9a58fa915b8d94a1d6b3195fe6dd28c4c34836a6097015142c4a9ace72140 - rspec-core (3.13.5) sha256=ab3f682897c6131c67f9a17cfee5022a597f283aebe654d329a565f9937a4fa3 + rspec (3.13.2) sha256=206284a08ad798e61f86d7ca3e376718d52c0bc944626b2349266f239f820587 + rspec-core (3.13.6) sha256=a8823c6411667b60a8bca135364351dda34cd55e44ff94c4be4633b37d828b2d rspec-expectations (3.13.5) sha256=33a4d3a1d95060aea4c94e9f237030a8f9eae5615e9bd85718fe3a09e4b58836 rspec-its (1.3.0) sha256=4da51040e7820daafd40f2f6216d13c90aa949f0d302a0412c9ef6074e73ea97 - rspec-mocks (3.13.5) sha256=e4338a6f285ada9fe56f5893f5457783af8194f5d08884d17a87321d5195ea81 + rspec-mocks (3.13.7) sha256=0979034e64b1d7a838aaaddf12bf065ea4dc40ef3d4c39f01f93ae2c66c62b1c rspec-sorbet (1.9.2) sha256=28bf3969fa136ed22edd05b00d23aab52c276f2fcc89fccbb16b8fd0c48931c8 - rspec-support (3.13.4) sha256=184b1814f6a968102b57df631892c7f1990a91c9a3b9e80ef892a0fc2a71a3f7 - rubocop (1.80.2) sha256=6485f30fefcf5c199db3b91e5e253b1ef43f7e564784e2315255809a3dd9abf4 - rubocop-ast (1.46.0) sha256=0da7f6ad5b98614f89b74f11873c191059c823eae07d6ffd40a42a3338f2232b - rubocop-performance (1.26.0) sha256=7bb0d9d9fb2ea122bf6f9a596dd7cf9dc93ab4950923d26c4ae4f328cef71ca9 - rubocop-rspec (3.7.0) sha256=b7b214da112034db9c6d00f2d811a354847e870f7b6ed2482b29649c3d42058f - rubocop-sorbet (0.10.5) sha256=221672c096616d908a06aadd5111bfaab6d3c990d2a1caf2714cdec6514f4795 + rspec-support (3.13.7) sha256=0640e5570872aafefd79867901deeeeb40b0c9875a36b983d85f54fb7381c47c + rubocop (1.84.2) sha256=5692cea54168f3dc8cb79a6fe95c5424b7ea893c707ad7a4307b0585e88dbf5f + rubocop-ast (1.49.0) sha256=49c3676d3123a0923d333e20c6c2dbaaae2d2287b475273fddee0c61da9f71fd + rubocop-performance (1.26.1) sha256=cd19b936ff196df85829d264b522fd4f98b6c89ad271fa52744a8c11b8f71834 + rubocop-rspec (3.9.0) sha256=8fa70a3619408237d789aeecfb9beef40576acc855173e60939d63332fdb55e2 + rubocop-sorbet (0.12.0) sha256=195521e132500555819313df5accaaf56bf721a63de3e5b7b1d0b25f696b1f39 ruby-progressbar (1.13.0) sha256=80fc9c47a9b640d6834e0dc7b3c94c9df37f08cb072b7761e4a71e22cff29b33 ruby2_keywords (0.0.5) sha256=ffd13740c573b7301cf7a2e61fc857b2a8e3d3aff32545d6f8300d8bae10e3ef sawyer (0.9.2) sha256=fa3a72d62a4525517b18857ddb78926aab3424de0129be6772a8e2ba240e7aca simplecov (0.22.0) sha256=fe2622c7834ff23b98066bb0a854284b2729a569ac659f82621fc22ef36213a5 simplecov-html (0.12.3) sha256=4b1aad33259ffba8b29c6876c12db70e5750cb9df829486e4c6e5da4fa0aa07b simplecov_json_formatter (0.1.4) sha256=529418fbe8de1713ac2b2d612aa3daa56d316975d307244399fa4838c601b428 - sorbet (0.6.12544) sha256=361b71af6813ef8bdcfaf92633993c84ea03100f63530dde005db5e2be4f7003 - sorbet-runtime (0.6.12544) sha256=7758a353f132d97e671d6a311baa4cf3fd887273b96f0cbd1445b8fcc3b174c1 - sorbet-static (0.6.12544-universal-darwin) sha256=c6822aeb883b5caa7d44406c0d9de999acebf21b40d38ee7715c0096fc8f9149 - sorbet-static (0.6.12544-x86_64-linux) sha256=032c9cf963ee73a97083750ac40f9497ec6fa0afba742b9f38c2a5db2fe1ccff - sorbet-static-and-runtime (0.6.12544) sha256=47ac40cf3dbfa3ee8da67719387c90468930c1d60be6ab01fcf1693d014d0d3d - spoom (1.7.6) sha256=32d1a38977c7c2e21b5e148c644ccacb90d8d779dc5401c8e641cd3e15afa0b0 + sorbet (0.6.12956) sha256=18aaee5b988f4f1dfa8f1691e7b6c2a478269657429aa907a5c62ee3453eb488 + sorbet-runtime (0.6.12956) sha256=fee716a62d0b1d94ebc8e6ba23e76a7654eeac66c1f5cc1e1bef78b8e9ff87c7 + sorbet-static (0.6.12956-universal-darwin) sha256=a3ec33e4e78c9b9e22577d0c434d6e5b0ba39a38ab9ef0b0cc3dc4711c7009eb + sorbet-static (0.6.12956-x86_64-linux) sha256=1af7ac38fe92afcd0305f013baa2adcddd4571f4bd8fb1c6a8abbd621723d513 + sorbet-static-and-runtime (0.6.12956) sha256=b41bc2d07d1ffd6543ad7d711e3199733d91ad39960310274c7f09a87d90b2a1 + spoom (1.7.11) sha256=4e27384af6d3fde5aadc0287c51e6f76c0802259cbb3b6a67603bf718352f4cf stackprof (0.2.25) sha256=28db0e2d22b817ae35def7163822505a04a026b02ef119b6aa89d70b967b0d2e - stringio (3.1.2) sha256=204f1828f85cdb39d57cac4abc6dc44b04505a223f131587f2e20ae3729ba131 - tapioca (0.17.7) sha256=1efb7be004f269a9cf23c97ed419338598bddfd653e3a5ac0760694e0ebfba9b - terminal-table (3.0.2) sha256=f951b6af5f3e00203fb290a669e0a85c5dd5b051b3b023392ccfd67ba5abae91 - thor (1.4.0) sha256=8763e822ccb0f1d7bee88cde131b19a65606657b847cc7b7b4b82e772bcd8a3d + stringio (3.2.0) sha256=c37cb2e58b4ffbd33fe5cd948c05934af997b36e0b6ca6fdf43afa234cf222e1 + tapioca (0.17.10) sha256=880a682ca8314f798dd09e9f104134fbf1a713c13be51f7dd4741dd434e6471b + terminal-table (4.0.0) sha256=f504793203f8251b2ea7c7068333053f0beeea26093ec9962e62ea79f94301d2 + thor (1.5.0) sha256=e3a9e55fe857e44859ce104a84675ab6e8cd59c650a49106a05f55f136425e73 toml-rb (4.0.0) sha256=bc997a4114c94a65dd5287aa4784ef36cff2c80ec2ecb5980fe7d674f8ed37ea + tsort (0.2.0) sha256=9650a793f6859a43b6641671278f79cfead60ac714148aabe4e3f0060480089f turbo_tests (2.2.5) sha256=3fa31497d12976d11ccc298add29107b92bda94a90d8a0a5783f06f05102509f - unicode-display_width (2.5.0) sha256=7e7681dcade1add70cb9fda20dd77f300b8587c81ebbd165d14fd93144ff0ab4 - vcr (6.2.0) sha256=f960a9a08f904f3577ba212de771171b7e934a319478aa397636daabfcf9490a - webmock (3.25.1) sha256=ab9d5d9353bcbe6322c83e1c60a7103988efc7b67cd72ffb9012629c3d396323 - webrick (1.9.1) sha256=b42d3c94f166f3fb73d87e9b359def9b5836c426fc8beacf38f2184a21b2a989 - yard (0.9.37) sha256=a6e910399e78e613f80ba9add9ba7c394b1a935f083cccbef82903a3d2a26992 + unicode-display_width (3.2.0) sha256=0cdd96b5681a5949cdbc2c55e7b420facae74c4aaf9a9815eee1087cb1853c42 + unicode-emoji (4.2.0) sha256=519e69150f75652e40bf736106cfbc8f0f73aa3fb6a65afe62fefa7f80b0f80f + vcr (6.4.0) sha256=077ac92cc16efc5904eb90492a18153b5e6ca5398046d8a249a7c96a9ea24ae6 + webmock (3.26.1) sha256=4f696fb57c90a827c20aadb2d4f9058bbff10f7f043bd0d4c3f58791143b1cd7 + webrick (1.9.2) sha256=beb4a15fc474defed24a3bda4ffd88a490d517c9e4e6118c3edce59e45864131 + yard (0.9.38) sha256=721fb82afb10532aa49860655f6cc2eaa7130889df291b052e1e6b268283010f yard-sorbet (0.9.0) sha256=03d1aa461b9e9c82b886919a13aa3e09fcf4d1852239d2967ed97e92723ffe21 zeitwerk (2.7.1) sha256=0945986050e4907140895378e74df1fe882a2271ed087cc6c6d6b00d415a2756 diff --git a/bin/spec/dry-run_spec.rb b/bin/spec/dry-run_spec.rb index b054afec279..f21d4fb715a 100644 --- a/bin/spec/dry-run_spec.rb +++ b/bin/spec/dry-run_spec.rb @@ -55,10 +55,9 @@ def run_with_options(options) "--commit abc1234", "--updater-options goprivate=true,record_ecosystem_versions" ].each do |option_str| - option_name = option_str.split.first - option_value = option_str.split.last - - it "accepts #{option_name} option" do + it "accepts #{option_str.split.first} option" do + option_name = option_str.split.first + option_value = option_str.split.last stdout, stderr, = run_with_options([option_name, option_value]) # Ensure it doesn't show usage help (which would indicate option parsing error) diff --git a/bun/lib/dependabot/bun/file_fetcher.rb b/bun/lib/dependabot/bun/file_fetcher.rb index 7681c86566e..6ae7079f980 100644 --- a/bun/lib/dependabot/bun/file_fetcher.rb +++ b/bun/lib/dependabot/bun/file_fetcher.rb @@ -250,18 +250,19 @@ def path_dependency_details_from_manifest(file) resolution_deps = resolution_objects.flat_map(&:to_a) .map do |path, value| - # skip dependencies that contain invalid values such as inline comments, null, etc. + # skip dependencies that contain invalid values + # such as inline comments, null, etc. - unless value.is_a?(String) - Dependabot.logger.warn( - "File fetcher: Skipping dependency \"#{path}\" " \ - "with value: \"#{value}\"" - ) + unless value.is_a?(String) + Dependabot.logger.warn( + "File fetcher: Skipping dependency \"#{path}\" " \ + "with value: \"#{value}\"" + ) - next - end + next + end - convert_dependency_path_to_name(path, value) + convert_dependency_path_to_name(path, value) end path_starts = PATH_DEPENDENCY_STARTS diff --git a/bun/lib/dependabot/bun/file_fetcher/path_dependency_builder.rb b/bun/lib/dependabot/bun/file_fetcher/path_dependency_builder.rb index 6a1399b623d..f4b05a048c7 100644 --- a/bun/lib/dependabot/bun/file_fetcher/path_dependency_builder.rb +++ b/bun/lib/dependabot/bun/file_fetcher/path_dependency_builder.rb @@ -71,9 +71,9 @@ def details_from_yarn_lock path_starts = FileFetcher::PATH_DEPENDENCY_STARTS parsed_yarn_lock.to_a .find do |n, _| - next false unless n.split(/(?<=\w)\@/).first == dependency_name + next false unless n.split(/(?<=\w)\@/).first == dependency_name - T.must(n.split(/(?<=\w)\@/).last).start_with?(*path_starts) + T.must(n.split(/(?<=\w)\@/).last).start_with?(*path_starts) end&.last end @@ -82,7 +82,7 @@ def details_from_npm_lock path_starts = FileFetcher::NPM_PATH_DEPENDENCY_STARTS path_deps = parsed_package_lock.fetch("dependencies", []).to_a .select do |_, v| - v.fetch("version", "").start_with?(*path_starts) + v.fetch("version", "").start_with?(*path_starts) end path_deps.find { |n, _| n == dependency_name }&.last end @@ -131,10 +131,10 @@ def replace_yarn_lockfile_paths(dependencies_hash) path_from_base = parsed_yarn_lock.to_a .find do |n, _| - next false unless n.split(/(?<=\w)\@/).first == name + next false unless n.split(/(?<=\w)\@/).first == name - T.must(n.split(/(?<=\w)\@/).last) - .start_with?(*FileFetcher::PATH_DEPENDENCY_STARTS) + T.must(n.split(/(?<=\w)\@/).last) + .start_with?(*FileFetcher::PATH_DEPENDENCY_STARTS) end&.first&.split(/(?<=\w)\@/)&.last next unless path_from_base diff --git a/bun/lib/dependabot/bun/file_updater/package_json_updater.rb b/bun/lib/dependabot/bun/file_updater/package_json_updater.rb index d91ab9941df..3053d67d1ed 100644 --- a/bun/lib/dependabot/bun/file_updater/package_json_updater.rb +++ b/bun/lib/dependabot/bun/file_updater/package_json_updater.rb @@ -126,10 +126,10 @@ def updated_requirements(dependency) updated_requirement_pairs = dependency.requirements.zip(T.must(dependency.previous_requirements)) .reject do |new_req, old_req| - next true if new_req == old_req - next false unless old_req&.fetch(:source).nil? + next true if new_req == old_req + next false unless old_req&.fetch(:source).nil? - new_req[:requirement] == old_req&.fetch(:requirement) + new_req[:requirement] == old_req&.fetch(:requirement) end updated_requirement_pairs diff --git a/bun/lib/dependabot/bun/update_checker.rb b/bun/lib/dependabot/bun/update_checker.rb index 655b1e418b1..aeaf2d2f919 100644 --- a/bun/lib/dependabot/bun/update_checker.rb +++ b/bun/lib/dependabot/bun/update_checker.rb @@ -538,7 +538,7 @@ def original_source(updated_dependency) sources = updated_dependency .requirements.map { |r| r.fetch(:source) } - .uniq.compact + .uniq.compact .sort_by do |source| Package::RegistryFinder.central_registry?(source[:url]) ? 1 : 0 end diff --git a/bun/lib/dependabot/bun/update_checker/latest_version_finder.rb b/bun/lib/dependabot/bun/update_checker/latest_version_finder.rb index bce148d3486..e7e824092e0 100644 --- a/bun/lib/dependabot/bun/update_checker/latest_version_finder.rb +++ b/bun/lib/dependabot/bun/update_checker/latest_version_finder.rb @@ -237,7 +237,7 @@ def possible_versions(filter_ignored: true) def possible_previous_releases (package_details&.releases || []) .reject do |r| - r.version.prerelease? && !related_to_current_pre?(T.unsafe(r.version)) + r.version.prerelease? && !related_to_current_pre?(T.unsafe(r.version)) end .sort_by(&:version).reverse end diff --git a/bun/lib/dependabot/bun/update_checker/version_resolver.rb b/bun/lib/dependabot/bun/update_checker/version_resolver.rb index 1f9fda7aae1..405026d3cca 100644 --- a/bun/lib/dependabot/bun/update_checker/version_resolver.rb +++ b/bun/lib/dependabot/bun/update_checker/version_resolver.rb @@ -229,7 +229,7 @@ def resolve_latest_previous_version(dep, updated_version) .possible_previous_versions_with_details .map(&:first) reqs = dep.requirements.filter_map { |r| r[:requirement] } - .map { |r| requirement_class.requirements_array(r) } + .map { |r| requirement_class.requirements_array(r) } # Pick the lowest version from the max possible version from all # requirements. This matches the logic when combining the same @@ -720,12 +720,12 @@ def version_for_dependency(dep) return version_class.new(dep.version) if dep.version && version_class.correct?(dep.version) dep.requirements.filter_map { |r| r[:requirement] } - .reject { |req_string| req_string.start_with?("<") } - .select { |req_string| req_string.match?(version_regex) } - .map { |req_string| req_string.match(version_regex) } - .select { |version| version_class.correct?(version.to_s) } - .map { |version| version_class.new(version.to_s) } - .max + .reject { |req_string| req_string.start_with?("<") } + .select { |req_string| req_string.match?(version_regex) } + .map { |req_string| req_string.match(version_regex) } + .select { |version| version_class.correct?(version.to_s) } + .map { |version| version_class.new(version.to_s) } + .max end sig { returns(T.class_of(Dependabot::Version)) } diff --git a/bundler/helpers/v2/lib/functions.rb b/bundler/helpers/v2/lib/functions.rb index ee90f72241e..e65254ced0c 100644 --- a/bundler/helpers/v2/lib/functions.rb +++ b/bundler/helpers/v2/lib/functions.rb @@ -103,7 +103,7 @@ def self.git_specs(**args) git_specs = Bundler::Definition.build(args.fetch(:gemfile_name), nil, {}).dependencies .select do |spec| - spec.source.is_a?(Bundler::Source::Git) + spec.source.is_a?(Bundler::Source::Git) end git_specs.map do |spec| # Piggy-back off some private Bundler methods to configure the diff --git a/bundler/lib/dependabot/bundler/file_updater.rb b/bundler/lib/dependabot/bundler/file_updater.rb index 194223c668f..bdfa9c46387 100644 --- a/bundler/lib/dependabot/bundler/file_updater.rb +++ b/bundler/lib/dependabot/bundler/file_updater.rb @@ -57,7 +57,7 @@ def updated_dependency_files vendor_updater .updated_files(base_directory: base_dir) .each do |file| - updated_files << file + updated_files << file end updated_files diff --git a/bundler/lib/dependabot/bundler/file_updater/requirement_replacer.rb b/bundler/lib/dependabot/bundler/file_updater/requirement_replacer.rb index 994da7dc3b8..79192cc53a4 100644 --- a/bundler/lib/dependabot/bundler/file_updater/requirement_replacer.rb +++ b/bundler/lib/dependabot/bundler/file_updater/requirement_replacer.rb @@ -268,10 +268,10 @@ def new_requirement_string( new_requirement_string = updated_requirement.split(",") .map do |r| - req_string = serialized_req(r, use_equality_operator) - req_string = %(#{open_quote}#{req_string}#{close_quote}) - req_string = req_string.delete(" ") unless space_after_specifier - req_string + req_string = serialized_req(r, use_equality_operator) + req_string = %(#{open_quote}#{req_string}#{close_quote}) + req_string = req_string.delete(" ") unless space_after_specifier + req_string end.join(", ") new_requirement_string diff --git a/bundler/lib/dependabot/bundler/metadata_finder.rb b/bundler/lib/dependabot/bundler/metadata_finder.rb index 101f92eed11..848d8982900 100644 --- a/bundler/lib/dependabot/bundler/metadata_finder.rb +++ b/bundler/lib/dependabot/bundler/metadata_finder.rb @@ -108,7 +108,7 @@ def find_source_from_gemspec_download T.must(rubygems_marshalled_gemspec_response).gsub("\x06;", "\n") .scan(Source::SOURCE_REGEX) do - github_urls << Regexp.last_match.to_s + github_urls << Regexp.last_match.to_s end source_url = github_urls.find do |url| @@ -127,8 +127,8 @@ def changelog_url_from_gemspec_download T.must(rubygems_marshalled_gemspec_response).gsub("\x06;", "\n") .scan(Dependabot::Source::SOURCE_REGEX) do - github_urls << (Regexp.last_match.to_s + - T.must(T.must(Regexp.last_match).post_match.split("\n").first)) + github_urls << (Regexp.last_match.to_s + + T.must(T.must(Regexp.last_match).post_match.split("\n").first)) end github_urls.find do |url| diff --git a/bundler/lib/dependabot/bundler/update_checker.rb b/bundler/lib/dependabot/bundler/update_checker.rb index cb9e2ccec00..39839f63d86 100644 --- a/bundler/lib/dependabot/bundler/update_checker.rb +++ b/bundler/lib/dependabot/bundler/update_checker.rb @@ -96,14 +96,14 @@ def requirements_unlocked_or_can_be? dependency.specific_requirements .all? do |req| - file = T.must(dependency_files.find { |f| f.name == req.fetch(:file) }) - updated = FileUpdater::RequirementReplacer.new( - dependency: dependency, - file_type: file.name.end_with?("gemspec") ? :gemspec : :gemfile, - updated_requirement: "whatever" - ).rewrite(file.content) - - updated != file.content + file = T.must(dependency_files.find { |f| f.name == req.fetch(:file) }) + updated = FileUpdater::RequirementReplacer.new( + dependency: dependency, + file_type: file.name.end_with?("gemspec") ? :gemspec : :gemfile, + updated_requirement: "whatever" + ).rewrite(file.content) + + updated != file.content end end diff --git a/bundler/lib/dependabot/bundler/update_checker/file_preparer.rb b/bundler/lib/dependabot/bundler/update_checker/file_preparer.rb index 1d59a63fa83..3d6e25eb0cf 100644 --- a/bundler/lib/dependabot/bundler/update_checker/file_preparer.rb +++ b/bundler/lib/dependabot/bundler/update_checker/file_preparer.rb @@ -282,11 +282,11 @@ def updated_version_req_lower_bound(filename) # rubocop:disable Metrics/Cyclomat else version_for_requirement = dependency.requirements.map { |r| r[:requirement] } - .reject { |req_string| req_string.start_with?("<") } - .select { |req_string| req_string.match?(VERSION_REGEX) } - .map { |req_string| req_string.match(VERSION_REGEX)&.to_s } - .select { |version| Bundler::Version.correct?(version) } - .max_by { |version| Bundler::Version.new(version) } + .reject { |req_string| req_string.start_with?("<") } + .select { |req_string| req_string.match?(VERSION_REGEX) } + .map { |req_string| req_string.match(VERSION_REGEX)&.to_s } + .select { |version| Bundler::Version.correct?(version) } + .max_by { |version| Bundler::Version.new(version) } ">= #{version_for_requirement || 0}" end diff --git a/bundler/lib/dependabot/bundler/update_checker/latest_version_finder/dependency_source.rb b/bundler/lib/dependabot/bundler/update_checker/latest_version_finder/dependency_source.rb index 258a077e790..31f76bc627a 100644 --- a/bundler/lib/dependabot/bundler/update_checker/latest_version_finder/dependency_source.rb +++ b/bundler/lib/dependabot/bundler/update_checker/latest_version_finder/dependency_source.rb @@ -86,7 +86,7 @@ def latest_git_version_details source_details = dependency.requirements.map { |r| r.fetch(:source) } - .uniq.compact.first + .uniq.compact.first SharedHelpers.with_git_configured(credentials: credentials) do in_a_native_bundler_context do |tmp_dir| diff --git a/bundler/lib/dependabot/bundler/update_checker/shared_bundler_helpers.rb b/bundler/lib/dependabot/bundler/update_checker/shared_bundler_helpers.rb index 2ca9f9ab332..f9edb990574 100644 --- a/bundler/lib/dependabot/bundler/update_checker/shared_bundler_helpers.rb +++ b/bundler/lib/dependabot/bundler/update_checker/shared_bundler_helpers.rb @@ -75,9 +75,9 @@ def in_a_native_bundler_context(error_handling: true, &_blk) SharedHelpers .in_a_temporary_repo_directory(base_directory, repo_contents_path) do |tmp_dir| - write_temporary_dependency_files + write_temporary_dependency_files - yield(tmp_dir.to_s) + yield(tmp_dir.to_s) end rescue SharedHelpers::HelperSubprocessFailed => e retry_count ||= 0 diff --git a/bundler/spec/dependabot/bundler/file_parser_spec.rb b/bundler/spec/dependabot/bundler/file_parser_spec.rb index 40ebde5115a..0899364e73b 100644 --- a/bundler/spec/dependabot/bundler/file_parser_spec.rb +++ b/bundler/spec/dependabot/bundler/file_parser_spec.rb @@ -389,9 +389,9 @@ it "raises a helpful error" do expect { parser.parse } .to raise_error do |error| - expect(error.class).to eq(Dependabot::DependencyFileNotEvaluatable) - expect(error.message) - .to include("No plugin sources available for aws-s3") + expect(error.class).to eq(Dependabot::DependencyFileNotEvaluatable) + expect(error.message) + .to include("No plugin sources available for aws-s3") end end end @@ -425,8 +425,8 @@ it "raises a helpful error" do expect { parser.parse } .to raise_error do |error| - expect(error.class).to eq(Dependabot::DependencyFileNotEvaluatable) - expect(error.message.encoding.to_s).to eq("UTF-8") + expect(error.class).to eq(Dependabot::DependencyFileNotEvaluatable) + expect(error.message.encoding.to_s).to eq("UTF-8") end end @@ -436,10 +436,10 @@ it "raises a helpful error" do expect { parser.parse } .to raise_error do |error| - expect(error.message) - .to start_with("Error evaluating your dependency files") - expect(error.class) - .to eq(Dependabot::DependencyFileNotEvaluatable) + expect(error.message) + .to start_with("Error evaluating your dependency files") + expect(error.class) + .to eq(Dependabot::DependencyFileNotEvaluatable) end end end diff --git a/bundler/spec/dependabot/bundler/file_updater_spec.rb b/bundler/spec/dependabot/bundler/file_updater_spec.rb index bf98bf02191..f416938697c 100644 --- a/bundler/spec/dependabot/bundler/file_updater_spec.rb +++ b/bundler/spec/dependabot/bundler/file_updater_spec.rb @@ -1571,8 +1571,8 @@ }] end - removed = "vendor/cache/dependabot-test-ruby-package-81073f9462f2" - added = "vendor/cache/dependabot-test-ruby-package-1c6331732c41" + let(:removed) { "vendor/cache/dependabot-test-ruby-package-81073f9462f2" } + let(:added) { "vendor/cache/dependabot-test-ruby-package-1c6331732c41" } it "vendors the new dependency" do expect(updater.updated_dependency_files.map(&:name)) diff --git a/bundler/spec/dependabot/bundler/update_checker/version_resolver_spec.rb b/bundler/spec/dependabot/bundler/update_checker/version_resolver_spec.rb index 4c62331a2df..46566c8f655 100644 --- a/bundler/spec/dependabot/bundler/update_checker/version_resolver_spec.rb +++ b/bundler/spec/dependabot/bundler/update_checker/version_resolver_spec.rb @@ -60,7 +60,7 @@ it "raises a PrivateSourceAuthenticationFailure error" do expect { latest_resolvable_version_details } .to raise_error(Dependabot::PrivateSourceAuthenticationFailure) do |error| - expect(error.message).to include(": rubygems.pkg.github.com") + expect(error.message).to include(": rubygems.pkg.github.com") end end end @@ -325,8 +325,8 @@ it "raises a useful error" do expect { latest_resolvable_version_details } .to raise_error(Dependabot::DependencyFileNotEvaluatable) do |error| - # Test that the temporary path isn't included in the error message - expect(error.message).not_to include("dependabot_20") + # Test that the temporary path isn't included in the error message + expect(error.message).not_to include("dependabot_20") end end end diff --git a/cargo/lib/dependabot/cargo/package/package_details_fetcher.rb b/cargo/lib/dependabot/cargo/package/package_details_fetcher.rb index 545c0faf4c6..6bfae1b206a 100644 --- a/cargo/lib/dependabot/cargo/package/package_details_fetcher.rb +++ b/cargo/lib/dependabot/cargo/package/package_details_fetcher.rb @@ -137,10 +137,10 @@ def parse_response(response, index) .map(&:strip) .reject(&:empty?) .filter_map do |line| - JSON.parse(line) - rescue JSON::ParserError => e - Dependabot.logger.warn("Failed to parse line in sparse index: #{e.message}") - nil + JSON.parse(line) + rescue JSON::ParserError => e + Dependabot.logger.warn("Failed to parse line in sparse index: #{e.message}") + nil end { "versions" => parsed_response } diff --git a/cargo/lib/dependabot/cargo/update_checker/file_preparer.rb b/cargo/lib/dependabot/cargo/update_checker/file_preparer.rb index e285f866178..359842c6554 100644 --- a/cargo/lib/dependabot/cargo/update_checker/file_preparer.rb +++ b/cargo/lib/dependabot/cargo/update_checker/file_preparer.rb @@ -268,10 +268,10 @@ def lower_bound_version else version_from_requirement = dependency.requirements.filter_map { |r| r.fetch(:requirement) } - .flat_map { |req_str| Cargo::Requirement.new(req_str) } - .flat_map(&:requirements) - .reject { |req_array| req_array.first.start_with?("<") } - .map(&:last) + .flat_map { |req_str| Cargo::Requirement.new(req_str) } + .flat_map(&:requirements) + .reject { |req_array| req_array.first.start_with?("<") } + .map(&:last) .max&.to_s version_from_requirement || 0 diff --git a/cargo/spec/dependabot/cargo/file_updater/lockfile_updater_spec.rb b/cargo/spec/dependabot/cargo/file_updater/lockfile_updater_spec.rb index cc58b880582..74db60220d3 100644 --- a/cargo/spec/dependabot/cargo/file_updater/lockfile_updater_spec.rb +++ b/cargo/spec/dependabot/cargo/file_updater/lockfile_updater_spec.rb @@ -112,16 +112,18 @@ end context "when the dependency doesn't exist" do - random_unlikely_package_name = (0...255).map { ("a".."z").to_a[rand(26)] }.join - content = <<~CONTENT - [package] - name = "foo" - version = "0.1.0" - authors = ["me"] - - [dependencies] - #{random_unlikely_package_name} = "99.99.99" - CONTENT + let(:random_unlikely_package_name) { (0...255).map { ("a".."z").to_a[rand(26)] }.join } + let(:content) do + <<~CONTENT + [package] + name = "foo" + version = "0.1.0" + authors = ["me"] + + [dependencies] + #{random_unlikely_package_name} = "99.99.99" + CONTENT + end let(:manifest) do Dependabot::DependencyFile.new(name: "Cargo.toml", content: content) @@ -137,14 +139,16 @@ end context "when the package doesn't exist at the git source" do - content = <<~CONTENT - [package] - name = "foo" - version = "0.1.0" - authors = ["me"] - [dependencies] - yewtil = { git = "https://github.com/yewstack/yew" } - CONTENT + let(:content) do + <<~CONTENT + [package] + name = "foo" + version = "0.1.0" + authors = ["me"] + [dependencies] + yewtil = { git = "https://github.com/yewstack/yew" } + CONTENT + end let(:manifest) do Dependabot::DependencyFile.new(name: "Cargo.toml", content: content) @@ -153,8 +157,8 @@ it "raises a helpful error" do expect { updated_lockfile_content } .to raise_error do |error| - expect(error).to be_a(Dependabot::DependencyFileNotResolvable) - expect(error.message).to include("yewtil") + expect(error).to be_a(Dependabot::DependencyFileNotResolvable) + expect(error.message).to include("yewtil") end end end diff --git a/common/lib/dependabot/clients/codecommit.rb b/common/lib/dependabot/clients/codecommit.rb index 1a82421b1ef..287f4a802f3 100644 --- a/common/lib/dependabot/clients/codecommit.rb +++ b/common/lib/dependabot/clients/codecommit.rb @@ -296,9 +296,9 @@ def create_pull_request( title: pr_name, description: pr_description, targets: [ - repository_name: source.unscoped_repo, - source_reference: target_branch, - destination_reference: source_branch + { repository_name: source.unscoped_repo, + source_reference: target_branch, + destination_reference: source_branch } ] ) end diff --git a/common/lib/dependabot/config/ignore_condition.rb b/common/lib/dependabot/config/ignore_condition.rb index 190ebdaba10..fd8942caf7c 100644 --- a/common/lib/dependabot/config/ignore_condition.rb +++ b/common/lib/dependabot/config/ignore_condition.rb @@ -27,8 +27,8 @@ class IgnoreCondition sig do params( dependency_name: String, - versions: T.any(NilClass, T::Array[String]), - update_types: T.any(NilClass, T::Array[String]) + versions: T.nilable(T::Array[String]), + update_types: T.nilable(T::Array[String]) ).void end def initialize(dependency_name:, versions: nil, update_types: nil) diff --git a/common/lib/dependabot/file_fetchers/base.rb b/common/lib/dependabot/file_fetchers/base.rb index 6f2284ca1ec..c017622640a 100644 --- a/common/lib/dependabot/file_fetchers/base.rb +++ b/common/lib/dependabot/file_fetchers/base.rb @@ -641,20 +641,20 @@ def _gitlab_repo_contents(repo, path, commit) T.unsafe(gitlab_client) .repo_tree(repo, path: path, ref: commit, per_page: 100) .map do |file| - # GitLab API essentially returns the output from `git ls-tree` - type = case file.type - when "blob" then "file" - when "tree" then "dir" - when "commit" then "submodule" - else file.fetch("type") - end - - RepositoryContent.new( - name: file.name, - path: file.path, - type: type, - size: 0 # GitLab doesn't return file size - ) + # GitLab API essentially returns the output from `git ls-tree` + type = case file.type + when "blob" then "file" + when "tree" then "dir" + when "commit" then "submodule" + else file.fetch("type") + end + + RepositoryContent.new( + name: file.name, + path: file.path, + type: type, + size: 0 # GitLab doesn't return file size + ) end end diff --git a/common/lib/dependabot/metadata_finders/base/commits_finder.rb b/common/lib/dependabot/metadata_finders/base/commits_finder.rb index aae1da43e0b..4c99c759d72 100644 --- a/common/lib/dependabot/metadata_finders/base/commits_finder.rb +++ b/common/lib/dependabot/metadata_finders/base/commits_finder.rb @@ -309,11 +309,11 @@ def fetch_bitbucket_commits T.unsafe(bitbucket_client) .compare(T.must(source).repo, previous_tag, new_tag) .map do |commit| - { - message: commit.dig("summary", "raw"), - sha: commit["hash"], - html_url: commit.dig("links", "html", "href") - } + { + message: commit.dig("summary", "raw"), + sha: commit["hash"], + html_url: commit.dig("links", "html", "href") + } end rescue Dependabot::Clients::Bitbucket::NotFound, Dependabot::Clients::Bitbucket::Unauthorized, @@ -330,11 +330,11 @@ def fetch_gitlab_commits .compare(T.must(source).repo, previous_tag, new_tag) .commits .map do |commit| - { - message: commit["message"], - sha: commit["id"], - html_url: "#{T.must(source).url}/commit/#{commit['id']}" - } + { + message: commit["message"], + sha: commit["id"], + html_url: "#{T.must(source).url}/commit/#{commit['id']}" + } end rescue Gitlab::Error::NotFound [] @@ -346,11 +346,11 @@ def fetch_azure_commits azure_client .compare(previous_tag, new_tag, type) .map do |commit| - { - message: commit["comment"], - sha: commit["commitId"], - html_url: commit["remoteUrl"] - } + { + message: commit["comment"], + sha: commit["commitId"], + html_url: commit["remoteUrl"] + } end rescue Dependabot::Clients::Azure::NotFound, Dependabot::Clients::Azure::Unauthorized, diff --git a/common/lib/dependabot/package/package_latest_version_finder.rb b/common/lib/dependabot/package/package_latest_version_finder.rb index 02a77fbfe40..afefb5e48c2 100644 --- a/common/lib/dependabot/package/package_latest_version_finder.rb +++ b/common/lib/dependabot/package/package_latest_version_finder.rb @@ -240,9 +240,9 @@ def filter_prerelease_versions(releases) def filter_ignored_versions(releases) filtered = releases .reject do |release| - ignore_requirements.any? do |r| - r.satisfied_by?(release.version) - end + ignore_requirements.any? do |r| + r.satisfied_by?(release.version) + end end if @raise_on_ignored && filter_lower_versions(filtered).empty? && filter_lower_versions(releases).any? raise Dependabot::AllVersionsIgnored @@ -277,9 +277,9 @@ def filter_out_of_range_versions(releases) releases .select do |release| - reqs.all? do |r| - r.any? { |o| o.satisfied_by?(release.version) } - end + reqs.all? do |r| + r.any? { |o| o.satisfied_by?(release.version) } + end end end diff --git a/common/spec/dependabot/clients/azure_spec.rb b/common/spec/dependabot/clients/azure_spec.rb index 9bda39106d5..a41bd42f26c 100644 --- a/common/spec/dependabot/clients/azure_spec.rb +++ b/common/spec/dependabot/clients/azure_spec.rb @@ -254,7 +254,7 @@ end context "when response is 200" do - response_body = fixture("azure", "update_pull_request_details.json") + let(:response_body) { fixture("azure", "update_pull_request_details.json") } before do request_body = { @@ -308,7 +308,7 @@ let(:pull_request_url) { base_url + "/_apis/git/pullrequests/#{pull_request_id}" } context "when response is 200" do - response_body = fixture("azure", "pull_request_details.json") + let(:response_body) { fixture("azure", "pull_request_details.json") } before do stub_request(:get, pull_request_url) @@ -386,49 +386,42 @@ describe "#get" do context "when using auth headers" do - token = ":test_token" - encoded_token = Base64.encode64(":test_token").delete("\n") - bearer_token = "test_token" - basic_non_encoded_token_data = - { - "token_type" => "basic non encoded", - "credentials" => Dependabot::Credential.new( - { - "type" => "git_source", - "host" => "dev.azure.com", - "token" => token - } - ), - "headers" => { "Authorization" => "Basic #{encoded_token}" } - } - basic_encoded_token_data = - { - "token_type" => "basic encoded", - "credentials" => Dependabot::Credential.new( - { - "type" => "git_source", - "host" => "dev.azure.com", - "token" => encoded_token.to_s - } - ), - "headers" => { "Authorization" => "Basic #{encoded_token}" } - } - bearer_token_data = - { - "token_type" => "bearer", - "credentials" => Dependabot::Credential.new( - { - "type" => "git_source", - "host" => "dev.azure.com", - "token" => bearer_token - } - ), - "headers" => { "Authorization" => "Bearer #{bearer_token}" } - } - - include_examples "#get using auth headers", basic_non_encoded_token_data - include_examples "#get using auth headers", basic_encoded_token_data - include_examples "#get using auth headers", bearer_token_data + include_examples "#get using auth headers", + { + "token_type" => "basic non encoded", + "credentials" => Dependabot::Credential.new( + { + "type" => "git_source", + "host" => "dev.azure.com", + "token" => ":test_token" + } + ), + "headers" => { "Authorization" => "Basic #{Base64.encode64(':test_token').delete("\n")}" } + } + include_examples "#get using auth headers", + { + "token_type" => "basic encoded", + "credentials" => Dependabot::Credential.new( + { + "type" => "git_source", + "host" => "dev.azure.com", + "token" => Base64.encode64(":test_token").delete("\n") + } + ), + "headers" => { "Authorization" => "Basic #{Base64.encode64(':test_token').delete("\n")}" } + } + include_examples "#get using auth headers", + { + "token_type" => "bearer", + "credentials" => Dependabot::Credential.new( + { + "type" => "git_source", + "host" => "dev.azure.com", + "token" => "test_token" + } + ), + "headers" => { "Authorization" => "Bearer test_token" } + } end context "when dealing with Retries" do diff --git a/common/spec/dependabot/file_fetchers/base_spec.rb b/common/spec/dependabot/file_fetchers/base_spec.rb index bb765a5fef3..cb7d9b238d6 100644 --- a/common/spec/dependabot/file_fetchers/base_spec.rb +++ b/common/spec/dependabot/file_fetchers/base_spec.rb @@ -1329,7 +1329,7 @@ def fetch_files it "raises a custom error" do expect { file_fetcher_instance.files } .to raise_error(Dependabot::DependencyFileNotFound) do |error| - expect(error.file_path).to eq("/requirements.txt") + expect(error.file_path).to eq("/requirements.txt") end end end @@ -1504,7 +1504,7 @@ def optional it "raises DependencyFileNotFound" do expect { files } .to raise_error(Dependabot::DependencyFileNotFound) do |error| - expect(error.file_path).to eq("/requirements.txt") + expect(error.file_path).to eq("/requirements.txt") end end end @@ -1552,7 +1552,7 @@ def fetch_files it "raises DependencyFileNotFound" do expect { files } .to raise_error(Dependabot::DependencyFileNotFound) do |error| - expect(error.file_path).to eq("/nested/requirements.txt") + expect(error.file_path).to eq("/nested/requirements.txt") end end end @@ -1585,7 +1585,7 @@ def fetch_files it "raises DependencyFileNotFound" do expect { files } .to raise_error(Dependabot::DependencyFileNotFound) do |error| - expect(error.file_path).to eq("/nested/requirements.txt") + expect(error.file_path).to eq("/nested/requirements.txt") end end end diff --git a/common/spec/dependabot/pull_request_creator/message_builder_spec.rb b/common/spec/dependabot/pull_request_creator/message_builder_spec.rb index ef010ba9f90..e9e8934f233 100644 --- a/common/spec/dependabot/pull_request_creator/message_builder_spec.rb +++ b/common/spec/dependabot/pull_request_creator/message_builder_spec.rb @@ -3606,9 +3606,10 @@ def commits_details(base:, head:) describe "#message" do subject(:message) { builder.message } - pr_name = "PR title" - pr_message = "PR message" - commit_message = "Commit message" + let(:pr_name) { "PR title" } + let(:pr_message) { "PR message" } + let(:commit_message) { "Commit message" } + before do allow(builder).to receive_messages(pr_name: pr_name, pr_message: pr_message, commit_message: commit_message) end diff --git a/common/spec/dependabot/shared_helpers_spec.rb b/common/spec/dependabot/shared_helpers_spec.rb index 5018c279d8f..a6d076f9e27 100644 --- a/common/spec/dependabot/shared_helpers_spec.rb +++ b/common/spec/dependabot/shared_helpers_spec.rb @@ -580,12 +580,18 @@ def existing_tmp_folders end describe ".with_git_configured" do - config_header = "Generated by dependabot/dependabot-core" + let(:config_header) { "Generated by dependabot/dependabot-core" } + let(:credentials) { [] } + let(:git_config_path) { File.expand_path("XXXXXXXXXXXXXXXX.gitconfig", tmp) } + let(:configured_git_config) { with_git_configured { `cat #{git_config_path}` } } + let(:configured_git_credentials) { with_git_configured { `cat #{Dir.pwd}/git.store` } } - credentials_helper = <<~CONFIG.chomp - [credential] - helper = !#{described_class.credential_helper_path} --file #{Dir.pwd}/git.store - CONFIG + let(:credentials_helper) do + <<~CONFIG.chomp + [credential] + helper = !#{described_class.credential_helper_path} --file #{Dir.pwd}/git.store + CONFIG + end def alternatives(host) <<~CONFIG.chomp @@ -598,11 +604,6 @@ def alternatives(host) CONFIG end - let(:credentials) { [] } - let(:git_config_path) { File.expand_path("XXXXXXXXXXXXXXXX.gitconfig", tmp) } - let(:configured_git_config) { with_git_configured { `cat #{git_config_path}` } } - let(:configured_git_credentials) { with_git_configured { `cat #{Dir.pwd}/git.store` } } - def with_git_configured(&block) Dependabot::SharedHelpers.with_git_configured(credentials: credentials, &block) end diff --git a/common/spec/helpers/test/run.rb b/common/spec/helpers/test/run.rb index 679d1e20d85..a6f2f29697f 100644 --- a/common/spec/helpers/test/run.rb +++ b/common/spec/helpers/test/run.rb @@ -1,6 +1,8 @@ # typed: false # frozen_string_literal: true +# rubocop:disable RSpec/Output -- This is a subprocess helper, not a spec. It must write to stdout/stderr. + require "json" request = JSON.parse($stdin.read) @@ -23,3 +25,4 @@ else $stdout.write(JSON.dump(result: request)) end +# rubocop:enable RSpec/Output diff --git a/composer/lib/dependabot/composer/file_fetcher.rb b/composer/lib/dependabot/composer/file_fetcher.rb index 97f6c7d8718..a48e211d46b 100644 --- a/composer/lib/dependabot/composer/file_fetcher.rb +++ b/composer/lib/dependabot/composer/file_fetcher.rb @@ -88,12 +88,12 @@ def artifact_dependencies .select { |file| file.type == "file" && file.name.end_with?(".zip") } .map { |file| File.join(url, file.name) } .map do |zip_file| - DependencyFile.new( - name: zip_file, - content: _fetch_file_content(zip_file), - directory: directory, - type: "file" - ) + DependencyFile.new( + name: zip_file, + content: _fetch_file_content(zip_file), + directory: directory, + type: "file" + ) end end.flatten, T.nilable(T::Array[Dependabot::DependencyFile]) diff --git a/composer/lib/dependabot/composer/file_updater/lockfile_updater.rb b/composer/lib/dependabot/composer/file_updater/lockfile_updater.rb index 157915fb62e..e8490424720 100644 --- a/composer/lib/dependabot/composer/file_updater/lockfile_updater.rb +++ b/composer/lib/dependabot/composer/file_updater/lockfile_updater.rb @@ -175,8 +175,8 @@ def handle_composer_errors(error) missing_extensions = error.message.scan(MISSING_EXPLICIT_PLATFORM_REQ_REGEX) .map do |extension_string| - name, requirement = T.cast(extension_string, String).strip.split(" ", 2) - { name: name, requirement: requirement } + name, requirement = T.cast(extension_string, String).strip.split(" ", 2) + { name: name, requirement: requirement } end raise MissingExtensions, missing_extensions elsif error.message.match?(MISSING_IMPLICIT_PLATFORM_REQ_REGEX) && @@ -186,8 +186,8 @@ def handle_composer_errors(error) missing_extensions = error.message.scan(MISSING_IMPLICIT_PLATFORM_REQ_REGEX) .map do |extension_string| - name, requirement = T.cast(extension_string, String).strip.split(" ", 2) - { name: name, requirement: requirement } + name, requirement = T.cast(extension_string, String).strip.split(" ", 2) + { name: name, requirement: requirement } end missing_extension = missing_extensions.find do |hash| @@ -261,8 +261,8 @@ def implicit_platform_reqs_satisfiable?(message) missing_extensions = message.scan(MISSING_IMPLICIT_PLATFORM_REQ_REGEX) .map do |extension_string| - name, requirement = T.cast(extension_string, String).strip.split(" ", 2) - { name: name, requirement: requirement } + name, requirement = T.cast(extension_string, String).strip.split(" ", 2) + { name: name, requirement: requirement } end missing_extensions.any? do |hash| @@ -321,7 +321,7 @@ def lock_dependencies_being_updated(original_content) old_req = dep.requirements.find { |r| r[:file] == PackageManager::MANIFEST_FILENAME } - &.fetch(:requirement) + &.fetch(:requirement) # When updating a subdep there won't be an old requirement next content unless old_req @@ -389,24 +389,24 @@ def replace_patches(updated_content) JSON.parse(T.must(lockfile.content)) .fetch(package_type, []) .each do |details| - next unless details["extra"].is_a?(Hash) - next unless (patches = details.dig("extra", "patches_applied")) + next unless details["extra"].is_a?(Hash) + next unless (patches = details.dig("extra", "patches_applied")) - updated_object = JSON.parse(content) - updated_object_package = - updated_object - .fetch(package_type, []) - .find { |d| d["name"] == details["name"] } + updated_object = JSON.parse(content) + updated_object_package = + updated_object + .fetch(package_type, []) + .find { |d| d["name"] == details["name"] } - next unless updated_object_package + next unless updated_object_package - updated_object_package["extra"] ||= {} - updated_object_package["extra"]["patches_applied"] = patches + updated_object_package["extra"] ||= {} + updated_object_package["extra"]["patches_applied"] = patches - content = - JSON.pretty_generate(updated_object, indent: " ") - .gsub(/\[\n\n\s*\]/, "[]") - .gsub(/\}\z/, "}\n") + content = + JSON.pretty_generate(updated_object, indent: " ") + .gsub(/\[\n\n\s*\]/, "[]") + .gsub(/\}\z/, "}\n") end end content diff --git a/composer/lib/dependabot/composer/package/package_details_fetcher.rb b/composer/lib/dependabot/composer/package/package_details_fetcher.rb index f11dc797781..b1bb80ba254 100644 --- a/composer/lib/dependabot/composer/package/package_details_fetcher.rb +++ b/composer/lib/dependabot/composer/package/package_details_fetcher.rb @@ -69,8 +69,8 @@ def initialize( def fetch_releases available_version_details = registry_version_details .select do |version_details| - version = version_details.fetch("version") - version && version_class.correct?(version.gsub(/^v/, "")) + version = version_details.fetch("version") + version && version_class.correct?(version.gsub(/^v/, "")) end releases = available_version_details.map do |version_details| @@ -83,8 +83,8 @@ def fetch_releases def fetch available_version_details = registry_version_details .select do |version_details| - version = version_details.fetch("version") - version && version_class.correct?(version.gsub(/^v/, "")) + version = version_details.fetch("version") + version && version_class.correct?(version.gsub(/^v/, "")) end releases = available_version_details.map do |version_details| diff --git a/composer/lib/dependabot/composer/update_checker/version_resolver.rb b/composer/lib/dependabot/composer/update_checker/version_resolver.rb index 7b5ddd14d29..c8047d4f483 100644 --- a/composer/lib/dependabot/composer/update_checker/version_resolver.rb +++ b/composer/lib/dependabot/composer/update_checker/version_resolver.rb @@ -282,11 +282,11 @@ def updated_version_requirement_string else version_for_requirement = dependency.requirements.filter_map { |r| r[:requirement] } - .reject { |req_string| req_string.start_with?("<") } - .select { |req_string| req_string.match?(VERSION_REGEX) } - .map { |req_string| req_string.match(VERSION_REGEX) } - .select { |version| requirement_valid?(">= #{version}") } - .max_by { |version| Composer::Version.new(version.to_s) } + .reject { |req_string| req_string.start_with?("<") } + .select { |req_string| req_string.match?(VERSION_REGEX) } + .map { |req_string| req_string.match(VERSION_REGEX) } + .select { |version| requirement_valid?(">= #{version}") } + .max_by { |version| Composer::Version.new(version.to_s) } ">= #{version_for_requirement || 0}" end @@ -334,12 +334,12 @@ def handle_composer_errors(error) missing_extensions = error.message.scan(MISSING_EXPLICIT_PLATFORM_REQ_REGEX) .map do |extension_string| - name, requirement = if extension_string.is_a?(Array) - [extension_string.first.to_s.strip, extension_string.last.to_s] - else - extension_string.to_s.strip.split(" ", 2) - end - { name: name, requirement: requirement } + name, requirement = if extension_string.is_a?(Array) + [extension_string.first.to_s.strip, extension_string.last.to_s] + else + extension_string.to_s.strip.split(" ", 2) + end + { name: name, requirement: requirement } end raise MissingExtensions, missing_extensions elsif error.message.match?(MISSING_IMPLICIT_PLATFORM_REQ_REGEX) && @@ -349,8 +349,8 @@ def handle_composer_errors(error) missing_extensions = error.message.scan(MISSING_IMPLICIT_PLATFORM_REQ_REGEX) .map do |extension_string| - name, requirement = T.cast(extension_string, String).strip.split(" ", 2) - { name: name, requirement: requirement } + name, requirement = T.cast(extension_string, String).strip.split(" ", 2) + { name: name, requirement: requirement } end missing_extension = missing_extensions.find do |hash| @@ -442,8 +442,8 @@ def implicit_platform_reqs_satisfiable?(message) missing_extensions = message.scan(MISSING_IMPLICIT_PLATFORM_REQ_REGEX) .map do |extension_string| - name, requirement = T.cast(extension_string, String).strip.split(" ", 2) - { name: name, requirement: requirement } + name, requirement = T.cast(extension_string, String).strip.split(" ", 2) + { name: name, requirement: requirement } end missing_extensions.any? do |hash| diff --git a/docker/lib/dependabot/shared/shared_file_parser.rb b/docker/lib/dependabot/shared/shared_file_parser.rb index f7cbade2978..a1506e38bd8 100644 --- a/docker/lib/dependabot/shared/shared_file_parser.rb +++ b/docker/lib/dependabot/shared/shared_file_parser.rb @@ -60,10 +60,10 @@ def build_dependency(file, details, version) version: version, package_manager: package_manager, requirements: [ - requirement: nil, - groups: [], - file: file.name, - source: source_from(details) + { requirement: nil, + groups: [], + file: file.name, + source: source_from(details) } ] ) end diff --git a/docker/spec/dependabot/docker/file_fetcher_spec.rb b/docker/spec/dependabot/docker/file_fetcher_spec.rb index 684479b8276..590f4187f38 100644 --- a/docker/spec/dependabot/docker/file_fetcher_spec.rb +++ b/docker/spec/dependabot/docker/file_fetcher_spec.rb @@ -312,22 +312,25 @@ end context "with a Helm values file" do - matching_filenames = [ - "other.values.yml", - "other.values.yaml", - "other-values.yml", - "other-values.yaml", - "other_values.yml", - "other_values.yaml", - "values.yml", - "values.yaml", - "values-other.yml", - "values-other.yaml", - "values_other.yml", - "values_other.yaml", - "values2.yml", - "values2.yaml" - ] + let(:matching_filenames) do + [ + "other.values.yml", + "other.values.yaml", + "other-values.yml", + "other-values.yaml", + "other_values.yml", + "other_values.yaml", + "values.yml", + "values.yaml", + "values-other.yml", + "values-other.yaml", + "values_other.yml", + "values_other.yaml", + "values2.yml", + "values2.yaml" + ] + end + let(:values_fixture) { fixture("github", "contents_values_yaml.json") } before do stub_request(:get, url + "?ref=sha") @@ -349,8 +352,6 @@ end end - let(:values_fixture) { fixture("github", "contents_values_yaml.json") } - it "fetches the values.yaml" do expect(file_fetcher_instance.files.count).to eq(matching_filenames.length) expect(file_fetcher_instance.files.map(&:name)) diff --git a/docker/spec/dependabot/docker/update_checker_spec.rb b/docker/spec/dependabot/docker/update_checker_spec.rb index da33be4fd2b..41332474610 100644 --- a/docker/spec/dependabot/docker/update_checker_spec.rb +++ b/docker/spec/dependabot/docker/update_checker_spec.rb @@ -1446,8 +1446,9 @@ def stub_tag_with_no_digest(tag) let(:tags_fixture_name) { "owasp.json" } let(:repo_url) { "https://registry.hub.docker.com/v2/owasp/modsecurity-crs/" } - new_headers = + let(:new_headers) do fixture("docker", "registry_manifest_headers", "generic.json") + end before do tags_url = repo_url + "/tags/list" diff --git a/docker/spec/dependabot/shared/utils/credentials_finder_spec.rb b/docker/spec/dependabot/shared/utils/credentials_finder_spec.rb index f2f2aafe2ba..67e69ba4d8e 100644 --- a/docker/spec/dependabot/shared/utils/credentials_finder_spec.rb +++ b/docker/spec/dependabot/shared/utils/credentials_finder_spec.rb @@ -204,7 +204,7 @@ ecr_stub.stub_responses( :get_authorization_token, authorization_data: - [authorization_token: Base64.encode64("foo:bar")] + [{ authorization_token: Base64.encode64("foo:bar") }] ) end diff --git a/elm/lib/dependabot/elm/file_updater/elm_json_updater.rb b/elm/lib/dependabot/elm/file_updater/elm_json_updater.rb index 808bb4a81f2..c5e7a842099 100644 --- a/elm/lib/dependabot/elm/file_updater/elm_json_updater.rb +++ b/elm/lib/dependabot/elm/file_updater/elm_json_updater.rb @@ -52,10 +52,10 @@ def requirement_changed?(file, dependency) sig { params(content: T.nilable(String), filename: String, dependency: Dependabot::Dependency).returns(String) } def update_requirement(content:, filename:, dependency:) updated_req = dependency.requirements.find { |r| r.fetch(:file) == filename } - &.fetch(:requirement) + &.fetch(:requirement) old_req = dependency.previous_requirements&.find { |r| r.fetch(:file) == filename } - &.fetch(:requirement) + &.fetch(:requirement) return T.must(content) unless old_req diff --git a/github_actions/lib/dependabot/github_actions/file_updater.rb b/github_actions/lib/dependabot/github_actions/file_updater.rb index 8071b6a2db8..5a0704109d9 100644 --- a/github_actions/lib/dependabot/github_actions/file_updater.rb +++ b/github_actions/lib/dependabot/github_actions/file_updater.rb @@ -55,9 +55,9 @@ def updated_workflow_file_content(file) updated_requirement_pairs = dependency.requirements.zip(T.must(dependency.previous_requirements)) .reject do |new_req, old_req| - next true if new_req[:file] != file.name + next true if new_req[:file] != file.name - new_req[:source] == T.must(old_req)[:source] + new_req[:source] == T.must(old_req)[:source] end updated_content = T.must(file.content) diff --git a/github_actions/spec/dependabot/github_actions/version_spec.rb b/github_actions/spec/dependabot/github_actions/version_spec.rb index 98cd4a853be..8b8471d8bd6 100644 --- a/github_actions/spec/dependabot/github_actions/version_spec.rb +++ b/github_actions/spec/dependabot/github_actions/version_spec.rb @@ -5,10 +5,10 @@ require "dependabot/github_actions" RSpec.describe Dependabot::GithubActions::Version do - semver_version = "v1.2.3" - semver_without_v = "1.2.3" - path_based_sem_version = "dummy/v1.2.3" - path_based_sem_without_v = "dummy/1.2.3" + let(:semver_version) { "v1.2.3" } + let(:semver_without_v) { "1.2.3" } + let(:path_based_sem_version) { "dummy/v1.2.3" } + let(:path_based_sem_without_v) { "dummy/1.2.3" } describe "#correct?" do it "rejects nil" do diff --git a/go_modules/lib/dependabot/go_modules/file_updater.rb b/go_modules/lib/dependabot/go_modules/file_updater.rb index 9a8cd5e0510..3dd1e8435ae 100644 --- a/go_modules/lib/dependabot/go_modules/file_updater.rb +++ b/go_modules/lib/dependabot/go_modules/file_updater.rb @@ -56,7 +56,7 @@ def updated_dependency_files vendor_updater.updated_files(base_directory: T.must(directory)) .each do |file| - updated_files << file + updated_files << file end end diff --git a/go_modules/lib/dependabot/go_modules/requirement.rb b/go_modules/lib/dependabot/go_modules/requirement.rb index a89ce34d64e..78192ac3a64 100644 --- a/go_modules/lib/dependabot/go_modules/requirement.rb +++ b/go_modules/lib/dependabot/go_modules/requirement.rb @@ -110,14 +110,14 @@ def replace_wildcard_in_lower_bound(req_string) req_string.split(".") .map do |part| - part.split("-").map.with_index do |p, i| - # Before we hit a wildcard we just return the existing part - next p unless p.match?(WILDCARD_REGEX) || after_wildcard - - # On or after a wildcard we replace the version part with zero - after_wildcard = true - i.zero? ? "0" : "a" - end.join("-") + part.split("-").map.with_index do |p, i| + # Before we hit a wildcard we just return the existing part + next p unless p.match?(WILDCARD_REGEX) || after_wildcard + + # On or after a wildcard we replace the version part with zero + after_wildcard = true + i.zero? ? "0" : "a" + end.join("-") end.join(".") end diff --git a/go_modules/spec/dependabot/go_modules/file_updater/go_mod_updater_spec.rb b/go_modules/spec/dependabot/go_modules/file_updater/go_mod_updater_spec.rb index 9aa666d7340..b6b16d52267 100644 --- a/go_modules/spec/dependabot/go_modules/file_updater/go_mod_updater_spec.rb +++ b/go_modules/spec/dependabot/go_modules/file_updater/go_mod_updater_spec.rb @@ -220,7 +220,7 @@ module github.com/dependabot/vgotest error_class = Dependabot::GoModulePathMismatch expect { updater.updated_go_sum_content } .to raise_error(error_class) do |error| - expect(error.message).to include("github.com/DATA-DOG") + expect(error.message).to include("github.com/DATA-DOG") end end end @@ -232,7 +232,7 @@ module github.com/dependabot/vgotest error_class = Dependabot::GoModulePathMismatch expect { updater.updated_go_sum_content } .to raise_error(error_class) do |error| - expect(error.message).to include("github.com/DATA-DOG") + expect(error.message).to include("github.com/DATA-DOG") end end end @@ -244,8 +244,8 @@ module github.com/dependabot/vgotest error_class = Dependabot::GoModulePathMismatch expect { updater.updated_go_sum_content } .to raise_error(error_class) do |error| - expect(error.message).to include("github.com/Sirupsen") - expect(error.message).to include("github.com/sirupsen") + expect(error.message).to include("github.com/Sirupsen") + expect(error.message).to include("github.com/sirupsen") end end end @@ -356,7 +356,7 @@ module github.com/dependabot/vgotest error_class = Dependabot::DependencyFileNotResolvable expect { updater.updated_go_sum_content } .to raise_error(error_class) do |error| - expect(error.message).to include("googleapis/gnostic/OpenAPIv2") + expect(error.message).to include("googleapis/gnostic/OpenAPIv2") end end end @@ -518,7 +518,7 @@ module github.com/dependabot/vgotest error_class = Dependabot::DependencyFileNotResolvable expect { updater.updated_go_sum_content } .to raise_error(error_class) do |error| - expect(error.message).to include("unknown revision v1.33.999") + expect(error.message).to include("unknown revision v1.33.999") end end end @@ -545,7 +545,7 @@ module github.com/dependabot/vgotest error_class = Dependabot::DependencyFileNotResolvable expect { updater.updated_go_sum_content } .to raise_error(error_class) do |error| - expect(error.message).to include("unrecognized import path") + expect(error.message).to include("unrecognized import path") end end end @@ -574,7 +574,7 @@ module github.com/dependabot/vgotest error_class = Dependabot::DependencyFileNotResolvable expect { updater.updated_go_sum_content } .to raise_error(error_class) do |error| - expect(error.message).to include("go.mod has post-v1 module path") + expect(error.message).to include("go.mod has post-v1 module path") end end end @@ -603,10 +603,10 @@ module github.com/dependabot/vgotest error_class = Dependabot::DependencyFileNotResolvable expect { updater.updated_go_sum_content } .to raise_error(error_class) do |error| - expect(error.message).to include( - "go: github.com/openshift/api@v3.9.1-0.20190424152011-77b8897ec79a+incompatible: " \ - "invalid pseudo-version:" - ) + expect(error.message).to include( + "go: github.com/openshift/api@v3.9.1-0.20190424152011-77b8897ec79a+incompatible: " \ + "invalid pseudo-version:" + ) end end end @@ -635,11 +635,11 @@ module github.com/dependabot/vgotest error_class = Dependabot::DependencyFileNotResolvable expect { updater.updated_go_sum_content } .to raise_error(error_class) do |error| - expect(error.message).to include( - "go: github.com/deislabs/oras@v0.9.0 requires\n" \ - " github.com/docker/distribution@v0.0.0-00010101000000-000000000000: " \ - "invalid version: unknown revision" - ) + expect(error.message).to include( + "go: github.com/deislabs/oras@v0.9.0 requires\n" \ + " github.com/docker/distribution@v0.0.0-00010101000000-000000000000: " \ + "invalid version: unknown revision" + ) end end end @@ -666,9 +666,9 @@ module github.com/dependabot/vgotest error_class = Dependabot::GitDependenciesNotReachable expect { updater.updated_go_sum_content } .to raise_error(error_class) do |error| - expect(error.message).to include("dependabot-fixtures/go-modules-private") - expect(error.dependency_urls) - .to eq(["github.com/dependabot-fixtures/go-modules-private"]) + expect(error.message).to include("dependabot-fixtures/go-modules-private") + expect(error.dependency_urls) + .to eq(["github.com/dependabot-fixtures/go-modules-private"]) end end @@ -717,9 +717,9 @@ module github.com/dependabot/vgotest error_class = Dependabot::GitDependenciesNotReachable expect { updater.updated_go_sum_content } .to raise_error(error_class) do |error| - expect(error.message).to include("dependabot-fixtures/go-modules-private") - expect(error.dependency_urls) - .to eq(["github.com/dependabot-fixtures/go-modules-private"]) + expect(error.message).to include("dependabot-fixtures/go-modules-private") + expect(error.dependency_urls) + .to eq(["github.com/dependabot-fixtures/go-modules-private"]) end end @@ -737,7 +737,7 @@ module github.com/dependabot/vgotest error_class = Dependabot::PrivateSourceAuthenticationFailure expect { updater.updated_go_sum_content } .to raise_error(error_class) do |error| - expect(error.message).to include("dependabot-fixtures/go-modules-private") + expect(error.message).to include("dependabot-fixtures/go-modules-private") end end end @@ -765,9 +765,9 @@ module github.com/dependabot/vgotest error_class = Dependabot::GitDependenciesNotReachable expect { updater.updated_go_sum_content } .to raise_error(error_class) do |error| - expect(error.message).to include("dependabot-fixtures/go-modules-private") - expect(error.dependency_urls) - .to eq(["github.com/dependabot-fixtures/go-modules-private"]) + expect(error.message).to include("dependabot-fixtures/go-modules-private") + expect(error.dependency_urls) + .to eq(["github.com/dependabot-fixtures/go-modules-private"]) end end end @@ -794,9 +794,9 @@ module github.com/dependabot/vgotest error_class = Dependabot::GitDependenciesNotReachable expect { updater.updated_go_sum_content } .to raise_error(error_class) do |error| - expect(error.message).to include("dependabot-fixtures/go-modules-private") - expect(error.dependency_urls) - .to eq(["github.com/dependabot-fixtures/go-modules-private"]) + expect(error.message).to include("dependabot-fixtures/go-modules-private") + expect(error.dependency_urls) + .to eq(["github.com/dependabot-fixtures/go-modules-private"]) end end end diff --git a/go_modules/spec/dependabot/go_modules/update_checker/latest_version_finder_spec.rb b/go_modules/spec/dependabot/go_modules/update_checker/latest_version_finder_spec.rb index e0497cf54c9..1c52c3682a7 100644 --- a/go_modules/spec/dependabot/go_modules/update_checker/latest_version_finder_spec.rb +++ b/go_modules/spec/dependabot/go_modules/update_checker/latest_version_finder_spec.rb @@ -195,7 +195,7 @@ module foobar error_class = Dependabot::DependencyFileNotResolvable expect { finder.latest_version } .to raise_error(error_class) do |error| - expect(error.message).to include("example.com/test/package") + expect(error.message).to include("example.com/test/package") end end end @@ -215,7 +215,7 @@ module foobar error_class = Dependabot::DependencyFileNotResolvable expect { finder.latest_version } .to raise_error(error_class) do |error| - expect(error.message).to include("example.com/web/dependabot.com") + expect(error.message).to include("example.com/web/dependabot.com") end end end @@ -235,7 +235,7 @@ module foobar error_class = Dependabot::DependencyFileNotResolvable expect { finder.latest_version } .to raise_error(error_class) do |error| - expect(error.message).to include("pkg-errors") + expect(error.message).to include("pkg-errors") end end end @@ -248,8 +248,8 @@ module foobar error_class = Dependabot::DependencyFileNotResolvable expect { finder.latest_version } .to raise_error(error_class) do |error| - expect(error.message).to include("github.com/dependabot-fixtures/go-modules-lib/v2") - expect(error.message).to include("version \"v2.0.0\" invalid") + expect(error.message).to include("github.com/dependabot-fixtures/go-modules-lib/v2") + expect(error.message).to include("version \"v2.0.0\" invalid") end end end @@ -262,8 +262,8 @@ module foobar error_class = Dependabot::DependencyFileNotResolvable expect { finder.latest_version } .to raise_error(error_class) do |error| - expect(error.message).to include("github.com/dependabot-fixtures/go-modules-lib") - expect(error.message).to include("version \"v3.0.0\" invalid") + expect(error.message).to include("github.com/dependabot-fixtures/go-modules-lib") + expect(error.message).to include("version \"v3.0.0\" invalid") end end end @@ -292,9 +292,9 @@ module foobar error_class = Dependabot::GitDependenciesNotReachable expect { finder.latest_version } .to raise_error(error_class) do |error| - expect(error.message).to include("github.com/dependabot-fixtures/go-modules-private") - expect(error.dependency_urls) - .to eq(["github.com/dependabot-fixtures/go-modules-private"]) + expect(error.message).to include("github.com/dependabot-fixtures/go-modules-private") + expect(error.dependency_urls) + .to eq(["github.com/dependabot-fixtures/go-modules-private"]) end end @@ -305,9 +305,9 @@ module foobar error_class = Dependabot::GitDependenciesNotReachable expect { finder.latest_version } .to raise_error(error_class) do |error| - expect(error.message).to include("github.com/dependabot-fixtures/go-modules-private") - expect(error.dependency_urls) - .to eq(["github.com/dependabot-fixtures/go-modules-private"]) + expect(error.message).to include("github.com/dependabot-fixtures/go-modules-private") + expect(error.dependency_urls) + .to eq(["github.com/dependabot-fixtures/go-modules-private"]) end end end @@ -319,9 +319,9 @@ module foobar error_class = Dependabot::GitDependenciesNotReachable expect { finder.latest_version } .to raise_error(error_class) do |error| - expect(error.message).to include("github.com/dependabot-fixtures/go-modules-private") - expect(error.dependency_urls) - .to eq(["github.com/dependabot-fixtures/go-modules-private"]) + expect(error.message).to include("github.com/dependabot-fixtures/go-modules-private") + expect(error.dependency_urls) + .to eq(["github.com/dependabot-fixtures/go-modules-private"]) end end end diff --git a/gradle/lib/dependabot/gradle/file_fetcher.rb b/gradle/lib/dependabot/gradle/file_fetcher.rb index a91cbace9a4..d80bcf88ae9 100644 --- a/gradle/lib/dependabot/gradle/file_fetcher.rb +++ b/gradle/lib/dependabot/gradle/file_fetcher.rb @@ -273,7 +273,7 @@ def find_first(dir, supported_names) paths = supported_names .map { |name| clean_join([dir, name]) } .each do |path| - return cached_files[path] || next + return cached_files[path] || next end fetch_first_if_present(paths) end diff --git a/gradle/lib/dependabot/gradle/file_parser/property_value_finder.rb b/gradle/lib/dependabot/gradle/file_parser/property_value_finder.rb index 02700b23db2..796eb0ba42f 100644 --- a/gradle/lib/dependabot/gradle/file_parser/property_value_finder.rb +++ b/gradle/lib/dependabot/gradle/file_parser/property_value_finder.rb @@ -164,20 +164,20 @@ def fetch_kotlin_block_property_declarations(buildfile) T.must(captures.fetch("values")) .scan(KOTLIN_SINGLE_PROPERTY_SET_REGEX) do - declaration_string = Regexp.last_match.to_s.strip - sub_captures = T.must(Regexp.last_match).named_captures - name = sub_captures.fetch("name") - full_name = if namespace == "extra" - name - else - [namespace, name].join(".") - end - - properties[full_name] = { - value: sub_captures.fetch("value"), - declaration_string: declaration_string, - file: buildfile.name - } + declaration_string = Regexp.last_match.to_s.strip + sub_captures = T.must(Regexp.last_match).named_captures + name = sub_captures.fetch("name") + full_name = if namespace == "extra" + name + else + [namespace, name].join(".") + end + + properties[full_name] = { + value: sub_captures.fetch("value"), + declaration_string: declaration_string, + file: buildfile.name + } end end diff --git a/gradle/lib/dependabot/gradle/package/package_details_fetcher.rb b/gradle/lib/dependabot/gradle/package/package_details_fetcher.rb index b52fe045e87..61a1eea8898 100644 --- a/gradle/lib/dependabot/gradle/package/package_details_fetcher.rb +++ b/gradle/lib/dependabot/gradle/package/package_details_fetcher.rb @@ -74,7 +74,7 @@ def fetch_available_versions .select { |node| version_class.correct?(node.content) } .map { |node| version_class.new(node.content) } .map do |version| - { version: version, source_url: url } + { version: version, source_url: url } end end.flatten.compact @@ -247,10 +247,10 @@ def credentials_repository_details credentials .select { |cred| cred["type"] == "maven_repository" } .map do |cred| - { - "url" => cred.fetch("url").gsub(%r{/+$}, ""), - "auth_headers" => auth_headers(cred.fetch("url").gsub(%r{/+$}, "")) - } + { + "url" => cred.fetch("url").gsub(%r{/+$}, ""), + "auth_headers" => auth_headers(cred.fetch("url").gsub(%r{/+$}, "")) + } end end @@ -268,7 +268,7 @@ def dependency_repository_details target_dependency_file: target_file ).repository_urls .map do |url| - { "url" => url, "auth_headers" => {} } + { "url" => url, "auth_headers" => {} } end end.uniq end @@ -297,14 +297,14 @@ def matches_dependency_version_type?(comparison_version) .gsub("native-mt", "native_mt") .split(/[.\-]/) .find do |type| - Dependabot::Gradle::UpdateChecker::VersionFinder::TYPE_SUFFICES.find { |s| type.include?(s) } + Dependabot::Gradle::UpdateChecker::VersionFinder::TYPE_SUFFICES.find { |s| type.include?(s) } end version_type = comparison_version.to_s .gsub("native-mt", "native_mt") .split(/[.\-]/) .find do |type| - Dependabot::Gradle::UpdateChecker::VersionFinder::TYPE_SUFFICES.find { |s| type.include?(s) } + Dependabot::Gradle::UpdateChecker::VersionFinder::TYPE_SUFFICES.find { |s| type.include?(s) } end current_type == version_type diff --git a/gradle/spec/dependabot/gradle/update_checker/version_finder_spec.rb b/gradle/spec/dependabot/gradle/update_checker/version_finder_spec.rb index 78f5da1615b..5032ed5ca52 100644 --- a/gradle/spec/dependabot/gradle/update_checker/version_finder_spec.rb +++ b/gradle/spec/dependabot/gradle/update_checker/version_finder_spec.rb @@ -373,7 +373,7 @@ error_class = Dependabot::PrivateSourceAuthenticationFailure expect { latest_version_details } .to raise_error(error_class) do |error| - expect(error.source).to eq("https://private.registry.org/repo") + expect(error.source).to eq("https://private.registry.org/repo") end end end @@ -551,7 +551,7 @@ error_class = Dependabot::PrivateSourceAuthenticationFailure expect { latest_version_details } .to raise_error(error_class) do |error| - expect(error.source).to eq("https://private.registry.org/repo") + expect(error.source).to eq("https://private.registry.org/repo") end end end diff --git a/hex/lib/dependabot/hex/file_updater/mixfile_updater.rb b/hex/lib/dependabot/hex/file_updater/mixfile_updater.rb index 47fb5599d05..7bcba97c2a5 100644 --- a/hex/lib/dependabot/hex/file_updater/mixfile_updater.rb +++ b/hex/lib/dependabot/hex/file_updater/mixfile_updater.rb @@ -63,7 +63,7 @@ def requirement_changed?(file, dependency) def update_requirement(content:, filename:, dependency:) updated_req = dependency.requirements.find { |r| r[:file] == filename } - &.fetch(:requirement) + &.fetch(:requirement) old_req = dependency.previous_requirements @@ -84,7 +84,7 @@ def update_requirement(content:, filename:, dependency:) def update_git_pin(content:, filename:, dependency:) updated_pin = dependency.requirements.find { |r| r[:file] == filename } - &.dig(:source, :ref) + &.dig(:source, :ref) old_pin = dependency.previous_requirements diff --git a/hex/lib/dependabot/hex/update_checker/file_preparer.rb b/hex/lib/dependabot/hex/update_checker/file_preparer.rb index 05a6c829154..dfd5b6241f7 100644 --- a/hex/lib/dependabot/hex/update_checker/file_preparer.rb +++ b/hex/lib/dependabot/hex/update_checker/file_preparer.rb @@ -96,7 +96,7 @@ def mixfile_content_for_update_check(file) def relax_version(content, filename:) old_requirement = dependency.requirements.find { |r| r.fetch(:file) == filename } - &.fetch(:requirement) + &.fetch(:requirement) updated_requirement = updated_version_requirement_string(filename) Hex::FileUpdater::MixfileRequirementUpdater.new( @@ -133,11 +133,11 @@ def updated_version_req_lower_bound(filename) else version_for_requirement = dependency.requirements.filter_map { |r| r[:requirement] } - .reject { |req_string| req_string.start_with?("<") } - .select { |req_string| req_string.match?(version_regex) } - .map { |req_string| req_string.match(version_regex) } - .select { |version| version_class.correct?(version.to_s) } - .max_by { |version| version_class.new(version.to_s) } + .reject { |req_string| req_string.start_with?("<") } + .select { |req_string| req_string.match?(version_regex) } + .map { |req_string| req_string.match(version_regex) } + .select { |version| version_class.correct?(version.to_s) } + .max_by { |version| version_class.new(version.to_s) } return ">= 0" unless version_for_requirement @@ -156,7 +156,7 @@ def updated_version_req_lower_bound(filename) def replace_git_pin(content, filename:) old_pin = dependency.requirements.find { |r| r.fetch(:file) == filename } - &.dig(:source, :ref) + &.dig(:source, :ref) return content unless old_pin return content if old_pin == replacement_git_pin diff --git a/maven/lib/dependabot/maven/utils/auth_headers_finder.rb b/maven/lib/dependabot/maven/utils/auth_headers_finder.rb index 4145f707cec..97e9c808e98 100644 --- a/maven/lib/dependabot/maven/utils/auth_headers_finder.rb +++ b/maven/lib/dependabot/maven/utils/auth_headers_finder.rb @@ -19,10 +19,10 @@ def auth_headers(maven_repo_url) cred = credentials.select { |c| c["type"] == "maven_repository" } .find do |c| - cred_url = c.fetch("url").gsub(%r{/+$}, "") - next false unless cred_url == maven_repo_url + cred_url = c.fetch("url").gsub(%r{/+$}, "") + next false unless cred_url == maven_repo_url - c.fetch("username", nil) + c.fetch("username", nil) end return gitlab_auth_headers(maven_repo_url) unless cred @@ -44,10 +44,10 @@ def gitlab_auth_headers(maven_repo_url) cred = credentials.select { |c| c["type"] == "git_source" } .find do |c| - cred_host = c.fetch("host").gsub(%r{/+$}, "") - next false unless URI(maven_repo_url).host == cred_host + cred_host = c.fetch("host").gsub(%r{/+$}, "") + next false unless URI(maven_repo_url).host == cred_host - c.fetch("password", nil) + c.fetch("password", nil) end return {} unless cred diff --git a/maven/spec/dependabot/maven/update_checker/version_finder_spec.rb b/maven/spec/dependabot/maven/update_checker/version_finder_spec.rb index d37ae7bd85c..49d08c3f51a 100644 --- a/maven/spec/dependabot/maven/update_checker/version_finder_spec.rb +++ b/maven/spec/dependabot/maven/update_checker/version_finder_spec.rb @@ -510,7 +510,7 @@ error_class = Dependabot::PrivateSourceAuthenticationFailure expect { latest_version_details } .to raise_error(error_class) do |error| - expect(error.source).to eq("https://private.registry.org/repo") + expect(error.source).to eq("https://private.registry.org/repo") end end end diff --git a/maven/spec/dependabot/maven/utils/auth_headers_finder_spec.rb b/maven/spec/dependabot/maven/utils/auth_headers_finder_spec.rb index 90d4ab5552b..b141e985e4e 100644 --- a/maven/spec/dependabot/maven/utils/auth_headers_finder_spec.rb +++ b/maven/spec/dependabot/maven/utils/auth_headers_finder_spec.rb @@ -52,7 +52,7 @@ "https://repo.maven.apache.org/maven2" end - encoded_token = Base64.strict_encode64("dependabot:dependabotPassword") + let(:encoded_token) { Base64.strict_encode64("dependabot:dependabotPassword") } it { is_expected.to eq({ "Authorization" => "Basic #{encoded_token}" }) } end @@ -93,7 +93,7 @@ "https://gitlab.com/api/v4/groups/some-group/-/packages/maven" end - encoded_token = Base64.encode64("dependabot:dependabotPassword").delete("\n") + let(:encoded_token) { Base64.encode64("dependabot:dependabotPassword").delete("\n") } it { is_expected.to eq({ "Authorization" => "Basic #{encoded_token}" }) } end diff --git a/npm_and_yarn/lib/dependabot/npm_and_yarn.rb b/npm_and_yarn/lib/dependabot/npm_and_yarn.rb index b3c83016f13..d6259f5d191 100644 --- a/npm_and_yarn/lib/dependabot/npm_and_yarn.rb +++ b/npm_and_yarn/lib/dependabot/npm_and_yarn.rb @@ -405,7 +405,7 @@ def self.sanitize_resolvability_message(error_message, dependencies, yarn_lock) }.freeze, T::Hash[String, { - message: T.any(String, NilClass), + message: T.nilable(String), handler: ErrorHandler }] ) @@ -556,10 +556,10 @@ def self.sanitize_resolvability_message(error_message, dependencies, yarn_lock) error_message = message.gsub(/[[:space:]]+/, " ").strip filename = error_message.match(YARNRC_ENV_NOT_FOUND_REGEX) - .named_captures["filename"] + .named_captures["filename"] env_var = error_message.match(YARNRC_ENV_NOT_FOUND_REGEX) - .named_captures["token"] + .named_captures["token"] msg = "Environment variable \"#{env_var}\" not found in \"#{filename.split('/').last}\"." Dependabot::MissingEnvironmentVariable.new(env_var, msg) diff --git a/npm_and_yarn/lib/dependabot/npm_and_yarn/file_fetcher.rb b/npm_and_yarn/lib/dependabot/npm_and_yarn/file_fetcher.rb index f51ec49d019..b1c30fd9b3b 100644 --- a/npm_and_yarn/lib/dependabot/npm_and_yarn/file_fetcher.rb +++ b/npm_and_yarn/lib/dependabot/npm_and_yarn/file_fetcher.rb @@ -456,18 +456,19 @@ def path_dependency_details_from_manifest(file) resolution_deps = resolution_objects.flat_map(&:to_a) .map do |path, value| - # skip dependencies that contain invalid values such as inline comments, null, etc. + # skip dependencies that contain invalid values + # such as inline comments, null, etc. - unless value.is_a?(String) - Dependabot.logger.warn( - "File fetcher: Skipping dependency \"#{path}\" " \ - "with value: \"#{value}\"" - ) + unless value.is_a?(String) + Dependabot.logger.warn( + "File fetcher: Skipping dependency \"#{path}\" " \ + "with value: \"#{value}\"" + ) - next - end + next + end - convert_dependency_path_to_name(path, value) + convert_dependency_path_to_name(path, value) end path_starts = PATH_DEPENDENCY_STARTS diff --git a/npm_and_yarn/lib/dependabot/npm_and_yarn/file_fetcher/path_dependency_builder.rb b/npm_and_yarn/lib/dependabot/npm_and_yarn/file_fetcher/path_dependency_builder.rb index 7c73994d157..86287e980d5 100644 --- a/npm_and_yarn/lib/dependabot/npm_and_yarn/file_fetcher/path_dependency_builder.rb +++ b/npm_and_yarn/lib/dependabot/npm_and_yarn/file_fetcher/path_dependency_builder.rb @@ -71,9 +71,9 @@ def details_from_yarn_lock path_starts = FileFetcher::PATH_DEPENDENCY_STARTS parsed_yarn_lock.to_a .find do |n, _| - next false unless n.split(/(?<=\w)\@/).first == dependency_name + next false unless n.split(/(?<=\w)\@/).first == dependency_name - T.must(n.split(/(?<=\w)\@/).last).start_with?(*path_starts) + T.must(n.split(/(?<=\w)\@/).last).start_with?(*path_starts) end&.last end @@ -82,7 +82,7 @@ def details_from_npm_lock path_starts = FileFetcher::NPM_PATH_DEPENDENCY_STARTS path_deps = parsed_package_lock.fetch("dependencies", []).to_a .select do |_, v| - v.fetch("version", "").start_with?(*path_starts) + v.fetch("version", "").start_with?(*path_starts) end path_deps.find { |n, _| n == dependency_name }&.last end @@ -131,10 +131,10 @@ def replace_yarn_lockfile_paths(dependencies_hash) path_from_base = parsed_yarn_lock.to_a .find do |n, _| - next false unless n.split(/(?<=\w)\@/).first == name + next false unless n.split(/(?<=\w)\@/).first == name - T.must(n.split(/(?<=\w)\@/).last) - .start_with?(*FileFetcher::PATH_DEPENDENCY_STARTS) + T.must(n.split(/(?<=\w)\@/).last) + .start_with?(*FileFetcher::PATH_DEPENDENCY_STARTS) end&.first&.split(/(?<=\w)\@/)&.last next unless path_from_base diff --git a/npm_and_yarn/lib/dependabot/npm_and_yarn/file_updater/package_json_updater.rb b/npm_and_yarn/lib/dependabot/npm_and_yarn/file_updater/package_json_updater.rb index e756a26c8ad..26e81510fd3 100644 --- a/npm_and_yarn/lib/dependabot/npm_and_yarn/file_updater/package_json_updater.rb +++ b/npm_and_yarn/lib/dependabot/npm_and_yarn/file_updater/package_json_updater.rb @@ -126,10 +126,10 @@ def updated_requirements(dependency) updated_requirement_pairs = dependency.requirements.zip(T.must(dependency.previous_requirements)) .reject do |new_req, old_req| - next true if new_req == old_req - next false unless old_req&.fetch(:source).nil? + next true if new_req == old_req + next false unless old_req&.fetch(:source).nil? - new_req[:requirement] == old_req&.fetch(:requirement) + new_req[:requirement] == old_req&.fetch(:requirement) end updated_requirement_pairs diff --git a/npm_and_yarn/lib/dependabot/npm_and_yarn/file_updater/pnpm_lockfile_updater.rb b/npm_and_yarn/lib/dependabot/npm_and_yarn/file_updater/pnpm_lockfile_updater.rb index 925a7fb4fb2..c731253afb6 100644 --- a/npm_and_yarn/lib/dependabot/npm_and_yarn/file_updater/pnpm_lockfile_updater.rb +++ b/npm_and_yarn/lib/dependabot/npm_and_yarn/file_updater/pnpm_lockfile_updater.rb @@ -240,10 +240,10 @@ def handle_pnpm_lock_updater_error(error, pnpm_lock) [FORBIDDEN_PACKAGE, MISSING_PACKAGE, UNAUTHORIZED_PACKAGE, ERR_PNPM_FETCH_401, ERR_PNPM_FETCH_403, ERR_PNPM_FETCH_404, ERR_PNPM_FETCH_500, ERR_PNPM_FETCH_502, ERR_PNPM_FETCH_503] .each do |regexp| - next unless error_message.match?(regexp) + next unless error_message.match?(regexp) - dependency_url = T.must(error_message.match(regexp)&.named_captures&.[]("dependency_url")) - raise_package_access_error(error_message, dependency_url, pnpm_lock) + dependency_url = T.must(error_message.match(regexp)&.named_captures&.[]("dependency_url")) + raise_package_access_error(error_message, dependency_url, pnpm_lock) end # TO-DO : subclassifcation of ERR_PNPM_TARBALL_INTEGRITY errors @@ -293,12 +293,12 @@ def handle_pnpm_lock_updater_error(error, pnpm_lock) [ERR_PNPM_UNEXPECTED_PKG_CONTENT_IN_STORE, ERR_PNPM_OUTDATED_LOCKFILE] .each do |regexp| - next unless error_message.match?(regexp) + next unless error_message.match?(regexp) - error_msg = T.let("Error while resolving pnpm-lock.yaml file.", String) + error_msg = T.let("Error while resolving pnpm-lock.yaml file.", String) - Dependabot.logger.warn(error_message) - raise Dependabot::DependencyFileNotResolvable, error_msg + Dependabot.logger.warn(error_message) + raise Dependabot::DependencyFileNotResolvable, error_msg end if error_message.match?(ERR_PNPM_PEER_DEP_ISSUES) diff --git a/npm_and_yarn/lib/dependabot/npm_and_yarn/file_updater/pnpm_workspace_updater.rb b/npm_and_yarn/lib/dependabot/npm_and_yarn/file_updater/pnpm_workspace_updater.rb index 9e4acc698f5..cdac4f4332f 100644 --- a/npm_and_yarn/lib/dependabot/npm_and_yarn/file_updater/pnpm_workspace_updater.rb +++ b/npm_and_yarn/lib/dependabot/npm_and_yarn/file_updater/pnpm_workspace_updater.rb @@ -109,12 +109,12 @@ def new_requirements(dependency) dependency.requirements .select { |r| r[:file] == workspace_file.name } .map do |r| - DependencyRequirement.new( - file: r[:file], - requirement: r[:requirement], - groups: r[:groups], - source: r[:source] - ) + DependencyRequirement.new( + file: r[:file], + requirement: r[:requirement], + groups: r[:groups], + source: r[:source] + ) end end diff --git a/npm_and_yarn/lib/dependabot/npm_and_yarn/file_updater/yarn_lockfile_updater.rb b/npm_and_yarn/lib/dependabot/npm_and_yarn/file_updater/yarn_lockfile_updater.rb index 0e7592360ef..b0c027088ce 100644 --- a/npm_and_yarn/lib/dependabot/npm_and_yarn/file_updater/yarn_lockfile_updater.rb +++ b/npm_and_yarn/lib/dependabot/npm_and_yarn/file_updater/yarn_lockfile_updater.rb @@ -650,7 +650,7 @@ def yarnrc_specifies_private_reg? yarnrc_global_registry = T.must(T.must(yarnrc_file).content) .lines.find { |line| line.match?(regex) } - &.match(regex) + &.match(regex) &.named_captures &.fetch("registry") @@ -875,7 +875,7 @@ def pattern_in_message(patterns, message) sig do params(error_message: String, yarn_lock: Dependabot::DependencyFile) - .returns(T::Hash[T.any(Symbol, String), T.any(String, NilClass)]) + .returns(T::Hash[T.any(Symbol, String), T.nilable(String)]) end def handle_package_not_found(error_message, yarn_lock) # rubocop:disable Metrics/PerceivedComplexity # There are 2 different package not found error messages diff --git a/npm_and_yarn/lib/dependabot/npm_and_yarn/update_checker.rb b/npm_and_yarn/lib/dependabot/npm_and_yarn/update_checker.rb index e862ac51d60..3be8ec699b3 100644 --- a/npm_and_yarn/lib/dependabot/npm_and_yarn/update_checker.rb +++ b/npm_and_yarn/lib/dependabot/npm_and_yarn/update_checker.rb @@ -544,7 +544,7 @@ def original_source(updated_dependency) sources = updated_dependency .requirements.map { |r| r.fetch(:source) } - .uniq.compact + .uniq.compact .sort_by do |source| Package::RegistryFinder.central_registry?(source[:url]) ? 1 : 0 end diff --git a/npm_and_yarn/lib/dependabot/npm_and_yarn/update_checker/latest_version_finder.rb b/npm_and_yarn/lib/dependabot/npm_and_yarn/update_checker/latest_version_finder.rb index 200dc8328df..1ee31e4dc29 100644 --- a/npm_and_yarn/lib/dependabot/npm_and_yarn/update_checker/latest_version_finder.rb +++ b/npm_and_yarn/lib/dependabot/npm_and_yarn/update_checker/latest_version_finder.rb @@ -237,7 +237,7 @@ def possible_versions(filter_ignored: true) def possible_previous_releases (package_details&.releases || []) .reject do |r| - r.version.prerelease? && !related_to_current_pre?(T.unsafe(r.version)) + r.version.prerelease? && !related_to_current_pre?(T.unsafe(r.version)) end .sort_by(&:version).reverse end diff --git a/npm_and_yarn/lib/dependabot/npm_and_yarn/update_checker/version_resolver.rb b/npm_and_yarn/lib/dependabot/npm_and_yarn/update_checker/version_resolver.rb index 6c193a7a928..0ca12de5704 100644 --- a/npm_and_yarn/lib/dependabot/npm_and_yarn/update_checker/version_resolver.rb +++ b/npm_and_yarn/lib/dependabot/npm_and_yarn/update_checker/version_resolver.rb @@ -347,7 +347,7 @@ def resolve_latest_previous_version(dep, updated_version) .possible_previous_versions_with_details .map(&:first) reqs = dep.requirements.filter_map { |r| r[:requirement] } - .map { |r| requirement_class.requirements_array(r) } + .map { |r| requirement_class.requirements_array(r) } # Pick the lowest version from the max possible version from all # requirements. This matches the logic when combining the same @@ -1016,12 +1016,12 @@ def version_for_dependency(dep) return version_class.new(dep.version) if dep.version && version_class.correct?(dep.version) dep.requirements.filter_map { |r| r[:requirement] } - .reject { |req_string| req_string.start_with?("<") } - .select { |req_string| req_string.match?(version_regex) } - .map { |req_string| req_string.match(version_regex) } - .select { |version| version_class.correct?(version.to_s) } - .map { |version| version_class.new(version.to_s) } - .max + .reject { |req_string| req_string.start_with?("<") } + .select { |req_string| req_string.match?(version_regex) } + .map { |req_string| req_string.match(version_regex) } + .select { |version| version_class.correct?(version.to_s) } + .map { |version| version_class.new(version.to_s) } + .max end sig { returns(T.class_of(Dependabot::Version)) } diff --git a/npm_and_yarn/spec/dependabot/npm_and_yarn/file_updater/npm_lockfile_updater_spec.rb b/npm_and_yarn/spec/dependabot/npm_and_yarn/file_updater/npm_lockfile_updater_spec.rb index 1705c19558f..736e4da3ee8 100644 --- a/npm_and_yarn/spec/dependabot/npm_and_yarn/file_updater/npm_lockfile_updater_spec.rb +++ b/npm_and_yarn/spec/dependabot/npm_and_yarn/file_updater/npm_lockfile_updater_spec.rb @@ -295,7 +295,7 @@ end context "with a registry that times out" do - registry_source = "https://registry.npm.com" + let(:registry_source) { "https://registry.npm.com" } let(:files) { project_dependency_files("npm/simple_with_registry_that_times_out") } let(:error) { Dependabot::PrivateSourceTimedOut.new(registry_source) } diff --git a/npm_and_yarn/spec/dependabot/npm_and_yarn/file_updater/pnpm_lockfile_updater_spec.rb b/npm_and_yarn/spec/dependabot/npm_and_yarn/file_updater/pnpm_lockfile_updater_spec.rb index d7564ccd92e..c05409c3dff 100644 --- a/npm_and_yarn/spec/dependabot/npm_and_yarn/file_updater/pnpm_lockfile_updater_spec.rb +++ b/npm_and_yarn/spec/dependabot/npm_and_yarn/file_updater/pnpm_lockfile_updater_spec.rb @@ -419,12 +419,12 @@ it "raises a helpful error" do expect { updated_pnpm_lock_content } .to raise_error(Dependabot::GitDependenciesNotReachable) do |error| - expect(error.dependency_urls) - .to eq( - [ - "https://github.com/dependabot-fixtures/pnpm_github_dependency_private" - ] - ) + expect(error.dependency_urls) + .to eq( + [ + "https://github.com/dependabot-fixtures/pnpm_github_dependency_private" + ] + ) end end end @@ -467,12 +467,12 @@ it "raises a helpful error" do expect { updated_pnpm_lock_content } .to raise_error(Dependabot::GitDependenciesNotReachable) do |error| - expect(error.dependency_urls) - .to eq( - [ - "https://github.com/dependabot-fixtures/pnpm_github_dependency_private" - ] - ) + expect(error.dependency_urls) + .to eq( + [ + "https://github.com/dependabot-fixtures/pnpm_github_dependency_private" + ] + ) end end end diff --git a/npm_and_yarn/spec/dependabot/npm_and_yarn/file_updater/yarn_lockfile_updater_spec.rb b/npm_and_yarn/spec/dependabot/npm_and_yarn/file_updater/yarn_lockfile_updater_spec.rb index 1a1b9bab7fe..2f18bf40929 100644 --- a/npm_and_yarn/spec/dependabot/npm_and_yarn/file_updater/yarn_lockfile_updater_spec.rb +++ b/npm_and_yarn/spec/dependabot/npm_and_yarn/file_updater/yarn_lockfile_updater_spec.rb @@ -339,7 +339,7 @@ it "raises a helpful error" do expect { updated_yarn_lock_content } .to raise_error(Dependabot::DependencyFileNotResolvable) do |error| - expect(error.message).to eq("package.json: Name contains illegal characters") + expect(error.message).to eq("package.json: Name contains illegal characters") end end end diff --git a/opentofu/lib/dependabot/opentofu/file_parser.rb b/opentofu/lib/dependabot/opentofu/file_parser.rb index 315c0d8446d..c5c39f97210 100644 --- a/opentofu/lib/dependabot/opentofu/file_parser.rb +++ b/opentofu/lib/dependabot/opentofu/file_parser.rb @@ -145,10 +145,10 @@ def build_opentofu_dependency(file, name, source, details) version: version, package_manager: "opentofu", requirements: [ - requirement: version_req, - groups: [], - file: file.name, - source: source + { requirement: version_req, + groups: [], + file: file.name, + source: source } ] ) end @@ -174,14 +174,14 @@ def build_provider_dependency(file, name, details = {}) version: determine_version_for(T.must(hostname), T.must(namespace), T.must(name), version_req), package_manager: "opentofu", requirements: [ - requirement: version_req, - groups: [], - file: file.name, - source: { - type: "provider", - registry_hostname: hostname, - module_identifier: "#{namespace}/#{name}" - } + { requirement: version_req, + groups: [], + file: file.name, + source: { + type: "provider", + registry_hostname: hostname, + module_identifier: "#{namespace}/#{name}" + } } ] ) end @@ -213,10 +213,10 @@ def build_terragrunt_dependency(file, source) version: version, package_manager: "opentofu", requirements: [ - requirement: nil, - groups: [], - file: file.name, - source: source + { requirement: nil, + groups: [], + file: file.name, + source: source } ] ) end diff --git a/opentofu/lib/dependabot/opentofu/file_updater.rb b/opentofu/lib/dependabot/opentofu/file_updater.rb index 35b29aa6ba4..f17e25abc1c 100644 --- a/opentofu/lib/dependabot/opentofu/file_updater.rb +++ b/opentofu/lib/dependabot/opentofu/file_updater.rb @@ -156,7 +156,7 @@ def extract_provider_h1_hashes(content, declaration_regex) content.match(declaration_regex).to_s .match(hashes_object_regex).to_s .split("\n").map { |hash| hash.match(hashes_string_regex).to_s } - .select { |h| h.match?(/^h1:/) } + .select { |h| h.match?(/^h1:/) } end sig { params(content: String, declaration_regex: Regexp).returns(String) } diff --git a/pub/spec/dependabot/pub/requirements_spec.rb b/pub/spec/dependabot/pub/requirements_spec.rb index 1cf55c86824..eec3bf126af 100644 --- a/pub/spec/dependabot/pub/requirements_spec.rb +++ b/pub/spec/dependabot/pub/requirements_spec.rb @@ -45,7 +45,8 @@ context "when specified to version" do let(:requirement_string) { "^1.2.3" } - d = described_class.new(">=1.2.3", "<2.0.0") + let(:d) { described_class.new(">=1.2.3", "<2.0.0") } + it { is_expected.to eq(d) } context "with a zero major" do diff --git a/pub/spec/dependabot/pub/update_checker_spec.rb b/pub/spec/dependabot/pub/update_checker_spec.rb index 606ac7079f8..f1cb5f7a9b8 100644 --- a/pub/spec/dependabot/pub/update_checker_spec.rb +++ b/pub/spec/dependabot/pub/update_checker_spec.rb @@ -955,9 +955,10 @@ end context "when loading a YAML file with alias" do - fixture = "spec/fixtures/projects/yaml_alias/" - alias_info_file = "pubspec_alias_true.yaml" - non_alias_info_file = "pubspec.yaml" + let(:fixture) { "spec/fixtures/projects/yaml_alias/" } + let(:alias_info_file) { "pubspec_alias_true.yaml" } + let(:non_alias_info_file) { "pubspec.yaml" } + it "parses a alias contained YAML file with aliases: true" do yaml_object = File.open(fixture + alias_info_file, "r") data = yaml_object.read diff --git a/python/lib/dependabot/python/file_parser/pipfile_files_parser.rb b/python/lib/dependabot/python/file_parser/pipfile_files_parser.rb index 341d13dce1b..191b69c49a8 100644 --- a/python/lib/dependabot/python/file_parser/pipfile_files_parser.rb +++ b/python/lib/dependabot/python/file_parser/pipfile_files_parser.rb @@ -140,7 +140,7 @@ def dependency_version(dep_name, requirement, group) end sig do - params(obj: T.any(String, NilClass, T::Array[String], T::Hash[String, T.untyped])).returns(T.nilable(String)) + params(obj: T.nilable(T.any(String, T::Array[String], T::Hash[String, T.untyped]))).returns(T.nilable(String)) end def version_from_hash_or_string(obj) case obj @@ -149,7 +149,7 @@ def version_from_hash_or_string(obj) end end - sig { params(req: T.any(String, T::Hash[String, T.untyped])).returns(T.any(T::Boolean, NilClass, String)) } + sig { params(req: T.any(String, T::Hash[String, T.untyped])).returns(T.nilable(T.any(T::Boolean, String))) } def specifies_version?(req) return true if req.is_a?(String) diff --git a/python/lib/dependabot/python/package/package_details_fetcher.rb b/python/lib/dependabot/python/package/package_details_fetcher.rb index a96557f7f5a..534fb2213fb 100644 --- a/python/lib/dependabot/python/package/package_details_fetcher.rb +++ b/python/lib/dependabot/python/package/package_details_fetcher.rb @@ -68,13 +68,13 @@ def fetch package_releases = registry_urls .select { |index_url| validate_index(index_url) } # Ensure only valid URLs .flat_map do |index_url| - fetch_from_registry(index_url) || [] # Ensure it always returns an array - rescue Excon::Error::Timeout, Excon::Error::Socket - raise if MAIN_PYPI_INDEXES.include?(index_url) + fetch_from_registry(index_url) || [] # Ensure it always returns an array + rescue Excon::Error::Timeout, Excon::Error::Socket + raise if MAIN_PYPI_INDEXES.include?(index_url) - raise PrivateSourceTimedOut, sanitized_url(index_url) - rescue URI::InvalidURIError - raise DependencyFileNotResolvable, "Invalid URL: #{sanitized_url(index_url)}" + raise PrivateSourceTimedOut, sanitized_url(index_url) + rescue URI::InvalidURIError + raise DependencyFileNotResolvable, "Invalid URL: #{sanitized_url(index_url)}" end Dependabot::Package::PackageDetails.new( diff --git a/python/lib/dependabot/python/update_checker/requirements_updater.rb b/python/lib/dependabot/python/update_checker/requirements_updater.rb index e06ad7a688e..05002e0f0e3 100644 --- a/python/lib/dependabot/python/update_checker/requirements_updater.rb +++ b/python/lib/dependabot/python/update_checker/requirements_updater.rb @@ -297,7 +297,7 @@ def find_and_update_equality_match(requirement_strings) # Prefix match T.must(requirement_strings.find { |r| r.match?(/^(=+|\d)/) }) .sub(RequirementParser::VERSION) do |v| - at_same_precision(T.must(latest_resolvable_version).to_s, v) + at_same_precision(T.must(latest_resolvable_version).to_s, v) end end end @@ -317,7 +317,7 @@ def at_same_precision(new_version, old_version) new_segments .first(count) .map.with_index { |s, i| i < precision ? s : "*" } - .join(".") + .join(".") end sig { params(requirement_strings: T::Array[String]).returns(String) } diff --git a/python/spec/dependabot/python/pip_compile_package_manager_spec.rb b/python/spec/dependabot/python/pip_compile_package_manager_spec.rb index b8ef96b069e..36edc4e556b 100644 --- a/python/spec/dependabot/python/pip_compile_package_manager_spec.rb +++ b/python/spec/dependabot/python/pip_compile_package_manager_spec.rb @@ -22,8 +22,10 @@ context "when pip-compile version extracted from pyenv is well formed" do # If this test starts failing, you need to adjust the "detect_pipenv_version" function # to return a valid version in format x.x, x.x.x etc. examples: 3.12.5, 3.12 - version = Dependabot::SharedHelpers.run_shell_command("pyenv exec pip-compile --version") - .to_s.split("version ").last&.split(")")&.first + let(:version) do + Dependabot::SharedHelpers.run_shell_command("pyenv exec pip-compile --version") + .to_s.split("version ").last&.split(")")&.first + end it "does not raise error" do expect(version.match(/^\d+(?:\.\d+)*$/)).to be_truthy diff --git a/python/spec/dependabot/python/pip_package_manager_spec.rb b/python/spec/dependabot/python/pip_package_manager_spec.rb index 1269d977dc1..13d7c24a695 100644 --- a/python/spec/dependabot/python/pip_package_manager_spec.rb +++ b/python/spec/dependabot/python/pip_package_manager_spec.rb @@ -22,8 +22,10 @@ context "when pip version extracted from pyenv is well formed" do # If this test starts failing, you need to adjust the "detect_pip_version" function # to return a valid version in format x.x, x.x.x etc. examples: 3.12.5, 3.12 - version = Dependabot::SharedHelpers.run_shell_command("pyenv exec pip --version") - .split("from").first&.split("pip")&.last&.strip.to_s + let(:version) do + Dependabot::SharedHelpers.run_shell_command("pyenv exec pip --version") + .split("from").first&.split("pip")&.last&.strip.to_s + end it "does not raise error" do expect(version.match(/^\d+(?:\.\d+)*$/)).to be_truthy diff --git a/python/spec/dependabot/python/pipenv_package_manager_spec.rb b/python/spec/dependabot/python/pipenv_package_manager_spec.rb index 291f27f3d59..7cea661900f 100644 --- a/python/spec/dependabot/python/pipenv_package_manager_spec.rb +++ b/python/spec/dependabot/python/pipenv_package_manager_spec.rb @@ -22,8 +22,10 @@ context "when pipenv version extracted from pyenv is well formed" do # If this test starts failing, you need to adjust the "detect_pipenv_version" function # to return a valid version in format x.x, x.x.x etc. examples: 3.12.5, 3.12 - version = Dependabot::SharedHelpers.run_shell_command("pyenv exec pipenv --version") - .to_s.split("version ").last&.strip + let(:version) do + Dependabot::SharedHelpers.run_shell_command("pyenv exec pipenv --version") + .to_s.split("version ").last&.strip + end it "does not raise error" do expect(version.match(/^\d+(?:\.\d+)*$/)).to be_truthy diff --git a/python/spec/dependabot/python/poetry_package_manager_spec.rb b/python/spec/dependabot/python/poetry_package_manager_spec.rb index 2cd52f9f041..7a0c663bf9f 100644 --- a/python/spec/dependabot/python/poetry_package_manager_spec.rb +++ b/python/spec/dependabot/python/poetry_package_manager_spec.rb @@ -22,8 +22,10 @@ context "when poetry version extracted from pyenv is well formed" do # If this test starts failing, you need to adjust the "detect_poetry_version" function # to return a valid version in format x.x, x.x.x etc. examples: 3.12.5, 3.12 - version = Dependabot::SharedHelpers.run_shell_command("pyenv exec poetry --version") - .split("version ").last&.split(")")&.first + let(:version) do + Dependabot::SharedHelpers.run_shell_command("pyenv exec poetry --version") + .split("version ").last&.split(")")&.first + end it "does not raise error" do expect(version.match(/^\d+(?:\.\d+)*$/)).to be_truthy diff --git a/python/spec/dependabot/python/requirement_parser_spec.rb b/python/spec/dependabot/python/requirement_parser_spec.rb index 68309c56fbe..15dd98e2668 100644 --- a/python/spec/dependabot/python/requirement_parser_spec.rb +++ b/python/spec/dependabot/python/requirement_parser_spec.rb @@ -13,19 +13,19 @@ def parse(line) requirements = requirement[:requirements].to_s .to_enum(:scan, described_class::REQUIREMENT) .map do - { - comparison: Regexp.last_match[:comparison], - version: Regexp.last_match[:version] - } + { + comparison: Regexp.last_match[:comparison], + version: Regexp.last_match[:version] + } end hashes = requirement[:hashes].to_s .to_enum(:scan, described_class::HASH) .map do - { - algorithm: Regexp.last_match[:algorithm], - hash: Regexp.last_match[:hash] - } + { + algorithm: Regexp.last_match[:algorithm], + hash: Regexp.last_match[:hash] + } end { diff --git a/sorbet/config b/sorbet/config index 82d58c2b575..86f8870649e 100644 --- a/sorbet/config +++ b/sorbet/config @@ -4,6 +4,7 @@ --ignore=.bundle/ --ignore=bin --disable-watchman +--suppress-payload-superclass-redefinition-for=RDoc::Markup::Heading # Sorbet doesn't currently support RSpec very well, so we ignore all of our specs. # See https://stackoverflow.com/a/76548429 diff --git a/sorbet/rbi/gems/addressable@2.8.8.rbi b/sorbet/rbi/gems/addressable@2.8.8.rbi new file mode 100644 index 00000000000..cb480bacb69 --- /dev/null +++ b/sorbet/rbi/gems/addressable@2.8.8.rbi @@ -0,0 +1,2006 @@ +# typed: true + +# DO NOT EDIT MANUALLY +# This is an autogenerated file for types exported from the `addressable` gem. +# Please instead update this file by running `bin/tapioca gem addressable`. + + +# Addressable is a library for processing links and URIs. +# +# source://addressable//lib/addressable/version.rb#22 +module Addressable; end + +# source://addressable//lib/addressable/idna/pure.rb#21 +module Addressable::IDNA + class << self + # source://addressable//lib/addressable/idna/pure.rb#117 + def _deprecated_unicode_normalize_kc(value); end + + # Converts from a Unicode internationalized domain name to an ASCII + # domain name as described in RFC 3490. + # + # source://addressable//lib/addressable/idna/pure.rb#62 + def to_ascii(input); end + + # Converts from an ASCII domain name to a Unicode internationalized + # domain name as described in RFC 3490. + # + # source://addressable//lib/addressable/idna/pure.rb#88 + def to_unicode(input); end + + # @deprecated Use {String#unicode_normalize(:nfkc)} instead + # + # source://addressable//lib/addressable/idna/pure.rb#112 + def unicode_normalize_kc(*args, **_arg1, &block); end + + private + + # source://addressable//lib/addressable/idna/pure.rb#135 + def lookup_unicode_lowercase(codepoint); end + + # Bias adaptation method + # + # source://addressable//lib/addressable/idna/pure.rb#4703 + def punycode_adapt(delta, numpoints, firsttime); end + + # @return [Boolean] + # + # source://addressable//lib/addressable/idna/pure.rb#4671 + def punycode_basic?(codepoint); end + + # source://addressable//lib/addressable/idna/pure.rb#4549 + def punycode_decode(punycode); end + + # Returns the numeric value of a basic codepoint + # (for use in representing integers) in the range 0 to + # base - 1, or PUNYCODE_BASE if codepoint does not represent a value. + # + # source://addressable//lib/addressable/idna/pure.rb#4689 + def punycode_decode_digit(codepoint); end + + # @return [Boolean] + # + # source://addressable//lib/addressable/idna/pure.rb#4676 + def punycode_delimiter?(codepoint); end + + # source://addressable//lib/addressable/idna/pure.rb#4428 + def punycode_encode(unicode); end + + # source://addressable//lib/addressable/idna/pure.rb#4681 + def punycode_encode_digit(d); end + + # Unicode aware downcase method. + # + # @api private + # @param input [String] The input string. + # @return [String] The downcased result. + # + # source://addressable//lib/addressable/idna/pure.rb#127 + def unicode_downcase(input); end + end +end + +# source://addressable//lib/addressable/idna/pure.rb#4398 +Addressable::IDNA::ACE_MAX_LENGTH = T.let(T.unsafe(nil), Integer) + +# This module is loosely based on idn_actionmailer by Mick Staugaard, +# the unicode library by Yoshida Masato, and the punycode implementation +# by Kazuhiro Nishiyama. Most of the code was copied verbatim, but +# some reformatting was done, and some translation from C was done. +# +# Without their code to work from as a base, we'd all still be relying +# on the presence of libidn. Which nobody ever seems to have installed. +# +# Original sources: +# http://github.com/staugaard/idn_actionmailer +# http://www.yoshidam.net/Ruby.html#unicode +# http://rubyforge.org/frs/?group_id=2550 +# +# source://addressable//lib/addressable/idna/pure.rb#35 +Addressable::IDNA::ACE_PREFIX = T.let(T.unsafe(nil), String) + +# source://addressable//lib/addressable/idna/pure.rb#4387 +Addressable::IDNA::COMPOSITION_TABLE = T.let(T.unsafe(nil), Hash) + +# source://addressable//lib/addressable/idna/pure.rb#4400 +Addressable::IDNA::PUNYCODE_BASE = T.let(T.unsafe(nil), Integer) + +# source://addressable//lib/addressable/idna/pure.rb#4404 +Addressable::IDNA::PUNYCODE_DAMP = T.let(T.unsafe(nil), Integer) + +# source://addressable//lib/addressable/idna/pure.rb#4407 +Addressable::IDNA::PUNYCODE_DELIMITER = T.let(T.unsafe(nil), Integer) + +# source://addressable//lib/addressable/idna/pure.rb#4405 +Addressable::IDNA::PUNYCODE_INITIAL_BIAS = T.let(T.unsafe(nil), Integer) + +# source://addressable//lib/addressable/idna/pure.rb#4406 +Addressable::IDNA::PUNYCODE_INITIAL_N = T.let(T.unsafe(nil), Integer) + +# source://addressable//lib/addressable/idna/pure.rb#4409 +Addressable::IDNA::PUNYCODE_MAXINT = T.let(T.unsafe(nil), Integer) + +# source://addressable//lib/addressable/idna/pure.rb#4411 +Addressable::IDNA::PUNYCODE_PRINT_ASCII = T.let(T.unsafe(nil), String) + +# source://addressable//lib/addressable/idna/pure.rb#4403 +Addressable::IDNA::PUNYCODE_SKEW = T.let(T.unsafe(nil), Integer) + +# source://addressable//lib/addressable/idna/pure.rb#4402 +Addressable::IDNA::PUNYCODE_TMAX = T.let(T.unsafe(nil), Integer) + +# source://addressable//lib/addressable/idna/pure.rb#4401 +Addressable::IDNA::PUNYCODE_TMIN = T.let(T.unsafe(nil), Integer) + +# Input is invalid. +# +# source://addressable//lib/addressable/idna/pure.rb#4422 +class Addressable::IDNA::PunycodeBadInput < ::StandardError; end + +# Output would exceed the space provided. +# +# source://addressable//lib/addressable/idna/pure.rb#4424 +class Addressable::IDNA::PunycodeBigOutput < ::StandardError; end + +# Input needs wider integers to process. +# +# source://addressable//lib/addressable/idna/pure.rb#4426 +class Addressable::IDNA::PunycodeOverflow < ::StandardError; end + +# source://addressable//lib/addressable/idna/pure.rb#151 +Addressable::IDNA::UNICODE_DATA = T.let(T.unsafe(nil), Hash) + +# source://addressable//lib/addressable/idna/pure.rb#145 +Addressable::IDNA::UNICODE_DATA_CANONICAL = T.let(T.unsafe(nil), Integer) + +# source://addressable//lib/addressable/idna/pure.rb#143 +Addressable::IDNA::UNICODE_DATA_COMBINING_CLASS = T.let(T.unsafe(nil), Integer) + +# source://addressable//lib/addressable/idna/pure.rb#146 +Addressable::IDNA::UNICODE_DATA_COMPATIBILITY = T.let(T.unsafe(nil), Integer) + +# source://addressable//lib/addressable/idna/pure.rb#144 +Addressable::IDNA::UNICODE_DATA_EXCLUSION = T.let(T.unsafe(nil), Integer) + +# source://addressable//lib/addressable/idna/pure.rb#148 +Addressable::IDNA::UNICODE_DATA_LOWERCASE = T.let(T.unsafe(nil), Integer) + +# source://addressable//lib/addressable/idna/pure.rb#149 +Addressable::IDNA::UNICODE_DATA_TITLECASE = T.let(T.unsafe(nil), Integer) + +# source://addressable//lib/addressable/idna/pure.rb#147 +Addressable::IDNA::UNICODE_DATA_UPPERCASE = T.let(T.unsafe(nil), Integer) + +# source://addressable//lib/addressable/idna/pure.rb#4397 +Addressable::IDNA::UNICODE_MAX_LENGTH = T.let(T.unsafe(nil), Integer) + +# source://addressable//lib/addressable/idna/pure.rb#37 +Addressable::IDNA::UTF8_REGEX = T.let(T.unsafe(nil), Regexp) + +# source://addressable//lib/addressable/idna/pure.rb#48 +Addressable::IDNA::UTF8_REGEX_MULTIBYTE = T.let(T.unsafe(nil), Regexp) + +# This is an implementation of a URI template based on +# RFC 6570 (http://tools.ietf.org/html/rfc6570). +# +# source://addressable//lib/addressable/template.rb#27 +class Addressable::Template + # Creates a new Addressable::Template object. + # + # @param pattern [#to_str] The URI Template pattern. + # @return [Addressable::Template] The initialized Template object. + # + # source://addressable//lib/addressable/template.rb#234 + def initialize(pattern); end + + # Returns true if the Template objects are equal. This method + # does NOT normalize either Template before doing the comparison. + # + # @param template [Object] The Template to compare. + # @return [TrueClass, FalseClass] true if the Templates are equivalent, false + # otherwise. + # + # source://addressable//lib/addressable/template.rb#274 + def ==(template); end + + # Returns true if the Template objects are equal. This method + # does NOT normalize either Template before doing the comparison. + # Addressable::Template makes no distinction between `==` and `eql?`. + # + # @param template [Object] The Template to compare. + # @return [TrueClass, FalseClass] true if the Templates are equivalent, false + # otherwise. + # @see #== + # + # source://addressable//lib/addressable/template.rb#283 + def eql?(template); end + + # Expands a URI template into a full URI. + # + # The object should respond to either the validate or + # transform messages or both. Both the validate and + # transform methods should take two parameters: name and + # value. The validate method should return true + # or false; true if the value of the variable is valid, + # false otherwise. An InvalidTemplateValueError + # exception will be raised if the value is invalid. The transform + # method should return the transformed variable value as a String. + # If a transform method is used, the value will not be percent + # encoded automatically. Unicode normalization will be performed both + # before and after sending the value to the transform method. + # + # @example + # class ExampleProcessor + # def self.validate(name, value) + # return !!(value =~ /^[\w ]+$/) if name == "query" + # return true + # end + # + # def self.transform(name, value) + # return value.gsub(/ /, "+") if name == "query" + # return value + # end + # end + # + # Addressable::Template.new( + # "http://example.com/search/{query}/" + # ).expand( + # {"query" => "an example search query"}, + # ExampleProcessor + # ).to_str + # #=> "http://example.com/search/an+example+search+query/" + # + # Addressable::Template.new( + # "http://example.com/search/{query}/" + # ).expand( + # {"query" => "an example search query"} + # ).to_str + # #=> "http://example.com/search/an%20example%20search%20query/" + # + # Addressable::Template.new( + # "http://example.com/search/{query}/" + # ).expand( + # {"query" => "bogus!"}, + # ExampleProcessor + # ).to_str + # #=> Addressable::Template::InvalidTemplateValueError + # @param mapping [Hash] The mapping that corresponds to the pattern. + # @param processor [#validate, #transform] An optional processor object may be supplied. + # @param normalize_values [Boolean] Optional flag to enable/disable unicode normalization. Default: true + # @return [Addressable::URI] The expanded URI template. + # + # source://addressable//lib/addressable/template.rb#591 + def expand(mapping, processor = T.unsafe(nil), normalize_values = T.unsafe(nil)); end + + # Extracts a mapping from the URI using a URI Template pattern. + # + # @example + # class ExampleProcessor + # def self.restore(name, value) + # return value.gsub(/\+/, " ") if name == "query" + # return value + # end + # + # def self.match(name) + # return ".*?" if name == "first" + # return ".*" + # end + # end + # + # uri = Addressable::URI.parse( + # "http://example.com/search/an+example+search+query/" + # ) + # Addressable::Template.new( + # "http://example.com/search/{query}/" + # ).extract(uri, ExampleProcessor) + # #=> {"query" => "an example search query"} + # + # uri = Addressable::URI.parse("http://example.com/a/b/c/") + # Addressable::Template.new( + # "http://example.com/{first}/{second}/" + # ).extract(uri, ExampleProcessor) + # #=> {"first" => "a", "second" => "b/c"} + # + # uri = Addressable::URI.parse("http://example.com/a/b/c/") + # Addressable::Template.new( + # "http://example.com/{first}/{-list|/|second}/" + # ).extract(uri) + # #=> {"first" => "a", "second" => ["b", "c"]} + # @param uri [Addressable::URI, #to_str] The URI to extract from. + # @param processor [#restore, #match] A template processor object may optionally be supplied. + # + # The object should respond to either the restore or + # match messages or both. The restore method should + # take two parameters: `[String] name` and `[String] value`. + # The restore method should reverse any transformations that + # have been performed on the value to ensure a valid URI. + # The match method should take a single + # parameter: `[String] name`. The match method should return + # a String containing a regular expression capture group for + # matching on that particular variable. The default value is `".*?"`. + # The match method has no effect on multivariate operator + # expansions. + # @return [Hash, NilClass] The Hash mapping that was extracted from the URI, or + # nil if the URI didn't match the template. + # + # source://addressable//lib/addressable/template.rb#342 + def extract(uri, processor = T.unsafe(nil)); end + + # Freeze URI, initializing instance variables. + # + # @return [Addressable::URI] The frozen URI object. + # + # source://addressable//lib/addressable/template.rb#245 + def freeze; end + + # Returns a String representation of the Template object's state. + # + # @return [String] The Template object's state, as a String. + # + # source://addressable//lib/addressable/template.rb#260 + def inspect; end + + # Returns an Array of variables used within the template pattern. + # The variables are listed in the Array in the order they appear within + # the pattern. Multiple occurrences of a variable within a pattern are + # not represented in this Array. + # + # @return [Array] The variables present in the template's pattern. + # + # source://addressable//lib/addressable/template.rb#610 + def keys; end + + # Extracts match data from the URI using a URI Template pattern. + # + # @example + # class ExampleProcessor + # def self.restore(name, value) + # return value.gsub(/\+/, " ") if name == "query" + # return value + # end + # + # def self.match(name) + # return ".*?" if name == "first" + # return ".*" + # end + # end + # + # uri = Addressable::URI.parse( + # "http://example.com/search/an+example+search+query/" + # ) + # match = Addressable::Template.new( + # "http://example.com/search/{query}/" + # ).match(uri, ExampleProcessor) + # match.variables + # #=> ["query"] + # match.captures + # #=> ["an example search query"] + # + # uri = Addressable::URI.parse("http://example.com/a/b/c/") + # match = Addressable::Template.new( + # "http://example.com/{first}/{+second}/" + # ).match(uri, ExampleProcessor) + # match.variables + # #=> ["first", "second"] + # match.captures + # #=> ["a", "b/c"] + # + # uri = Addressable::URI.parse("http://example.com/a/b/c/") + # match = Addressable::Template.new( + # "http://example.com/{first}{/second*}/" + # ).match(uri) + # match.variables + # #=> ["first", "second"] + # match.captures + # #=> ["a", ["b", "c"]] + # @param uri [Addressable::URI, #to_str] The URI to extract from. + # @param processor [#restore, #match] A template processor object may optionally be supplied. + # + # The object should respond to either the restore or + # match messages or both. The restore method should + # take two parameters: `[String] name` and `[String] value`. + # The restore method should reverse any transformations that + # have been performed on the value to ensure a valid URI. + # The match method should take a single + # parameter: `[String] name`. The match method should return + # a String containing a regular expression capture group for + # matching on that particular variable. The default value is `".*?"`. + # The match method has no effect on multivariate operator + # expansions. + # @return [Hash, NilClass] The Hash mapping that was extracted from the URI, or + # nil if the URI didn't match the template. + # + # source://addressable//lib/addressable/template.rb#413 + def match(uri, processor = T.unsafe(nil)); end + + # Returns the named captures of the coerced `Regexp`. + # + # @api private + # @return [Hash] The named captures of the `Regexp` given by {#to_regexp}. + # + # source://addressable//lib/addressable/template.rb#651 + def named_captures; end + + # Returns an Array of variables used within the template pattern. + # The variables are listed in the Array in the order they appear within + # the pattern. Multiple occurrences of a variable within a pattern are + # not represented in this Array. + # + # @return [Array] The variables present in the template's pattern. + # + # source://addressable//lib/addressable/template.rb#611 + def names; end + + # Expands a URI template into another URI template. + # + # The object should respond to either the validate or + # transform messages or both. Both the validate and + # transform methods should take two parameters: name and + # value. The validate method should return true + # or false; true if the value of the variable is valid, + # false otherwise. An InvalidTemplateValueError + # exception will be raised if the value is invalid. The transform + # method should return the transformed variable value as a String. + # If a transform method is used, the value will not be percent + # encoded automatically. Unicode normalization will be performed both + # before and after sending the value to the transform method. + # + # @example + # Addressable::Template.new( + # "http://example.com/{one}/{two}/" + # ).partial_expand({"one" => "1"}).pattern + # #=> "http://example.com/1/{two}/" + # + # Addressable::Template.new( + # "http://example.com/{?one,two}/" + # ).partial_expand({"one" => "1"}).pattern + # #=> "http://example.com/?one=1{&two}/" + # + # Addressable::Template.new( + # "http://example.com/{?one,two,three}/" + # ).partial_expand({"one" => "1", "three" => 3}).pattern + # #=> "http://example.com/?one=1{&two}&three=3" + # @param mapping [Hash] The mapping that corresponds to the pattern. + # @param processor [#validate, #transform] An optional processor object may be supplied. + # @param normalize_values [Boolean] Optional flag to enable/disable unicode normalization. Default: true + # @return [Addressable::Template] The partially expanded URI template. + # + # source://addressable//lib/addressable/template.rb#524 + def partial_expand(mapping, processor = T.unsafe(nil), normalize_values = T.unsafe(nil)); end + + # @return [String] The Template object's pattern. + # + # source://addressable//lib/addressable/template.rb#254 + def pattern; end + + # Returns the source of the coerced `Regexp`. + # + # @api private + # @return [String] The source of the `Regexp` given by {#to_regexp}. + # + # source://addressable//lib/addressable/template.rb#641 + def source; end + + # Coerces a template into a `Regexp` object. This regular expression will + # behave very similarly to the actual template, and should match the same + # URI values, but it cannot fully handle, for example, values that would + # extract to an `Array`. + # + # @return [Regexp] A regular expression which should match the template. + # + # source://addressable//lib/addressable/template.rb#630 + def to_regexp; end + + # Returns a mapping of variables to their default values specified + # in the template. Variables without defaults are not returned. + # + # @return [Hash] Mapping of template variables to their defaults + # + # source://addressable//lib/addressable/template.rb#618 + def variable_defaults; end + + # Returns an Array of variables used within the template pattern. + # The variables are listed in the Array in the order they appear within + # the pattern. Multiple occurrences of a variable within a pattern are + # not represented in this Array. + # + # @return [Array] The variables present in the template's pattern. + # + # source://addressable//lib/addressable/template.rb#607 + def variables; end + + private + + # Takes a set of values, and joins them together based on the + # operator. + # + # @param operator [String, Nil] One of the operators from the set + # (?,&,+,#,;,/,.), or nil if there wasn't one. + # @param return_value [Array] The set of return values (as [variable_name, value] tuples) that will + # be joined together. + # @return [String] The transformed mapped value + # + # source://addressable//lib/addressable/template.rb#861 + def join_values(operator, return_value); end + + # Generates a hash with string keys + # + # @param mapping [Hash] A mapping hash to normalize + # @return [Hash] A hash with stringified keys + # + # source://addressable//lib/addressable/template.rb#924 + def normalize_keys(mapping); end + + # Takes a set of values, and joins them together based on the + # operator. + # + # @param value [Hash, Array, String] Normalizes unicode keys and values with String#unicode_normalize (NFC) + # @return [Hash, Array, String] The normalized values + # + # source://addressable//lib/addressable/template.rb#898 + def normalize_value(value); end + + # source://addressable//lib/addressable/template.rb#656 + def ordered_variable_defaults; end + + # Generates the Regexp that parses a template pattern. + # + # @param pattern [String] The URI template pattern. + # @param processor [#match] The template processor to use. + # @return [Array, Regexp] An array of expansion variables nad a regular expression which may be + # used to parse a template pattern + # + # source://addressable//lib/addressable/template.rb#968 + def parse_new_template_pattern(pattern, processor = T.unsafe(nil)); end + + # Generates the Regexp that parses a template pattern. Memoizes the + # value if template processor not set (processors may not be deterministic) + # + # @param pattern [String] The URI template pattern. + # @param processor [#match] The template processor to use. + # @return [Array, Regexp] An array of expansion variables nad a regular expression which may be + # used to parse a template pattern + # + # source://addressable//lib/addressable/template.rb#950 + def parse_template_pattern(pattern, processor = T.unsafe(nil)); end + + # Transforms a mapped value so that values can be substituted into the + # template. + # + # The object should respond to either the validate or + # transform messages or both. Both the validate and + # transform methods should take two parameters: name and + # value. The validate method should return true + # or false; true if the value of the variable is valid, + # false otherwise. An InvalidTemplateValueError exception + # will be raised if the value is invalid. The transform method + # should return the transformed variable value as a String. If a + # transform method is used, the value will not be percent encoded + # automatically. Unicode normalization will be performed both before and + # after sending the value to the transform method. + # + # @param mapping [Hash] The mapping to replace captures + # @param capture [String] The expression to replace + # @param processor [#validate, #transform] An optional processor object may be supplied. + # @param normalize_values [Boolean] Optional flag to enable/disable unicode normalization. Default: true + # @return [String] The expanded expression + # + # source://addressable//lib/addressable/template.rb#753 + def transform_capture(mapping, capture, processor = T.unsafe(nil), normalize_values = T.unsafe(nil)); end + + # Loops through each capture and expands any values available in mapping + # + # The object should respond to either the validate or + # transform messages or both. Both the validate and + # transform methods should take two parameters: name and + # value. The validate method should return true + # or false; true if the value of the variable is valid, + # false otherwise. An InvalidTemplateValueError exception + # will be raised if the value is invalid. The transform method + # should return the transformed variable value as a String. If a + # transform method is used, the value will not be percent encoded + # automatically. Unicode normalization will be performed both before and + # after sending the value to the transform method. + # + # @param mapping [Hash] Set of keys to expand + # @param capture [String] The expression to expand + # @param processor [#validate, #transform] An optional processor object may be supplied. + # @param normalize_values [Boolean] Optional flag to enable/disable unicode normalization. Default: true + # @return [String] The expanded expression + # + # source://addressable//lib/addressable/template.rb#694 + def transform_partial_capture(mapping, capture, processor = T.unsafe(nil), normalize_values = T.unsafe(nil)); end +end + +# source://addressable//lib/addressable/template.rb#58 +Addressable::Template::EXPRESSION = T.let(T.unsafe(nil), Regexp) + +# Raised if an invalid template operator is used in a pattern. +# +# source://addressable//lib/addressable/template.rb#85 +class Addressable::Template::InvalidTemplateOperatorError < ::StandardError; end + +# Raised if an invalid template value is supplied. +# +# source://addressable//lib/addressable/template.rb#80 +class Addressable::Template::InvalidTemplateValueError < ::StandardError; end + +# source://addressable//lib/addressable/template.rb#70 +Addressable::Template::JOINERS = T.let(T.unsafe(nil), Hash) + +# source://addressable//lib/addressable/template.rb#62 +Addressable::Template::LEADERS = T.let(T.unsafe(nil), Hash) + +# This class represents the data that is extracted when a Template +# is matched against a URI. +# +# source://addressable//lib/addressable/template.rb#96 +class Addressable::Template::MatchData + # Creates a new MatchData object. + # MatchData objects should never be instantiated directly. + # + # @param uri [Addressable::URI] The URI that the template was matched against. + # @return [MatchData] a new instance of MatchData + # + # source://addressable//lib/addressable/template.rb#103 + def initialize(uri, template, mapping); end + + # Accesses captured values by name or by index. + # + # @param key [String, Symbol, Fixnum] Capture index or name. Note that when accessing by with index + # of 0, the full URI will be returned. The intention is to mimic + # the ::MatchData#[] behavior. + # @param len [#to_int, nil] If provided, an array of values will be returned with the given + # parameter used as length. + # @return [Array, String, nil] The captured value corresponding to the index or name. If the + # value was not provided or the key is unknown, nil will be + # returned. + # + # If the second parameter is provided, an array of that length will + # be returned instead. + # + # source://addressable//lib/addressable/template.rb#170 + def [](key, len = T.unsafe(nil)); end + + # @return [Array] The list of values that were captured by the Template. + # Note that this list will include nils for any variables which + # were in the Template, but did not appear in the URI. + # + # source://addressable//lib/addressable/template.rb#149 + def captures; end + + # Returns a String representation of the MatchData's state. + # + # @return [String] The MatchData's state, as a String. + # + # source://addressable//lib/addressable/template.rb#213 + def inspect; end + + # @return [Array] The list of variables that were present in the Template. + # Note that this list will include variables which do not appear + # in the mapping because they were not present in URI. + # + # source://addressable//lib/addressable/template.rb#135 + def keys; end + + # @return [Hash] The mapping that resulted from the match. + # Note that this mapping does not include keys or values for + # variables that appear in the Template, but are not present + # in the URI. + # + # source://addressable//lib/addressable/template.rb#125 + def mapping; end + + # @return [Array] The list of variables that were present in the Template. + # Note that this list will include variables which do not appear + # in the mapping because they were not present in URI. + # + # source://addressable//lib/addressable/template.rb#136 + def names; end + + # Dummy method for code expecting a ::MatchData instance + # + # @return [String] An empty string. + # + # source://addressable//lib/addressable/template.rb#225 + def post_match; end + + # Dummy method for code expecting a ::MatchData instance + # + # @return [String] An empty string. + # + # source://addressable//lib/addressable/template.rb#222 + def pre_match; end + + # @return [String] The matched URI as String. + # + # source://addressable//lib/addressable/template.rb#194 + def string; end + + # @return [Addressable::Template] The Template used for the match. + # + # source://addressable//lib/addressable/template.rb#117 + def template; end + + # @return [Array] Array with the matched URI as first element followed by the captured + # values. + # + # source://addressable//lib/addressable/template.rb#184 + def to_a; end + + # @return [String] The matched URI as String. + # + # source://addressable//lib/addressable/template.rb#191 + def to_s; end + + # @return [Addressable::URI] The URI that the Template was matched against. + # + # source://addressable//lib/addressable/template.rb#112 + def uri; end + + # @return [Array] The list of values that were captured by the Template. + # Note that this list will include nils for any variables which + # were in the Template, but did not appear in the URI. + # + # source://addressable//lib/addressable/template.rb#143 + def values; end + + # Returns multiple captured values at once. + # + # @param *indexes [String, Symbol, Fixnum] Indices of the captures to be returned + # @return [Array] Values corresponding to given indices. + # @see Addressable::Template::MatchData#[] + # + # source://addressable//lib/addressable/template.rb#205 + def values_at(*indexes); end + + # @return [Array] The list of variables that were present in the Template. + # Note that this list will include variables which do not appear + # in the mapping because they were not present in URI. + # + # source://addressable//lib/addressable/template.rb#132 + def variables; end +end + +# source://addressable//lib/addressable/template.rb#40 +Addressable::Template::RESERVED = T.let(T.unsafe(nil), String) + +# Raised if an invalid template operator is used in a pattern. +# +# source://addressable//lib/addressable/template.rb#90 +class Addressable::Template::TemplateOperatorAbortedError < ::StandardError; end + +# source://addressable//lib/addressable/template.rb#42 +Addressable::Template::UNRESERVED = T.let(T.unsafe(nil), String) + +# source://addressable//lib/addressable/template.rb#54 +Addressable::Template::VARIABLE_LIST = T.let(T.unsafe(nil), Regexp) + +# source://addressable//lib/addressable/template.rb#50 +Addressable::Template::VARNAME = T.let(T.unsafe(nil), Regexp) + +# source://addressable//lib/addressable/template.rb#52 +Addressable::Template::VARSPEC = T.let(T.unsafe(nil), Regexp) + +# This is an implementation of a URI parser based on +# RFC 3986, +# RFC 3987. +# +# source://addressable//lib/addressable/uri.rb#31 +class Addressable::URI + # Creates a new uri object from component parts. + # + # @option [String, + # @option [String, + # @option [String, + # @option [String, + # @option [String, + # @option [String, + # @option [String, + # @option [String, + # @option [String, + # @option [String, + # @param [String, [Hash] a customizable set of options + # @return [Addressable::URI] The constructed URI object. + # + # source://addressable//lib/addressable/uri.rb#830 + def initialize(options = T.unsafe(nil)); end + + # Joins two URIs together. + # + # @param The [String, Addressable::URI, #to_str] URI to join with. + # @return [Addressable::URI] The joined URI. + # + # source://addressable//lib/addressable/uri.rb#1982 + def +(uri); end + + # Returns true if the URI objects are equal. This method + # normalizes both URIs before doing the comparison. + # + # @param uri [Object] The URI to compare. + # @return [TrueClass, FalseClass] true if the URIs are equivalent, false + # otherwise. + # + # source://addressable//lib/addressable/uri.rb#2239 + def ==(uri); end + + # Returns true if the URI objects are equal. This method + # normalizes both URIs before doing the comparison, and allows comparison + # against Strings. + # + # @param uri [Object] The URI to compare. + # @return [TrueClass, FalseClass] true if the URIs are equivalent, false + # otherwise. + # + # source://addressable//lib/addressable/uri.rb#2217 + def ===(uri); end + + # Determines if the URI is absolute. + # + # @return [TrueClass, FalseClass] true if the URI is absolute. false + # otherwise. + # + # source://addressable//lib/addressable/uri.rb#1879 + def absolute?; end + + # The authority component for this URI. + # Combines the user, password, host, and port components. + # + # @return [String] The authority component. + # + # source://addressable//lib/addressable/uri.rb#1234 + def authority; end + + # Sets the authority component for this URI. + # + # @param new_authority [String, #to_str] The new authority component. + # + # source://addressable//lib/addressable/uri.rb#1274 + def authority=(new_authority); end + + # The basename, if any, of the file in the path component. + # + # @return [String] The path's basename. + # + # source://addressable//lib/addressable/uri.rb#1588 + def basename; end + + # The default port for this URI's scheme. + # This method will always returns the default port for the URI's scheme + # regardless of the presence of an explicit port in the URI. + # + # @return [Integer] The default port. + # + # source://addressable//lib/addressable/uri.rb#1454 + def default_port; end + + # This method allows you to make several changes to a URI simultaneously, + # which separately would cause validation errors, but in conjunction, + # are valid. The URI will be revalidated as soon as the entire block has + # been executed. + # + # @param block [Proc] A set of operations to perform on a given URI. + # + # source://addressable//lib/addressable/uri.rb#2396 + def defer_validation; end + + # Creates a URI suitable for display to users. If semantic attacks are + # likely, the application should try to detect these and warn the user. + # See RFC 3986, + # section 7.6 for more information. + # + # @return [Addressable::URI] A URI suitable for display purposes. + # + # source://addressable//lib/addressable/uri.rb#2201 + def display_uri; end + + # Returns the public suffix domain for this host. + # + # @example + # Addressable::URI.parse("http://www.example.co.uk").domain # => "example.co.uk" + # + # source://addressable//lib/addressable/uri.rb#1225 + def domain; end + + # Clones the URI object. + # + # @return [Addressable::URI] The cloned URI. + # + # source://addressable//lib/addressable/uri.rb#2271 + def dup; end + + # Determines if the URI is an empty string. + # + # @return [TrueClass, FalseClass] Returns true if empty, false otherwise. + # + # source://addressable//lib/addressable/uri.rb#2333 + def empty?; end + + # source://addressable//lib/addressable/uri.rb#2406 + def encode_with(coder); end + + # Returns true if the URI objects are equal. This method + # does NOT normalize either URI before doing the comparison. + # + # @param uri [Object] The URI to compare. + # @return [TrueClass, FalseClass] true if the URIs are equivalent, false + # otherwise. + # + # source://addressable//lib/addressable/uri.rb#2253 + def eql?(uri); end + + # The extname, if any, of the file in the path component. + # Empty string if there is no extension. + # + # @return [String] The path's extname. + # + # source://addressable//lib/addressable/uri.rb#1598 + def extname; end + + # The fragment component for this URI. + # + # @return [String] The fragment component. + # + # source://addressable//lib/addressable/uri.rb#1810 + def fragment; end + + # Sets the fragment component for this URI. + # + # @param new_fragment [String, #to_str] The new fragment component. + # + # source://addressable//lib/addressable/uri.rb#1835 + def fragment=(new_fragment); end + + # Freeze URI, initializing instance variables. + # + # @return [Addressable::URI] The frozen URI object. + # + # source://addressable//lib/addressable/uri.rb#870 + def freeze; end + + # A hash value that will make a URI equivalent to its normalized + # form. + # + # @return [Integer] A hash of the URI. + # + # source://addressable//lib/addressable/uri.rb#2263 + def hash; end + + # The host component for this URI. + # + # @return [String] The host component. + # + # source://addressable//lib/addressable/uri.rb#1120 + def host; end + + # Sets the host component for this URI. + # + # @param new_host [String, #to_str] The new host component. + # + # source://addressable//lib/addressable/uri.rb#1156 + def host=(new_host); end + + # This method is same as URI::Generic#host except + # brackets for IPv6 (and 'IPvFuture') addresses are removed. + # + # @return [String] The hostname for this URI. + # @see Addressable::URI#host + # + # source://addressable//lib/addressable/uri.rb#1178 + def hostname; end + + # This method is same as URI::Generic#host= except + # the argument can be a bare IPv6 address (or 'IPvFuture'). + # + # @param new_hostname [String, #to_str] The new hostname for this URI. + # @see Addressable::URI#host= + # + # source://addressable//lib/addressable/uri.rb#1190 + def hostname=(new_hostname); end + + # The inferred port component for this URI. + # This method will normalize to the default port for the URI's scheme if + # the port isn't explicitly specified in the URI. + # + # @return [Integer] The inferred port component. + # + # source://addressable//lib/addressable/uri.rb#1440 + def inferred_port; end + + # source://addressable//lib/addressable/uri.rb#2417 + def init_with(coder); end + + # Returns a String representation of the URI object's state. + # + # @return [String] The URI object's state, as a String. + # + # source://addressable//lib/addressable/uri.rb#2384 + def inspect; end + + # Determines if the scheme indicates an IP-based protocol. + # + # @return [TrueClass, FalseClass] true if the scheme indicates an IP-based protocol. + # false otherwise. + # + # source://addressable//lib/addressable/uri.rb#1855 + def ip_based?; end + + # Joins two URIs together. + # + # @param The [String, Addressable::URI, #to_str] URI to join with. + # @return [Addressable::URI] The joined URI. + # + # source://addressable//lib/addressable/uri.rb#1889 + def join(uri); end + + # Destructive form of join. + # + # @param The [String, Addressable::URI, #to_str] URI to join with. + # @return [Addressable::URI] The joined URI. + # @see Addressable::URI#join + # + # source://addressable//lib/addressable/uri.rb#1992 + def join!(uri); end + + # Merges a URI with a Hash of components. + # This method has different behavior from join. Any + # components present in the hash parameter will override the + # original components. The path component is not treated specially. + # + # @param The [Hash, Addressable::URI, #to_hash] components to merge with. + # @return [Addressable::URI] The merged URI. + # @see Hash#merge + # + # source://addressable//lib/addressable/uri.rb#2007 + def merge(hash); end + + # Destructive form of merge. + # + # @param The [Hash, Addressable::URI, #to_hash] components to merge with. + # @return [Addressable::URI] The merged URI. + # @see Addressable::URI#merge + # + # source://addressable//lib/addressable/uri.rb#2072 + def merge!(uri); end + + # Returns a normalized URI object. + # + # NOTE: This method does not attempt to fully conform to specifications. + # It exists largely to correct other people's failures to read the + # specifications, and also to deal with caching issues since several + # different URIs may represent the same resource and should not be + # cached multiple times. + # + # @return [Addressable::URI] The normalized URI. + # + # source://addressable//lib/addressable/uri.rb#2164 + def normalize; end + + # Destructively normalizes this URI object. + # + # @return [Addressable::URI] The normalized URI. + # @see Addressable::URI#normalize + # + # source://addressable//lib/addressable/uri.rb#2190 + def normalize!; end + + # The authority component for this URI, normalized. + # + # @return [String] The authority component, normalized. + # + # source://addressable//lib/addressable/uri.rb#1252 + def normalized_authority; end + + # The fragment component for this URI, normalized. + # + # @return [String] The fragment component, normalized. + # + # source://addressable//lib/addressable/uri.rb#1816 + def normalized_fragment; end + + # The host component for this URI, normalized. + # + # @return [String] The host component, normalized. + # + # source://addressable//lib/addressable/uri.rb#1126 + def normalized_host; end + + # The password component for this URI, normalized. + # + # @return [String] The password component, normalized. + # + # source://addressable//lib/addressable/uri.rb#1002 + def normalized_password; end + + # The path component for this URI, normalized. + # + # @return [String] The path component, normalized. + # + # source://addressable//lib/addressable/uri.rb#1535 + def normalized_path; end + + # The port component for this URI, normalized. + # + # @return [Integer] The port component, normalized. + # + # source://addressable//lib/addressable/uri.rb#1392 + def normalized_port; end + + # The query component for this URI, normalized. + # + # @return [String] The query component, normalized. + # + # source://addressable//lib/addressable/uri.rb#1613 + def normalized_query(*flags); end + + # The scheme component for this URI, normalized. + # + # @return [String] The scheme component, normalized. + # + # source://addressable//lib/addressable/uri.rb#896 + def normalized_scheme; end + + # The normalized combination of components that represent a site. + # Combines the scheme, user, password, host, and port components. + # Primarily useful for HTTP and HTTPS. + # + # For example, "http://example.com/path?query" would have a + # site value of "http://example.com". + # + # @return [String] The normalized components that identify a site. + # + # source://addressable//lib/addressable/uri.rb#1485 + def normalized_site; end + + # The user component for this URI, normalized. + # + # @return [String] The user component, normalized. + # + # source://addressable//lib/addressable/uri.rb#947 + def normalized_user; end + + # The userinfo component for this URI, normalized. + # + # @return [String] The userinfo component, normalized. + # + # source://addressable//lib/addressable/uri.rb#1068 + def normalized_userinfo; end + + # Omits components from a URI. + # + # @example + # uri = Addressable::URI.parse("http://example.com/path?query") + # #=> # + # uri.omit(:scheme, :authority) + # #=> # + # @param *components [Symbol] The components to be omitted. + # @return [Addressable::URI] The URI with components omitted. + # + # source://addressable//lib/addressable/uri.rb#2297 + def omit(*components); end + + # Destructive form of omit. + # + # @param *components [Symbol] The components to be omitted. + # @return [Addressable::URI] The URI with components omitted. + # @see Addressable::URI#omit + # + # source://addressable//lib/addressable/uri.rb#2324 + def omit!(*components); end + + # The origin for this URI, serialized to ASCII, as per + # RFC 6454, section 6.2. + # + # @return [String] The serialized origin. + # + # source://addressable//lib/addressable/uri.rb#1314 + def origin; end + + # Sets the origin for this URI, serialized to ASCII, as per + # RFC 6454, section 6.2. This assignment will reset the `userinfo` + # component. + # + # @param new_origin [String, #to_str] The new origin component. + # + # source://addressable//lib/addressable/uri.rb#1333 + def origin=(new_origin); end + + # The password component for this URI. + # + # @return [String] The password component. + # + # source://addressable//lib/addressable/uri.rb#996 + def password; end + + # Sets the password component for this URI. + # + # @param new_password [String, #to_str] The new password component. + # + # source://addressable//lib/addressable/uri.rb#1025 + def password=(new_password); end + + # The path component for this URI. + # + # @return [String] The path component. + # + # source://addressable//lib/addressable/uri.rb#1528 + def path; end + + # Sets the path component for this URI. + # + # @param new_path [String, #to_str] The new path component. + # + # source://addressable//lib/addressable/uri.rb#1567 + def path=(new_path); end + + # The port component for this URI. + # This is the port number actually given in the URI. This does not + # infer port numbers from default values. + # + # @return [Integer] The port component. + # + # source://addressable//lib/addressable/uri.rb#1386 + def port; end + + # Sets the port component for this URI. + # + # @param new_port [String, Integer, #to_s] The new port component. + # + # source://addressable//lib/addressable/uri.rb#1408 + def port=(new_port); end + + # The query component for this URI. + # + # @return [String] The query component. + # + # source://addressable//lib/addressable/uri.rb#1607 + def query; end + + # Sets the query component for this URI. + # + # @param new_query [String, #to_str] The new query component. + # + # source://addressable//lib/addressable/uri.rb#1641 + def query=(new_query); end + + # Converts the query component to a Hash value. + # + # @example + # Addressable::URI.parse("?one=1&two=2&three=3").query_values + # #=> {"one" => "1", "two" => "2", "three" => "3"} + # Addressable::URI.parse("?one=two&one=three").query_values(Array) + # #=> [["one", "two"], ["one", "three"]] + # Addressable::URI.parse("?one=two&one=three").query_values(Hash) + # #=> {"one" => "three"} + # Addressable::URI.parse("?").query_values + # #=> {} + # Addressable::URI.parse("").query_values + # #=> nil + # @param return_type [Class] The return type desired. Value must be either + # `Hash` or `Array`. + # @return [Hash, Array, nil] The query string parsed as a Hash or Array + # or nil if the query string is blank. + # + # source://addressable//lib/addressable/uri.rb#1672 + def query_values(return_type = T.unsafe(nil)); end + + # Sets the query component for this URI from a Hash object. + # An empty Hash or Array will result in an empty query string. + # + # @example + # uri.query_values = {:a => "a", :b => ["c", "d", "e"]} + # uri.query + # # => "a=a&b=c&b=d&b=e" + # uri.query_values = [['a', 'a'], ['b', 'c'], ['b', 'd'], ['b', 'e']] + # uri.query + # # => "a=a&b=c&b=d&b=e" + # uri.query_values = [['a', 'a'], ['b', ['c', 'd', 'e']]] + # uri.query + # # => "a=a&b=c&b=d&b=e" + # uri.query_values = [['flag'], ['key', 'value']] + # uri.query + # # => "flag&key=value" + # @param new_query_values [Hash, #to_hash, Array] The new query values. + # + # source://addressable//lib/addressable/uri.rb#1723 + def query_values=(new_query_values); end + + # Determines if the URI is relative. + # + # @return [TrueClass, FalseClass] true if the URI is relative. false + # otherwise. + # + # source://addressable//lib/addressable/uri.rb#1869 + def relative?; end + + # The HTTP request URI for this URI. This is the path and the + # query string. + # + # @return [String] The request URI required for an HTTP request. + # + # source://addressable//lib/addressable/uri.rb#1774 + def request_uri; end + + # Sets the HTTP request URI for this URI. + # + # @param new_request_uri [String, #to_str] The new HTTP request URI. + # + # source://addressable//lib/addressable/uri.rb#1786 + def request_uri=(new_request_uri); end + + # Returns the shortest normalized relative form of this URI that uses the + # supplied URI as a base for resolution. Returns an absolute URI if + # necessary. This is effectively the opposite of route_to. + # + # @param uri [String, Addressable::URI, #to_str] The URI to route from. + # @return [Addressable::URI] The normalized relative URI that is equivalent to the original URI. + # + # source://addressable//lib/addressable/uri.rb#2085 + def route_from(uri); end + + # Returns the shortest normalized relative form of the supplied URI that + # uses this URI as a base for resolution. Returns an absolute URI if + # necessary. This is effectively the opposite of route_from. + # + # @param uri [String, Addressable::URI, #to_str] The URI to route to. + # @return [Addressable::URI] The normalized relative URI that is equivalent to the supplied URI. + # + # source://addressable//lib/addressable/uri.rb#2150 + def route_to(uri); end + + # The scheme component for this URI. + # + # @return [String] The scheme component. + # + # source://addressable//lib/addressable/uri.rb#890 + def scheme; end + + # Sets the scheme component for this URI. + # + # @param new_scheme [String, #to_str] The new scheme component. + # + # source://addressable//lib/addressable/uri.rb#917 + def scheme=(new_scheme); end + + # The combination of components that represent a site. + # Combines the scheme, user, password, host, and port components. + # Primarily useful for HTTP and HTTPS. + # + # For example, "http://example.com/path?query" would have a + # site value of "http://example.com". + # + # @return [String] The components that identify a site. + # + # source://addressable//lib/addressable/uri.rb#1467 + def site; end + + # Sets the site value for this URI. + # + # @param new_site [String, #to_str] The new site value. + # + # source://addressable//lib/addressable/uri.rb#1506 + def site=(new_site); end + + # Returns the top-level domain for this host. + # + # @example + # Addressable::URI.parse("http://www.example.co.uk").tld # => "co.uk" + # + # source://addressable//lib/addressable/uri.rb#1207 + def tld; end + + # Sets the top-level domain for this URI. + # + # @param new_tld [String, #to_str] The new top-level domain. + # + # source://addressable//lib/addressable/uri.rb#1215 + def tld=(new_tld); end + + # Returns a Hash of the URI components. + # + # @return [Hash] The URI as a Hash of components. + # + # source://addressable//lib/addressable/uri.rb#2367 + def to_hash; end + + # Converts the URI to a String. + # + # @return [String] The URI's String representation. + # + # source://addressable//lib/addressable/uri.rb#2341 + def to_s; end + + # Converts the URI to a String. + # URI's are glorified Strings. Allow implicit conversion. + # + # @return [String] The URI's String representation. + # + # source://addressable//lib/addressable/uri.rb#2361 + def to_str; end + + # The user component for this URI. + # + # @return [String] The user component. + # + # source://addressable//lib/addressable/uri.rb#941 + def user; end + + # Sets the user component for this URI. + # + # @param new_user [String, #to_str] The new user component. + # + # source://addressable//lib/addressable/uri.rb#970 + def user=(new_user); end + + # The userinfo component for this URI. + # Combines the user and password components. + # + # @return [String] The userinfo component. + # + # source://addressable//lib/addressable/uri.rb#1052 + def userinfo; end + + # Sets the userinfo component for this URI. + # + # @param new_userinfo [String, #to_str] The new userinfo component. + # + # source://addressable//lib/addressable/uri.rb#1091 + def userinfo=(new_userinfo); end + + protected + + # Converts the string to be UTF-8 if it is not already UTF-8 + # + # @api private + # + # source://addressable//lib/addressable/uri.rb#2561 + def force_utf8_encoding_if_needed(str); end + + # Resets composite values for the entire URI + # + # @api private + # + # source://addressable//lib/addressable/uri.rb#2552 + def remove_composite_values; end + + # Replaces the internal state of self with the specified URI's state. + # Used in destructive operations to avoid massive code repetition. + # + # @param uri [Addressable::URI] The URI to replace self with. + # @return [Addressable::URI] self. + # + # source://addressable//lib/addressable/uri.rb#2519 + def replace_self(uri); end + + # Splits path string with "/" (slash). + # It is considered that there is empty string after last slash when + # path ends with slash. + # + # @param path [String] The path to split. + # @return [Array] An array of parts of path. + # + # source://addressable//lib/addressable/uri.rb#2542 + def split_path(path); end + + # Ensures that the URI is valid. + # + # source://addressable//lib/addressable/uri.rb#2476 + def validate; end + + private + + # Resets instance variables + # + # @api private + # + # source://addressable//lib/addressable/uri.rb#2573 + def reset_ivs; end + + class << self + # Converts a path to a file scheme URI. If the path supplied is + # relative, it will be returned as a relative URI. If the path supplied + # is actually a non-file URI, it will parse the URI as if it had been + # parsed with Addressable::URI.parse. Handles all of the + # various Microsoft-specific formats for specifying paths. + # + # @example + # base = Addressable::URI.convert_path("/absolute/path/") + # uri = Addressable::URI.convert_path("relative/path") + # (base + uri).to_s + # #=> "file:///absolute/path/relative/path" + # + # Addressable::URI.convert_path( + # "c:\\windows\\My Documents 100%20\\foo.txt" + # ).to_s + # #=> "file:///c:/windows/My%20Documents%20100%20/foo.txt" + # + # Addressable::URI.convert_path("http://example.com/").to_s + # #=> "http://example.com/" + # @param path [String, Addressable::URI, #to_str] Typically a String path to a file or directory, but + # will return a sensible return value if an absolute URI is supplied + # instead. + # @return [Addressable::URI] The parsed file scheme URI or the original URI if some other URI + # scheme was provided. + # + # source://addressable//lib/addressable/uri.rb#292 + def convert_path(path); end + + # Percent encodes any special characters in the URI. + # + # @param uri [String, Addressable::URI, #to_str] The URI to encode. + # @param return_type [Class] The type of object to return. + # This value may only be set to String or + # Addressable::URI. All other values are invalid. Defaults + # to String. + # @return [String, Addressable::URI] The encoded URI. + # The return type is determined by the return_type + # parameter. + # + # source://addressable//lib/addressable/uri.rb#616 + def encode(uri, return_type = T.unsafe(nil)); end + + # Percent encodes a URI component. + # + # '9' to be percent encoded. If a Regexp is passed, the + # value /[^b-zB-Z0-9]/ would have the same effect. A set of + # useful String values may be found in the + # Addressable::URI::CharacterClasses module. The default + # value is the reserved plus unreserved character classes specified in + # RFC 3986. + # + # @example + # Addressable::URI.encode_component("simple/example", "b-zB-Z0-9") + # => "simple%2Fex%61mple" + # Addressable::URI.encode_component("simple/example", /[^b-zB-Z0-9]/) + # => "simple%2Fex%61mple" + # Addressable::URI.encode_component( + # "simple/example", Addressable::URI::CharacterClasses::UNRESERVED + # ) + # => "simple%2Fexample" + # @param component [String, #to_str] The URI component to encode. + # @param character_class [String, Regexp] The characters which are not percent encoded. If a String + # is passed, the String must be formatted as a regular + # expression character class. (Do not include the surrounding square + # brackets.) For example, "b-zB-Z0-9" would cause + # everything but the letters 'b' through 'z' and the numbers '0' through + # @param upcase_encoded [Regexp] A string of characters that may already be percent encoded, and whose + # encodings should be upcased. This allows normalization of percent + # encodings for characters not included in the + # character_class. + # @return [String] The encoded component. + # + # source://addressable//lib/addressable/uri.rb#403 + def encode_component(component, character_class = T.unsafe(nil), upcase_encoded = T.unsafe(nil)); end + + # Percent encodes any special characters in the URI. + # + # @param uri [String, Addressable::URI, #to_str] The URI to encode. + # @param return_type [Class] The type of object to return. + # This value may only be set to String or + # Addressable::URI. All other values are invalid. Defaults + # to String. + # @return [String, Addressable::URI] The encoded URI. + # The return type is determined by the return_type + # parameter. + # + # source://addressable//lib/addressable/uri.rb#651 + def escape(uri, return_type = T.unsafe(nil)); end + + # Percent encodes a URI component. + # + # '9' to be percent encoded. If a Regexp is passed, the + # value /[^b-zB-Z0-9]/ would have the same effect. A set of + # useful String values may be found in the + # Addressable::URI::CharacterClasses module. The default + # value is the reserved plus unreserved character classes specified in + # RFC 3986. + # + # @example + # Addressable::URI.encode_component("simple/example", "b-zB-Z0-9") + # => "simple%2Fex%61mple" + # Addressable::URI.encode_component("simple/example", /[^b-zB-Z0-9]/) + # => "simple%2Fex%61mple" + # Addressable::URI.encode_component( + # "simple/example", Addressable::URI::CharacterClasses::UNRESERVED + # ) + # => "simple%2Fexample" + # @param component [String, #to_str] The URI component to encode. + # @param character_class [String, Regexp] The characters which are not percent encoded. If a String + # is passed, the String must be formatted as a regular + # expression character class. (Do not include the surrounding square + # brackets.) For example, "b-zB-Z0-9" would cause + # everything but the letters 'b' through 'z' and the numbers '0' through + # @param upcase_encoded [Regexp] A string of characters that may already be percent encoded, and whose + # encodings should be upcased. This allows normalization of percent + # encodings for characters not included in the + # character_class. + # @return [String] The encoded component. + # + # source://addressable//lib/addressable/uri.rb#446 + def escape_component(component, character_class = T.unsafe(nil), upcase_encoded = T.unsafe(nil)); end + + # Encodes a set of key/value pairs according to the rules for the + # application/x-www-form-urlencoded MIME type. + # + # @param form_values [#to_hash, #to_ary] The form values to encode. + # @param sort [TrueClass, FalseClass] Sort the key/value pairs prior to encoding. + # Defaults to false. + # @return [String] The encoded value. + # + # source://addressable//lib/addressable/uri.rb#740 + def form_encode(form_values, sort = T.unsafe(nil)); end + + # Decodes a String according to the rules for the + # application/x-www-form-urlencoded MIME type. + # + # @param encoded_value [String, #to_str] The form values to decode. + # @return [Array] The decoded values. + # This is not a Hash because of the possibility for + # duplicate keys. + # + # source://addressable//lib/addressable/uri.rb#793 + def form_unencode(encoded_value); end + + # Converts an input to a URI. The input does not have to be a valid + # URI — the method will use heuristics to guess what URI was intended. + # This is not standards-compliant, merely user-friendly. + # + # @param uri [String, Addressable::URI, #to_str] The URI string to parse. + # No parsing is performed if the object is already an + # Addressable::URI. + # @param hints [Hash] A Hash of hints to the heuristic parser. + # Defaults to {:scheme => "http"}. + # @return [Addressable::URI] The parsed URI. + # + # source://addressable//lib/addressable/uri.rb#191 + def heuristic_parse(uri, hints = T.unsafe(nil)); end + + # Returns an array of known ip-based schemes. These schemes typically + # use a similar URI form: + # //:@:/ + # + # source://addressable//lib/addressable/uri.rb#1369 + def ip_based_schemes; end + + # Joins several URIs together. + # + # @example + # base = "http://example.com/" + # uri = Addressable::URI.parse("relative/path") + # Addressable::URI.join(base, uri) + # #=> # + # @param *uris [String, Addressable::URI, #to_str] The URIs to join. + # @return [Addressable::URI] The joined URI. + # + # source://addressable//lib/addressable/uri.rb#343 + def join(*uris); end + + # Normalizes the encoding of a URI component. + # + # @example + # Addressable::URI.normalize_component("simpl%65/%65xampl%65", "b-zB-Z") + # => "simple%2Fex%61mple" + # Addressable::URI.normalize_component( + # "simpl%65/%65xampl%65", /[^b-zB-Z]/ + # ) + # => "simple%2Fex%61mple" + # Addressable::URI.normalize_component( + # "simpl%65/%65xampl%65", + # Addressable::URI::CharacterClasses::UNRESERVED + # ) + # => "simple%2Fexample" + # Addressable::URI.normalize_component( + # "one%20two%2fthree%26four", + # "0-9a-zA-Z &/", + # "/" + # ) + # => "one two%2Fthree&four" + # @param component [String, #to_str] The URI component to encode. + # @param character_class [String, Regexp] The characters which are not percent encoded. If a String + # is passed, the String must be formatted as a regular + # expression character class. (Do not include the surrounding square + # brackets.) For example, "b-zB-Z0-9" would cause + # everything but the letters 'b' through 'z' and the numbers '0' + # through '9' to be percent encoded. If a Regexp is passed, + # the value /[^b-zB-Z0-9]/ would have the same effect. A + # set of useful String values may be found in the + # Addressable::URI::CharacterClasses module. The default + # value is the reserved plus unreserved character classes specified in + # RFC 3986. + # @param leave_encoded [String] When character_class is a String then + # leave_encoded is a string of characters that should remain + # percent encoded while normalizing the component; if they appear percent + # encoded in the original component, then they will be upcased ("%2f" + # normalized to "%2F") but otherwise left alone. + # @return [String] The normalized component. + # + # source://addressable//lib/addressable/uri.rb#552 + def normalize_component(component, character_class = T.unsafe(nil), leave_encoded = T.unsafe(nil)); end + + # Resolves paths to their simplest form. + # + # @param path [String] The path to normalize. + # @return [String] The normalized path. + # + # source://addressable//lib/addressable/uri.rb#2440 + def normalize_path(path); end + + # Normalizes the encoding of a URI. Characters within a hostname are + # not percent encoded to allow for internationalized domain names. + # + # @param uri [String, Addressable::URI, #to_str] The URI to encode. + # @param return_type [Class] The type of object to return. + # This value may only be set to String or + # Addressable::URI. All other values are invalid. Defaults + # to String. + # @return [String, Addressable::URI] The encoded URI. + # The return type is determined by the return_type + # parameter. + # + # source://addressable//lib/addressable/uri.rb#671 + def normalized_encode(uri, return_type = T.unsafe(nil)); end + + # Returns a URI object based on the parsed string. + # + # @param uri [String, Addressable::URI, #to_str] The URI string to parse. + # No parsing is performed if the object is already an + # Addressable::URI. + # @return [Addressable::URI] The parsed URI. + # + # source://addressable//lib/addressable/uri.rb#114 + def parse(uri); end + + # Returns a hash of common IP-based schemes and their default port + # numbers. Adding new schemes to this hash, as necessary, will allow + # for better URI normalization. + # + # source://addressable//lib/addressable/uri.rb#1376 + def port_mapping; end + + # Unencodes any percent encoded characters within a URI component. + # This method may be used for unencoding either components or full URIs, + # however, it is recommended to use the unencode_component + # alias when unencoding components. + # + # @param uri [String, Addressable::URI, #to_str] The URI or component to unencode. + # @param return_type [Class] The type of object to return. + # This value may only be set to String or + # Addressable::URI. All other values are invalid. Defaults + # to String. + # @param leave_encoded [String] A string of characters to leave encoded. If a percent encoded character + # in this list is encountered then it will remain percent encoded. + # @return [String, Addressable::URI] The unencoded component or URI. + # The return type is determined by the return_type + # parameter. + # + # source://addressable//lib/addressable/uri.rb#472 + def unencode(uri, return_type = T.unsafe(nil), leave_encoded = T.unsafe(nil)); end + + # Unencodes any percent encoded characters within a URI component. + # This method may be used for unencoding either components or full URIs, + # however, it is recommended to use the unencode_component + # alias when unencoding components. + # + # @param uri [String, Addressable::URI, #to_str] The URI or component to unencode. + # @param return_type [Class] The type of object to return. + # This value may only be set to String or + # Addressable::URI. All other values are invalid. Defaults + # to String. + # @param leave_encoded [String] A string of characters to leave encoded. If a percent encoded character + # in this list is encountered then it will remain percent encoded. + # @return [String, Addressable::URI] The unencoded component or URI. + # The return type is determined by the return_type + # parameter. + # + # source://addressable//lib/addressable/uri.rb#502 + def unencode_component(uri, return_type = T.unsafe(nil), leave_encoded = T.unsafe(nil)); end + + # Unencodes any percent encoded characters within a URI component. + # This method may be used for unencoding either components or full URIs, + # however, it is recommended to use the unencode_component + # alias when unencoding components. + # + # @param uri [String, Addressable::URI, #to_str] The URI or component to unencode. + # @param return_type [Class] The type of object to return. + # This value may only be set to String or + # Addressable::URI. All other values are invalid. Defaults + # to String. + # @param leave_encoded [String] A string of characters to leave encoded. If a percent encoded character + # in this list is encountered then it will remain percent encoded. + # @return [String, Addressable::URI] The unencoded component or URI. + # The return type is determined by the return_type + # parameter. + # + # source://addressable//lib/addressable/uri.rb#501 + def unescape(uri, return_type = T.unsafe(nil), leave_encoded = T.unsafe(nil)); end + + # Unencodes any percent encoded characters within a URI component. + # This method may be used for unencoding either components or full URIs, + # however, it is recommended to use the unencode_component + # alias when unencoding components. + # + # @param uri [String, Addressable::URI, #to_str] The URI or component to unencode. + # @param return_type [Class] The type of object to return. + # This value may only be set to String or + # Addressable::URI. All other values are invalid. Defaults + # to String. + # @param leave_encoded [String] A string of characters to leave encoded. If a percent encoded character + # in this list is encountered then it will remain percent encoded. + # @return [String, Addressable::URI] The unencoded component or URI. + # The return type is determined by the return_type + # parameter. + # + # source://addressable//lib/addressable/uri.rb#503 + def unescape_component(uri, return_type = T.unsafe(nil), leave_encoded = T.unsafe(nil)); end + end +end + +# Container for the character classes specified in +# RFC 3986. +# +# Note: Concatenated and interpolated `String`s are not affected by the +# `frozen_string_literal` directive and must be frozen explicitly. +# +# Interpolated `String`s *were* frozen this way before Ruby 3.0: +# https://bugs.ruby-lang.org/issues/17104 +# +# source://addressable//lib/addressable/uri.rb#46 +module Addressable::URI::CharacterClasses; end + +# source://addressable//lib/addressable/uri.rb#47 +Addressable::URI::CharacterClasses::ALPHA = T.let(T.unsafe(nil), String) + +# source://addressable//lib/addressable/uri.rb#57 +Addressable::URI::CharacterClasses::AUTHORITY = T.let(T.unsafe(nil), String) + +# source://addressable//lib/addressable/uri.rb#48 +Addressable::URI::CharacterClasses::DIGIT = T.let(T.unsafe(nil), String) + +# source://addressable//lib/addressable/uri.rb#60 +Addressable::URI::CharacterClasses::FRAGMENT = T.let(T.unsafe(nil), String) + +# source://addressable//lib/addressable/uri.rb#49 +Addressable::URI::CharacterClasses::GEN_DELIMS = T.let(T.unsafe(nil), String) + +# source://addressable//lib/addressable/uri.rb#56 +Addressable::URI::CharacterClasses::HOST = T.let(T.unsafe(nil), String) + +# source://addressable//lib/addressable/uri.rb#58 +Addressable::URI::CharacterClasses::PATH = T.let(T.unsafe(nil), String) + +# source://addressable//lib/addressable/uri.rb#54 +Addressable::URI::CharacterClasses::PCHAR = T.let(T.unsafe(nil), String) + +# source://addressable//lib/addressable/uri.rb#59 +Addressable::URI::CharacterClasses::QUERY = T.let(T.unsafe(nil), String) + +# source://addressable//lib/addressable/uri.rb#51 +Addressable::URI::CharacterClasses::RESERVED = T.let(T.unsafe(nil), String) + +# source://addressable//lib/addressable/uri.rb#53 +Addressable::URI::CharacterClasses::RESERVED_AND_UNRESERVED = T.let(T.unsafe(nil), String) + +# source://addressable//lib/addressable/uri.rb#55 +Addressable::URI::CharacterClasses::SCHEME = T.let(T.unsafe(nil), String) + +# source://addressable//lib/addressable/uri.rb#50 +Addressable::URI::CharacterClasses::SUB_DELIMS = T.let(T.unsafe(nil), String) + +# source://addressable//lib/addressable/uri.rb#52 +Addressable::URI::CharacterClasses::UNRESERVED = T.let(T.unsafe(nil), String) + +# source://addressable//lib/addressable/uri.rb#72 +module Addressable::URI::CharacterClassesRegexps; end + +# source://addressable//lib/addressable/uri.rb#73 +Addressable::URI::CharacterClassesRegexps::AUTHORITY = T.let(T.unsafe(nil), Regexp) + +# source://addressable//lib/addressable/uri.rb#74 +Addressable::URI::CharacterClassesRegexps::FRAGMENT = T.let(T.unsafe(nil), Regexp) + +# source://addressable//lib/addressable/uri.rb#75 +Addressable::URI::CharacterClassesRegexps::HOST = T.let(T.unsafe(nil), Regexp) + +# source://addressable//lib/addressable/uri.rb#76 +Addressable::URI::CharacterClassesRegexps::PATH = T.let(T.unsafe(nil), Regexp) + +# source://addressable//lib/addressable/uri.rb#77 +Addressable::URI::CharacterClassesRegexps::QUERY = T.let(T.unsafe(nil), Regexp) + +# source://addressable//lib/addressable/uri.rb#78 +Addressable::URI::CharacterClassesRegexps::RESERVED = T.let(T.unsafe(nil), Regexp) + +# source://addressable//lib/addressable/uri.rb#79 +Addressable::URI::CharacterClassesRegexps::RESERVED_AND_UNRESERVED = T.let(T.unsafe(nil), Regexp) + +# source://addressable//lib/addressable/uri.rb#80 +Addressable::URI::CharacterClassesRegexps::SCHEME = T.let(T.unsafe(nil), Regexp) + +# source://addressable//lib/addressable/uri.rb#81 +Addressable::URI::CharacterClassesRegexps::UNRESERVED = T.let(T.unsafe(nil), Regexp) + +# source://addressable//lib/addressable/uri.rb#85 +Addressable::URI::EMPTY_STR = T.let(T.unsafe(nil), String) + +# Raised if something other than a uri is supplied. +# +# source://addressable//lib/addressable/uri.rb#34 +class Addressable::URI::InvalidURIError < ::StandardError; end + +# source://addressable//lib/addressable/uri.rb#2598 +module Addressable::URI::NONE; end + +# source://addressable//lib/addressable/uri.rb#1530 +Addressable::URI::NORMPATH = T.let(T.unsafe(nil), Regexp) + +# source://addressable//lib/addressable/uri.rb#63 +module Addressable::URI::NormalizeCharacterClasses; end + +# source://addressable//lib/addressable/uri.rb#68 +Addressable::URI::NormalizeCharacterClasses::FRAGMENT = T.let(T.unsafe(nil), Regexp) + +# source://addressable//lib/addressable/uri.rb#64 +Addressable::URI::NormalizeCharacterClasses::HOST = T.let(T.unsafe(nil), Regexp) + +# source://addressable//lib/addressable/uri.rb#66 +Addressable::URI::NormalizeCharacterClasses::PCHAR = T.let(T.unsafe(nil), Regexp) + +# source://addressable//lib/addressable/uri.rb#69 +Addressable::URI::NormalizeCharacterClasses::QUERY = T.let(T.unsafe(nil), Regexp) + +# source://addressable//lib/addressable/uri.rb#67 +Addressable::URI::NormalizeCharacterClasses::SCHEME = T.let(T.unsafe(nil), Regexp) + +# source://addressable//lib/addressable/uri.rb#65 +Addressable::URI::NormalizeCharacterClasses::UNRESERVED = T.let(T.unsafe(nil), Regexp) + +# source://addressable//lib/addressable/uri.rb#2427 +Addressable::URI::PARENT = T.let(T.unsafe(nil), String) + +# source://addressable//lib/addressable/uri.rb#89 +Addressable::URI::PORT_MAPPING = T.let(T.unsafe(nil), Hash) + +# source://addressable//lib/addressable/uri.rb#2429 +Addressable::URI::RULE_2A = T.let(T.unsafe(nil), Regexp) + +# source://addressable//lib/addressable/uri.rb#2430 +Addressable::URI::RULE_2B_2C = T.let(T.unsafe(nil), Regexp) + +# source://addressable//lib/addressable/uri.rb#2431 +Addressable::URI::RULE_2D = T.let(T.unsafe(nil), Regexp) + +# source://addressable//lib/addressable/uri.rb#2432 +Addressable::URI::RULE_PREFIXED_PARENT = T.let(T.unsafe(nil), Regexp) + +# source://addressable//lib/addressable/uri.rb#2426 +Addressable::URI::SELF_REF = T.let(T.unsafe(nil), String) + +# Tables used to optimize encoding operations in `self.encode_component` +# and `self.normalize_component` +# +# source://addressable//lib/addressable/uri.rb#360 +Addressable::URI::SEQUENCE_ENCODING_TABLE = T.let(T.unsafe(nil), Array) + +# source://addressable//lib/addressable/uri.rb#364 +Addressable::URI::SEQUENCE_UPCASED_PERCENT_ENCODING_TABLE = T.let(T.unsafe(nil), Array) + +# source://addressable//lib/addressable/uri.rb#84 +Addressable::URI::SLASH = T.let(T.unsafe(nil), String) + +# source://addressable//lib/addressable/uri.rb#87 +Addressable::URI::URIREGEX = T.let(T.unsafe(nil), Regexp) + +# source://addressable//lib/addressable/version.rb#23 +module Addressable::VERSION; end + +# source://addressable//lib/addressable/version.rb#24 +Addressable::VERSION::MAJOR = T.let(T.unsafe(nil), Integer) + +# source://addressable//lib/addressable/version.rb#25 +Addressable::VERSION::MINOR = T.let(T.unsafe(nil), Integer) + +# source://addressable//lib/addressable/version.rb#28 +Addressable::VERSION::STRING = T.let(T.unsafe(nil), String) + +# source://addressable//lib/addressable/version.rb#26 +Addressable::VERSION::TINY = T.let(T.unsafe(nil), Integer) diff --git a/sorbet/rbi/gems/ast@2.4.3.rbi b/sorbet/rbi/gems/ast@2.4.3.rbi new file mode 100644 index 00000000000..ffa2080ab28 --- /dev/null +++ b/sorbet/rbi/gems/ast@2.4.3.rbi @@ -0,0 +1,586 @@ +# typed: true + +# DO NOT EDIT MANUALLY +# This is an autogenerated file for types exported from the `ast` gem. +# Please instead update this file by running `bin/tapioca gem ast`. + + +# {AST} is a library for manipulating abstract syntax trees. +# +# It embraces immutability; each AST node is inherently frozen at +# creation, and updating a child node requires recreating that node +# and its every parent, recursively. +# This is a design choice. It does create some pressure on +# garbage collector, but completely eliminates all concurrency +# and aliasing problems. +# +# See also {AST::Node}, {AST::Processor::Mixin} and {AST::Sexp} for +# additional recommendations and design patterns. +# +# source://ast//lib/ast.rb#13 +module AST; end + +# Node is an immutable class, instances of which represent abstract +# syntax tree nodes. It combines semantic information (i.e. anything +# that affects the algorithmic properties of a program) with +# meta-information (line numbers or compiler intermediates). +# +# Notes on inheritance +# ==================== +# +# The distinction between semantics and metadata is important. Complete +# semantic information should be contained within just the {#type} and +# {#children} of a Node instance; in other words, if an AST was to be +# stripped of all meta-information, it should remain a valid AST which +# could be successfully processed to yield a result with the same +# algorithmic properties. +# +# Thus, Node should never be inherited in order to define methods which +# affect or return semantic information, such as getters for `class_name`, +# `superclass` and `body` in the case of a hypothetical `ClassNode`. The +# correct solution is to use a generic Node with a {#type} of `:class` +# and three children. See also {Processor} for tips on working with such +# ASTs. +# +# On the other hand, Node can and should be inherited to define +# application-specific metadata (see also {#initialize}) or customize the +# printing format. It is expected that an application would have one or two +# such classes and use them across the entire codebase. +# +# The rationale for this pattern is extensibility and maintainability. +# Unlike static ones, dynamic languages do not require the presence of a +# predefined, rigid structure, nor does it improve dispatch efficiency, +# and while such a structure can certainly be defined, it does not add +# any value but incurs a maintaining cost. +# For example, extending the AST even with a transformation-local +# temporary node type requires making globally visible changes to +# the codebase. +# +# source://ast//lib/ast/node.rb#40 +class AST::Node + # Constructs a new instance of Node. + # + # The arguments `type` and `children` are converted with `to_sym` and + # `to_a` respectively. Additionally, the result of converting `children` + # is frozen. While mutating the arguments is generally considered harmful, + # the most common case is to pass an array literal to the constructor. If + # your code does not expect the argument to be frozen, use `#dup`. + # + # The `properties` hash is passed to {#assign_properties}. + # + # @return [Node] a new instance of Node + # + # source://ast//lib/ast/node.rb#72 + def initialize(type, children = T.unsafe(nil), properties = T.unsafe(nil)); end + + # Concatenates `array` with `children` and returns the resulting node. + # + # @return [AST::Node] + # + # source://ast//lib/ast/node.rb#172 + def +(array); end + + # Appends `element` to `children` and returns the resulting node. + # + # @return [AST::Node] + # + # source://ast//lib/ast/node.rb#181 + def <<(element); end + + # Compares `self` to `other`, possibly converting with `to_ast`. Only + # `type` and `children` are compared; metadata is deliberately ignored. + # + # @return [Boolean] + # + # source://ast//lib/ast/node.rb#153 + def ==(other); end + + # Appends `element` to `children` and returns the resulting node. + # + # @return [AST::Node] + # + # source://ast//lib/ast/node.rb#177 + def append(element); end + + # Returns the children of this node. + # The returned value is frozen. + # The to_a alias is useful for decomposing nodes concisely. + # For example: + # + # node = s(:gasgn, :$foo, s(:integer, 1)) + # var_name, value = *node + # p var_name # => :$foo + # p value # => (integer 1) + # + # @return [Array] + # + # source://ast//lib/ast/node.rb#56 + def children; end + + # Nodes are already frozen, so there is no harm in returning the + # current node as opposed to initializing from scratch and freezing + # another one. + # + # @return self + # + # source://ast//lib/ast/node.rb#118 + def clone; end + + # Concatenates `array` with `children` and returns the resulting node. + # + # @return [AST::Node] + # + # source://ast//lib/ast/node.rb#168 + def concat(array); end + + # Enables matching for Node, where type is the first element + # and the children are remaining items. + # + # @return [Array] + # + # source://ast//lib/ast/node.rb#253 + def deconstruct; end + + # Nodes are already frozen, so there is no harm in returning the + # current node as opposed to initializing from scratch and freezing + # another one. + # + # @return self + # + # source://ast//lib/ast/node.rb#115 + def dup; end + + # Test if other object is equal to + # + # @param other [Object] + # @return [Boolean] + # + # source://ast//lib/ast/node.rb#85 + def eql?(other); end + + # Returns the precomputed hash value for this node + # + # @return [Integer] + # + # source://ast//lib/ast/node.rb#61 + def hash; end + + # Converts `self` to a s-expression ruby string. + # The code return will recreate the node, using the sexp module s() + # + # @param indent [Integer] Base indentation level. + # @return [String] + # + # source://ast//lib/ast/node.rb#211 + def inspect(indent = T.unsafe(nil)); end + + # Returns the children of this node. + # The returned value is frozen. + # The to_a alias is useful for decomposing nodes concisely. + # For example: + # + # node = s(:gasgn, :$foo, s(:integer, 1)) + # var_name, value = *node + # p var_name # => :$foo + # p value # => (integer 1) + # + # @return [Array] + # + # source://ast//lib/ast/node.rb#57 + def to_a; end + + # @return [AST::Node] self + # + # source://ast//lib/ast/node.rb#229 + def to_ast; end + + # Converts `self` to a pretty-printed s-expression. + # + # @param indent [Integer] Base indentation level. + # @return [String] + # + # source://ast//lib/ast/node.rb#204 + def to_s(indent = T.unsafe(nil)); end + + # Converts `self` to a pretty-printed s-expression. + # + # @param indent [Integer] Base indentation level. + # @return [String] + # + # source://ast//lib/ast/node.rb#187 + def to_sexp(indent = T.unsafe(nil)); end + + # Converts `self` to an Array where the first element is the type as a Symbol, + # and subsequent elements are the same representation of its children. + # + # @return [Array] + # + # source://ast//lib/ast/node.rb#237 + def to_sexp_array; end + + # Returns the type of this node. + # + # @return [Symbol] + # + # source://ast//lib/ast/node.rb#43 + def type; end + + # Returns a new instance of Node where non-nil arguments replace the + # corresponding fields of `self`. + # + # For example, `Node.new(:foo, [ 1, 2 ]).updated(:bar)` would yield + # `(bar 1 2)`, and `Node.new(:foo, [ 1, 2 ]).updated(nil, [])` would + # yield `(foo)`. + # + # If the resulting node would be identical to `self`, does nothing. + # + # @param type [Symbol, nil] + # @param children [Array, nil] + # @param properties [Hash, nil] + # @return [AST::Node] + # + # source://ast//lib/ast/node.rb#133 + def updated(type = T.unsafe(nil), children = T.unsafe(nil), properties = T.unsafe(nil)); end + + protected + + # By default, each entry in the `properties` hash is assigned to + # an instance variable in this instance of Node. A subclass should define + # attribute readers for such variables. The values passed in the hash + # are not frozen or whitelisted; such behavior can also be implemented + # by subclassing Node and overriding this method. + # + # @return [nil] + # + # source://ast//lib/ast/node.rb#98 + def assign_properties(properties); end + + # Returns `@type` with all underscores replaced by dashes. This allows + # to write symbol literals without quotes in Ruby sources and yet have + # nicely looking s-expressions. + # + # @return [String] + # + # source://ast//lib/ast/node.rb#264 + def fancy_type; end + + private + + # source://ast//lib/ast/node.rb#107 + def original_dup; end +end + +# This class includes {AST::Processor::Mixin}; however, it is +# deprecated, since the module defines all of the behaviors that +# the processor includes. Any new libraries should use +# {AST::Processor::Mixin} instead of subclassing this. +# +# @deprecated Use {AST::Processor::Mixin} instead. +# +# source://ast//lib/ast/processor.rb#8 +class AST::Processor + include ::AST::Processor::Mixin +end + +# The processor module is a module which helps transforming one +# AST into another. In a nutshell, the {#process} method accepts +# a {Node} and dispatches it to a handler corresponding to its +# type, and returns a (possibly) updated variant of the node. +# +# The processor module has a set of associated design patterns. +# They are best explained with a concrete example. Let's define a +# simple arithmetic language and an AST format for it: +# +# Terminals (AST nodes which do not have other AST nodes inside): +# +# * `(integer )`, +# +# Nonterminals (AST nodes with other nodes as children): +# +# * `(add )`, +# * `(multiply )`, +# * `(divide )`, +# * `(negate )`, +# * `(store )`: stores value of `` +# into a variable named ``, +# * `(load )`: loads value of a variable named +# ``, +# * `(each ...)`: computes each of the ``s and +# prints the result. +# +# All AST nodes have the same Ruby class, and therefore they don't +# know how to traverse themselves. (A solution which dynamically +# checks the type of children is possible, but is slow and +# error-prone.) So, a class including the module which knows how +# to traverse the entire tree should be defined. Such classes +# have a handler for each nonterminal node which recursively +# processes children nodes: +# +# require 'ast' +# +# class ArithmeticsProcessor +# include AST::Processor::Mixin +# # This method traverses any binary operators such as (add) +# # or (multiply). +# def process_binary_op(node) +# # Children aren't decomposed automatically; it is +# # suggested to use Ruby multiple assignment expansion, +# # as it is very convenient here. +# left_expr, right_expr = *node +# +# # AST::Node#updated won't change node type if nil is +# # passed as a first argument, which allows to reuse the +# # same handler for multiple node types using `alias' +# # (below). +# node.updated(nil, [ +# process(left_expr), +# process(right_expr) +# ]) +# end +# alias_method :on_add, :process_binary_op +# alias_method :on_multiply, :process_binary_op +# alias_method :on_divide, :process_binary_op +# +# def on_negate(node) +# # It is also possible to use #process_all for more +# # compact code if every child is a Node. +# node.updated(nil, process_all(node)) +# end +# +# def on_store(node) +# expr, variable_name = *node +# +# # Note that variable_name is not a Node and thus isn't +# # passed to #process. +# node.updated(nil, [ +# process(expr), +# variable_name +# ]) +# end +# +# # (load) is effectively a terminal node, and so it does +# # not need an explicit handler, as the following is the +# # default behavior. Essentially, for any nodes that don't +# # have a defined handler, the node remains unchanged. +# def on_load(node) +# nil +# end +# +# def on_each(node) +# node.updated(nil, process_all(node)) +# end +# end +# +# Let's test our ArithmeticsProcessor: +# +# include AST::Sexp +# expr = s(:add, s(:integer, 2), s(:integer, 2)) +# +# p ArithmeticsProcessor.new.process(expr) == expr # => true +# +# As expected, it does not change anything at all. This isn't +# actually very useful, so let's now define a Calculator, which +# will compute the expression values: +# +# # This Processor folds nonterminal nodes and returns an +# # (integer) terminal node. +# class ArithmeticsCalculator < ArithmeticsProcessor +# def compute_op(node) +# # First, node children are processed and then unpacked +# # to local variables. +# nodes = process_all(node) +# +# if nodes.all? { |node| node.type == :integer } +# # If each of those nodes represents a literal, we can +# # fold this node! +# values = nodes.map { |node| node.children.first } +# AST::Node.new(:integer, [ +# yield(values) +# ]) +# else +# # Otherwise, we can just leave the current node in the +# # tree and only update it with processed children +# # nodes, which can be partially folded. +# node.updated(nil, nodes) +# end +# end +# +# def on_add(node) +# compute_op(node) { |left, right| left + right } +# end +# +# def on_multiply(node) +# compute_op(node) { |left, right| left * right } +# end +# end +# +# Let's check: +# +# p ArithmeticsCalculator.new.process(expr) # => (integer 4) +# +# Excellent, the calculator works! Now, a careful reader could +# notice that the ArithmeticsCalculator does not know how to +# divide numbers. What if we pass an expression with division to +# it? +# +# expr_with_division = \ +# s(:add, +# s(:integer, 1), +# s(:divide, +# s(:add, s(:integer, 8), s(:integer, 4)), +# s(:integer, 3))) # 1 + (8 + 4) / 3 +# +# folded_expr_with_division = ArithmeticsCalculator.new.process(expr_with_division) +# p folded_expr_with_division +# # => (add +# # (integer 1) +# # (divide +# # (integer 12) +# # (integer 3))) +# +# As you can see, the expression was folded _partially_: the inner +# `(add)` node which could be computed was folded to +# `(integer 12)`, the `(divide)` node is left as-is because there +# is no computing handler for it, and the root `(add)` node was +# also left as it is because some of its children were not +# literals. +# +# Note that this partial folding is only possible because the +# _data_ format, i.e. the format in which the computed values of +# the nodes are represented, is the same as the AST itself. +# +# Let's extend our ArithmeticsCalculator class further. +# +# class ArithmeticsCalculator +# def on_divide(node) +# compute_op(node) { |left, right| left / right } +# end +# +# def on_negate(node) +# # Note how #compute_op works regardless of the operator +# # arity. +# compute_op(node) { |value| -value } +# end +# end +# +# Now, let's apply our renewed ArithmeticsCalculator to a partial +# result of previous evaluation: +# +# p ArithmeticsCalculator.new.process(expr_with_division) # => (integer 5) +# +# Five! Excellent. This is also pretty much how CRuby 1.8 executed +# its programs. +# +# Now, let's do some automated bug searching. Division by zero is +# an error, right? So if we could detect that someone has divided +# by zero before the program is even run, that could save some +# debugging time. +# +# class DivisionByZeroVerifier < ArithmeticsProcessor +# class VerificationFailure < Exception; end +# +# def on_divide(node) +# # You need to process the children to handle nested divisions +# # such as: +# # (divide +# # (integer 1) +# # (divide (integer 1) (integer 0)) +# left, right = process_all(node) +# +# if right.type == :integer && +# right.children.first == 0 +# raise VerificationFailure, "Ouch! This code divides by zero." +# end +# end +# +# def divides_by_zero?(ast) +# process(ast) +# false +# rescue VerificationFailure +# true +# end +# end +# +# nice_expr = \ +# s(:divide, +# s(:add, s(:integer, 10), s(:integer, 2)), +# s(:integer, 4)) +# +# p DivisionByZeroVerifier.new.divides_by_zero?(nice_expr) +# # => false. Good. +# +# bad_expr = \ +# s(:add, s(:integer, 10), +# s(:divide, s(:integer, 1), s(:integer, 0))) +# +# p DivisionByZeroVerifier.new.divides_by_zero?(bad_expr) +# # => true. WHOOPS. DO NOT RUN THIS. +# +# Of course, this won't detect more complex cases... unless you +# use some partial evaluation before! The possibilites are +# endless. Have fun. +# +# source://ast//lib/ast/processor/mixin.rb#240 +module AST::Processor::Mixin + # Default handler. Does nothing. + # + # @param node [AST::Node] + # @return [AST::Node, nil] + # + # source://ast//lib/ast/processor/mixin.rb#284 + def handler_missing(node); end + + # Dispatches `node`. If a node has type `:foo`, then a handler + # named `on_foo` is invoked with one argument, the `node`; if + # there isn't such a handler, {#handler_missing} is invoked + # with the same argument. + # + # If the handler returns `nil`, `node` is returned; otherwise, + # the return value of the handler is passed along. + # + # @param node [AST::Node, nil] + # @return [AST::Node, nil] + # + # source://ast//lib/ast/processor/mixin.rb#251 + def process(node); end + + # {#process}es each node from `nodes` and returns an array of + # results. + # + # @param nodes [Array] + # @return [Array] + # + # source://ast//lib/ast/processor/mixin.rb#274 + def process_all(nodes); end +end + +# This simple module is very useful in the cases where one needs +# to define deeply nested ASTs from Ruby code, for example, in +# tests. It should be used like this: +# +# describe YourLanguage do +# include ::AST::Sexp +# +# it "should correctly parse expressions" do +# YourLanguage.parse("1 + 2 * 3").should == +# s(:add, +# s(:integer, 1), +# s(:multiply, +# s(:integer, 2), +# s(:integer, 3))) +# end +# end +# +# This way the amount of boilerplate code is greatly reduced. +# +# source://ast//lib/ast/sexp.rb#20 +module AST::Sexp + # Creates a {Node} with type `type` and children `children`. + # Note that the resulting node is of the type AST::Node and not a + # subclass. + # This would not pose a problem with comparisons, as {Node#==} + # ignores metadata. + # + # source://ast//lib/ast/sexp.rb#26 + def s(type, *children); end +end diff --git a/sorbet/rbi/gems/benchmark@0.4.1.rbi b/sorbet/rbi/gems/benchmark@0.5.0.rbi similarity index 90% rename from sorbet/rbi/gems/benchmark@0.4.1.rbi rename to sorbet/rbi/gems/benchmark@0.5.0.rbi index e29780e7edf..8531eefe035 100644 --- a/sorbet/rbi/gems/benchmark@0.4.1.rbi +++ b/sorbet/rbi/gems/benchmark@0.5.0.rbi @@ -239,6 +239,15 @@ module Benchmark # source://benchmark//lib/benchmark.rb#303 def measure(label = T.unsafe(nil)); end + # Returns the elapsed real time used to execute the given block. + # The unit of time is milliseconds. + # + # Benchmark.ms { "a" * 1_000_000_000 } + # #=> 509.8029999935534 + # + # source://benchmark//lib/benchmark.rb#335 + def ms; end + # Returns the elapsed real time used to execute the given block. # The unit of time is seconds. # @@ -290,7 +299,7 @@ module Benchmark # >total: 2.930000 0.000000 2.930000 ( 2.932889) # >avg: 0.976667 0.000000 0.976667 ( 0.977630) # - # source://benchmark//lib/benchmark.rb#328 + # source://benchmark//lib/benchmark.rb#341 def benchmark(caption = T.unsafe(nil), label_width = T.unsafe(nil), format = T.unsafe(nil), *labels); end # A simple interface to the #benchmark method, #bm generates sequential @@ -313,7 +322,7 @@ module Benchmark # times: 0.960000 0.000000 0.960000 ( 0.960423) # upto: 0.950000 0.000000 0.950000 ( 0.954864) # - # source://benchmark//lib/benchmark.rb#328 + # source://benchmark//lib/benchmark.rb#341 def bm(label_width = T.unsafe(nil), *labels, &blk); end # Sometimes benchmark results are skewed because code executed @@ -353,7 +362,7 @@ module Benchmark # #bmbm yields a Benchmark::Job object and returns an array of # Benchmark::Tms objects. # - # source://benchmark//lib/benchmark.rb#328 + # source://benchmark//lib/benchmark.rb#341 def bmbm(width = T.unsafe(nil)); end # Returns the time used to execute the given block as a @@ -372,16 +381,25 @@ module Benchmark # # 0.220000 0.000000 0.220000 ( 0.227313) # - # source://benchmark//lib/benchmark.rb#328 + # source://benchmark//lib/benchmark.rb#341 def measure(label = T.unsafe(nil)); end + # Returns the elapsed real time used to execute the given block. + # The unit of time is milliseconds. + # + # Benchmark.ms { "a" * 1_000_000_000 } + # #=> 509.8029999935534 + # + # source://benchmark//lib/benchmark.rb#341 + def ms; end + # Returns the elapsed real time used to execute the given block. # The unit of time is seconds. # # Benchmark.realtime { "a" * 1_000_000_000 } # #=> 0.5098029999935534 # - # source://benchmark//lib/benchmark.rb#328 + # source://benchmark//lib/benchmark.rb#341 def realtime; end end end @@ -389,7 +407,7 @@ end # A Job is a sequence of labelled blocks to be processed by the # Benchmark.bmbm method. It is of little direct interest to the user. # -# source://benchmark//lib/benchmark.rb#334 +# source://benchmark//lib/benchmark.rb#347 class Benchmark::Job # Returns an initialized Job instance. # Usually, one doesn't call this method directly, as new @@ -399,38 +417,38 @@ class Benchmark::Job # # @return [Job] a new instance of Job # - # source://benchmark//lib/benchmark.rb#342 + # source://benchmark//lib/benchmark.rb#355 def initialize(width); end # Registers the given label and block pair in the job list. # # @raise [ArgumentError] # - # source://benchmark//lib/benchmark.rb#350 + # source://benchmark//lib/benchmark.rb#363 def item(label = T.unsafe(nil), &blk); end # An array of 2-element arrays, consisting of label and block pairs. # - # source://benchmark//lib/benchmark.rb#362 + # source://benchmark//lib/benchmark.rb#375 def list; end # Registers the given label and block pair in the job list. # # @raise [ArgumentError] # - # source://benchmark//lib/benchmark.rb#359 + # source://benchmark//lib/benchmark.rb#372 def report(label = T.unsafe(nil), &blk); end # Length of the widest label in the #list. # - # source://benchmark//lib/benchmark.rb#365 + # source://benchmark//lib/benchmark.rb#378 def width; end end # This class is used by the Benchmark.benchmark and Benchmark.bm methods. # It is of little direct interest to the user. # -# source://benchmark//lib/benchmark.rb#372 +# source://benchmark//lib/benchmark.rb#385 class Benchmark::Report # Returns an initialized Report instance. # Usually, one doesn't call this method directly, as new @@ -440,43 +458,43 @@ class Benchmark::Report # # @return [Report] a new instance of Report # - # source://benchmark//lib/benchmark.rb#380 + # source://benchmark//lib/benchmark.rb#393 def initialize(width = T.unsafe(nil), format = T.unsafe(nil)); end # An array of Benchmark::Tms objects representing each item. # - # source://benchmark//lib/benchmark.rb#399 + # source://benchmark//lib/benchmark.rb#412 def format; end # Prints the +label+ and measured time for the block, # formatted by +format+. See Tms#format for the # formatting rules. # - # source://benchmark//lib/benchmark.rb#389 + # source://benchmark//lib/benchmark.rb#402 def item(label = T.unsafe(nil), *format, &blk); end # An array of Benchmark::Tms objects representing each item. # - # source://benchmark//lib/benchmark.rb#399 + # source://benchmark//lib/benchmark.rb#412 def list; end # Prints the +label+ and measured time for the block, # formatted by +format+. See Tms#format for the # formatting rules. # - # source://benchmark//lib/benchmark.rb#396 + # source://benchmark//lib/benchmark.rb#409 def report(label = T.unsafe(nil), *format, &blk); end # An array of Benchmark::Tms objects representing each item. # - # source://benchmark//lib/benchmark.rb#399 + # source://benchmark//lib/benchmark.rb#412 def width; end end # A data object, representing the times associated with a benchmark # measurement. # -# source://benchmark//lib/benchmark.rb#408 +# source://benchmark//lib/benchmark.rb#421 class Benchmark::Tms # Returns an initialized Tms object which has # +utime+ as the user CPU time, +stime+ as the system CPU time, @@ -485,13 +503,13 @@ class Benchmark::Tms # # @return [Tms] a new instance of Tms # - # source://benchmark//lib/benchmark.rb#443 + # source://benchmark//lib/benchmark.rb#456 def initialize(utime = T.unsafe(nil), stime = T.unsafe(nil), cutime = T.unsafe(nil), cstime = T.unsafe(nil), real = T.unsafe(nil), label = T.unsafe(nil)); end # Returns a new Tms object obtained by memberwise multiplication # of the individual times for this Tms object by +x+. # - # source://benchmark//lib/benchmark.rb#491 + # source://benchmark//lib/benchmark.rb#504 def *(x); end # Returns a new Tms object obtained by memberwise summation @@ -499,27 +517,27 @@ class Benchmark::Tms # Tms object. # This method and #/() are useful for taking statistics. # - # source://benchmark//lib/benchmark.rb#478 + # source://benchmark//lib/benchmark.rb#491 def +(other); end # Returns a new Tms object obtained by memberwise subtraction # of the individual times for the +other+ Tms object from those of this # Tms object. # - # source://benchmark//lib/benchmark.rb#485 + # source://benchmark//lib/benchmark.rb#498 def -(other); end # Returns a new Tms object obtained by memberwise division # of the individual times for this Tms object by +x+. # This method and #+() are useful for taking statistics. # - # source://benchmark//lib/benchmark.rb#498 + # source://benchmark//lib/benchmark.rb#511 def /(x); end # Returns a new Tms object whose times are the sum of the times for this # Tms object, plus the time required to execute the code block (+blk+). # - # source://benchmark//lib/benchmark.rb#452 + # source://benchmark//lib/benchmark.rb#465 def add(&blk); end # An in-place version of #add. @@ -527,17 +545,17 @@ class Benchmark::Tms # for this Tms object, plus the time required to execute # the code block (+blk+). # - # source://benchmark//lib/benchmark.rb#462 + # source://benchmark//lib/benchmark.rb#475 def add!(&blk); end # System CPU time of children # - # source://benchmark//lib/benchmark.rb#426 + # source://benchmark//lib/benchmark.rb#439 def cstime; end # User CPU time of children # - # source://benchmark//lib/benchmark.rb#423 + # source://benchmark//lib/benchmark.rb#436 def cutime; end # Returns the contents of this Tms object as @@ -556,22 +574,22 @@ class Benchmark::Tms # If +format+ is not given, FORMAT is used as default value, detailing the # user, system, total and real elapsed time. # - # source://benchmark//lib/benchmark.rb#517 + # source://benchmark//lib/benchmark.rb#530 def format(format = T.unsafe(nil), *args); end # Label # - # source://benchmark//lib/benchmark.rb#435 + # source://benchmark//lib/benchmark.rb#448 def label; end # Elapsed real time # - # source://benchmark//lib/benchmark.rb#429 + # source://benchmark//lib/benchmark.rb#442 def real; end # System CPU time # - # source://benchmark//lib/benchmark.rb#420 + # source://benchmark//lib/benchmark.rb#433 def stime; end # Returns a new 6-element array, consisting of the @@ -579,27 +597,27 @@ class Benchmark::Tms # user CPU time, children's system CPU time and elapsed # real time. # - # source://benchmark//lib/benchmark.rb#542 + # source://benchmark//lib/benchmark.rb#555 def to_a; end # Returns a hash containing the same data as `to_a`. # - # source://benchmark//lib/benchmark.rb#549 + # source://benchmark//lib/benchmark.rb#562 def to_h; end # Same as #format. # - # source://benchmark//lib/benchmark.rb#532 + # source://benchmark//lib/benchmark.rb#545 def to_s; end # Total time, that is +utime+ + +stime+ + +cutime+ + +cstime+ # - # source://benchmark//lib/benchmark.rb#432 + # source://benchmark//lib/benchmark.rb#445 def total; end # User CPU time # - # source://benchmark//lib/benchmark.rb#417 + # source://benchmark//lib/benchmark.rb#430 def utime; end protected @@ -611,7 +629,7 @@ class Benchmark::Tms # +op+ can be a mathematical operation such as +, -, # *, / # - # source://benchmark//lib/benchmark.rb#570 + # source://benchmark//lib/benchmark.rb#583 def memberwise(op, x); end end diff --git a/sorbet/rbi/gems/bigdecimal@4.0.1.rbi b/sorbet/rbi/gems/bigdecimal@4.0.1.rbi new file mode 100644 index 00000000000..bbfef02cfa3 --- /dev/null +++ b/sorbet/rbi/gems/bigdecimal@4.0.1.rbi @@ -0,0 +1,332 @@ +# typed: false + +# DO NOT EDIT MANUALLY +# This is an autogenerated file for types exported from the `bigdecimal` gem. +# Please instead update this file by running `bin/tapioca gem bigdecimal`. + + +# source://bigdecimal//lib/bigdecimal.rb#13 +class BigDecimal < ::Numeric + # source://bigdecimal//lib/bigdecimal.rb#10 + def %(_arg0); end + + # source://bigdecimal//lib/bigdecimal.rb#10 + def *(_arg0); end + + # call-seq: + # self ** other -> bigdecimal + # + # Returns the \BigDecimal value of +self+ raised to power +other+: + # + # b = BigDecimal('3.14') + # b ** 2 # => 0.98596e1 + # b ** 2.0 # => 0.98596e1 + # b ** Rational(2, 1) # => 0.98596e1 + # + # Related: BigDecimal#power. + # + # source://bigdecimal//lib/bigdecimal.rb#77 + def **(y); end + + # source://bigdecimal//lib/bigdecimal.rb#10 + def +(_arg0); end + + # source://bigdecimal//lib/bigdecimal.rb#10 + def +@; end + + # source://bigdecimal//lib/bigdecimal.rb#10 + def -(_arg0); end + + # source://bigdecimal//lib/bigdecimal.rb#10 + def -@; end + + # source://bigdecimal//lib/bigdecimal.rb#10 + def /(_arg0); end + + # source://bigdecimal//lib/bigdecimal.rb#10 + def <(_arg0); end + + # source://bigdecimal//lib/bigdecimal.rb#10 + def <=(_arg0); end + + # source://bigdecimal//lib/bigdecimal.rb#10 + def <=>(_arg0); end + + # source://bigdecimal//lib/bigdecimal.rb#10 + def ==(_arg0); end + + # source://bigdecimal//lib/bigdecimal.rb#10 + def ===(_arg0); end + + # source://bigdecimal//lib/bigdecimal.rb#10 + def >(_arg0); end + + # source://bigdecimal//lib/bigdecimal.rb#10 + def >=(_arg0); end + + # source://bigdecimal//lib/bigdecimal.rb#10 + def _decimal_shift(_arg0); end + + # source://bigdecimal//lib/bigdecimal.rb#10 + def _dump(*_arg0); end + + # source://bigdecimal//lib/bigdecimal.rb#10 + def abs; end + + # source://bigdecimal//lib/bigdecimal.rb#10 + def add(_arg0, _arg1); end + + # source://bigdecimal//lib/bigdecimal.rb#10 + def ceil(*_arg0); end + + # source://bigdecimal//lib/bigdecimal.rb#10 + def clone; end + + # source://bigdecimal//lib/bigdecimal.rb#10 + def coerce(_arg0); end + + # source://bigdecimal//lib/bigdecimal.rb#10 + def div(*_arg0); end + + # source://bigdecimal//lib/bigdecimal.rb#10 + def divmod(_arg0); end + + # source://bigdecimal//lib/bigdecimal.rb#10 + def dup; end + + # source://bigdecimal//lib/bigdecimal.rb#10 + def eql?(_arg0); end + + # source://bigdecimal//lib/bigdecimal.rb#10 + def exponent; end + + # source://bigdecimal//lib/bigdecimal.rb#10 + def finite?; end + + # source://bigdecimal//lib/bigdecimal.rb#10 + def fix; end + + # source://bigdecimal//lib/bigdecimal.rb#10 + def floor(*_arg0); end + + # source://bigdecimal//lib/bigdecimal.rb#10 + def frac; end + + # source://bigdecimal//lib/bigdecimal.rb#10 + def hash; end + + # source://bigdecimal//lib/bigdecimal.rb#10 + def infinite?; end + + # source://bigdecimal//lib/bigdecimal.rb#10 + def inspect; end + + # source://bigdecimal//lib/bigdecimal.rb#10 + def modulo(_arg0); end + + # source://bigdecimal//lib/bigdecimal.rb#10 + def mult(_arg0, _arg1); end + + # source://bigdecimal//lib/bigdecimal.rb#10 + def n_significant_digits; end + + # source://bigdecimal//lib/bigdecimal.rb#10 + def nan?; end + + # source://bigdecimal//lib/bigdecimal.rb#10 + def nonzero?; end + + # call-seq: + # power(n) + # power(n, prec) + # + # Returns the value raised to the power of n. + # + # Also available as the operator **. + # + # source://bigdecimal//lib/bigdecimal.rb#97 + def power(y, prec = T.unsafe(nil)); end + + # source://bigdecimal//lib/bigdecimal.rb#10 + def precision; end + + # source://bigdecimal//lib/bigdecimal.rb#10 + def precision_scale; end + + # source://bigdecimal//lib/bigdecimal.rb#10 + def quo(*_arg0); end + + # source://bigdecimal//lib/bigdecimal.rb#10 + def remainder(_arg0); end + + # source://bigdecimal//lib/bigdecimal.rb#10 + def round(*_arg0); end + + # source://bigdecimal//lib/bigdecimal.rb#10 + def scale; end + + # source://bigdecimal//lib/bigdecimal.rb#10 + def sign; end + + # source://bigdecimal//lib/bigdecimal.rb#10 + def split; end + + # Returns the square root of the value. + # + # Result has at least prec significant digits. + # + # @raise [FloatDomainError] + # + # source://bigdecimal//lib/bigdecimal.rb#212 + def sqrt(prec); end + + # source://bigdecimal//lib/bigdecimal.rb#10 + def sub(_arg0, _arg1); end + + # source://bigdecimal//lib/bigdecimal.rb#10 + def to_f; end + + # source://bigdecimal//lib/bigdecimal.rb#10 + def to_i; end + + # source://bigdecimal//lib/bigdecimal.rb#10 + def to_int; end + + # source://bigdecimal//lib/bigdecimal.rb#10 + def to_r; end + + # source://bigdecimal//lib/bigdecimal.rb#10 + def to_s(*_arg0); end + + # source://bigdecimal//lib/bigdecimal.rb#10 + def truncate(*_arg0); end + + # source://bigdecimal//lib/bigdecimal.rb#10 + def zero?; end + + class << self + # source://bigdecimal//lib/bigdecimal.rb#10 + def _load(_arg0); end + + # source://bigdecimal//lib/bigdecimal.rb#10 + def double_fig; end + + # source://bigdecimal//lib/bigdecimal.rb#10 + def interpret_loosely(_arg0); end + + # source://bigdecimal//lib/bigdecimal.rb#10 + def limit(*_arg0); end + + # source://bigdecimal//lib/bigdecimal.rb#10 + def mode(*_arg0); end + + # source://bigdecimal//lib/bigdecimal.rb#10 + def save_exception_mode; end + + # source://bigdecimal//lib/bigdecimal.rb#10 + def save_limit; end + + # source://bigdecimal//lib/bigdecimal.rb#10 + def save_rounding_mode; end + end +end + +# source://bigdecimal//lib/bigdecimal.rb#14 +module BigDecimal::Internal + class << self + # Coerce x to BigDecimal with the specified precision. + # TODO: some methods (example: BigMath.exp) require more precision than specified to coerce. + # + # @raise [ArgumentError] + # + # source://bigdecimal//lib/bigdecimal.rb#18 + def coerce_to_bigdecimal(x, prec, method_name); end + + # source://bigdecimal//lib/bigdecimal.rb#30 + def coerce_validate_prec(prec, method_name, accept_zero: T.unsafe(nil)); end + + # source://bigdecimal//lib/bigdecimal.rb#50 + def infinity_computation_result; end + + # source://bigdecimal//lib/bigdecimal.rb#57 + def nan_computation_result; end + end +end + +BigDecimal::VERSION = T.let(T.unsafe(nil), String) + +# Core BigMath methods for BigDecimal (log, exp) are defined here. +# Other methods (sin, cos, atan) are defined in 'bigdecimal/math.rb'. +# +# source://bigdecimal//lib/bigdecimal.rb#240 +module BigMath + private + + # source://bigdecimal//lib/bigdecimal.rb#310 + def _exp_taylor(x, prec); end + + # call-seq: + # BigMath.exp(decimal, numeric) -> BigDecimal + # + # Computes the value of e (the base of natural logarithms) raised to the + # power of +decimal+, to the specified number of digits of precision. + # + # If +decimal+ is infinity, returns Infinity. + # + # If +decimal+ is NaN, returns NaN. + # + # source://bigdecimal//lib/bigdecimal.rb#332 + def exp(x, prec); end + + # call-seq: + # BigMath.log(decimal, numeric) -> BigDecimal + # + # Computes the natural logarithm of +decimal+ to the specified number of + # digits of precision, +numeric+. + # + # If +decimal+ is zero or negative, raises Math::DomainError. + # + # If +decimal+ is positive infinity, returns Infinity. + # + # If +decimal+ is NaN, returns NaN. + # + # source://bigdecimal//lib/bigdecimal.rb#255 + def log(x, prec); end + + class << self + # call-seq: + # BigMath.exp(decimal, numeric) -> BigDecimal + # + # Computes the value of e (the base of natural logarithms) raised to the + # power of +decimal+, to the specified number of digits of precision. + # + # If +decimal+ is infinity, returns Infinity. + # + # If +decimal+ is NaN, returns NaN. + # + # source://bigdecimal//lib/bigdecimal.rb#332 + def exp(x, prec); end + + # call-seq: + # BigMath.log(decimal, numeric) -> BigDecimal + # + # Computes the natural logarithm of +decimal+ to the specified number of + # digits of precision, +numeric+. + # + # If +decimal+ is zero or negative, raises Math::DomainError. + # + # If +decimal+ is positive infinity, returns Infinity. + # + # If +decimal+ is NaN, returns NaN. + # + # @raise [Math::DomainError] + # + # source://bigdecimal//lib/bigdecimal.rb#255 + def log(x, prec); end + + private + + # source://bigdecimal//lib/bigdecimal.rb#310 + def _exp_taylor(x, prec); end + end +end diff --git a/sorbet/rbi/gems/commonmarker@2.6.3.rbi b/sorbet/rbi/gems/commonmarker@2.6.3.rbi new file mode 100644 index 00000000000..17e698e47d4 --- /dev/null +++ b/sorbet/rbi/gems/commonmarker@2.6.3.rbi @@ -0,0 +1,265 @@ +# typed: true + +# DO NOT EDIT MANUALLY +# This is an autogenerated file for types exported from the `commonmarker` gem. +# Please instead update this file by running `bin/tapioca gem commonmarker`. + + +# source://commonmarker//lib/commonmarker/constants.rb#3 +module Commonmarker + private + + # source://commonmarker//lib/commonmarker/extension.rb#7 + def commonmark_parse(*_arg0); end + + # source://commonmarker//lib/commonmarker/extension.rb#7 + def commonmark_to_html(*_arg0); end + + class << self + # source://commonmarker//lib/commonmarker/extension.rb#7 + def commonmark_parse(*_arg0); end + + # source://commonmarker//lib/commonmarker/extension.rb#7 + def commonmark_to_html(*_arg0); end + + # Public: Parses a CommonMark string into an HTML string. + # + # text - A {String} of text + # options - A {Hash} of render, parse, and extension options to transform the text. + # + # Returns the `parser` node. + # + # @raise [TypeError] + # + # source://commonmarker//lib/commonmarker.rb#19 + def parse(text, options: T.unsafe(nil)); end + + # Public: Parses a CommonMark string into an HTML string. + # + # text - A {String} of text + # options - A {Hash} of render, parse, and extension options to transform the text. + # plugins - A {Hash} of additional plugins. + # + # Returns a {String} of converted HTML. + # + # @raise [TypeError] + # + # source://commonmarker//lib/commonmarker.rb#36 + def to_html(text, options: T.unsafe(nil), plugins: T.unsafe(nil)); end + end +end + +# source://commonmarker//lib/commonmarker/config.rb#4 +module Commonmarker::Config + extend ::Commonmarker::Constants + extend ::Commonmarker::Utils + + class << self + # source://commonmarker//lib/commonmarker/config.rb#86 + def process_extension_options(options); end + + # source://commonmarker//lib/commonmarker/config.rb#70 + def process_options(options); end + + # source://commonmarker//lib/commonmarker/config.rb#86 + def process_parse_options(options); end + + # source://commonmarker//lib/commonmarker/config.rb#78 + def process_plugins(plugins); end + + # source://commonmarker//lib/commonmarker/config.rb#86 + def process_render_options(options); end + + # source://commonmarker//lib/commonmarker/config.rb#103 + def process_syntax_highlighter_plugin(options); end + end +end + +# For details, see +# https://github.com/kivikakk/comrak/blob/162ef9354deb2c9b4a4e05be495aa372ba5bb696/src/main.rs#L201 +# +# source://commonmarker//lib/commonmarker/config.rb#7 +Commonmarker::Config::OPTIONS = T.let(T.unsafe(nil), Hash) + +# source://commonmarker//lib/commonmarker/config.rb#60 +Commonmarker::Config::PLUGINS = T.let(T.unsafe(nil), Hash) + +# source://commonmarker//lib/commonmarker/constants.rb#4 +module Commonmarker::Constants; end + +# source://commonmarker//lib/commonmarker/constants.rb#5 +Commonmarker::Constants::BOOLS = T.let(T.unsafe(nil), Array) + +# source://commonmarker//lib/commonmarker/node/ast.rb#4 +class Commonmarker::Node + include ::Enumerable + include ::Commonmarker::Node::Inspect + + # source://commonmarker//lib/commonmarker/extension.rb#7 + def append_child(_arg0); end + + # source://commonmarker//lib/commonmarker/extension.rb#7 + def delete; end + + # Public: Iterate over the children (if any) of the current pointer. + # + # source://commonmarker//lib/commonmarker/node.rb#24 + def each; end + + # source://commonmarker//lib/commonmarker/extension.rb#7 + def fence_info; end + + # source://commonmarker//lib/commonmarker/extension.rb#7 + def fence_info=(_arg0); end + + # source://commonmarker//lib/commonmarker/extension.rb#7 + def first_child; end + + # source://commonmarker//lib/commonmarker/extension.rb#7 + def header_level; end + + # source://commonmarker//lib/commonmarker/extension.rb#7 + def header_level=(_arg0); end + + # source://commonmarker//lib/commonmarker/extension.rb#7 + def insert_after(_arg0); end + + # source://commonmarker//lib/commonmarker/extension.rb#7 + def insert_before(_arg0); end + + # source://commonmarker//lib/commonmarker/extension.rb#7 + def last_child; end + + # source://commonmarker//lib/commonmarker/extension.rb#7 + def list_start; end + + # source://commonmarker//lib/commonmarker/extension.rb#7 + def list_start=(_arg0); end + + # source://commonmarker//lib/commonmarker/extension.rb#7 + def list_tight; end + + # source://commonmarker//lib/commonmarker/extension.rb#7 + def list_tight=(_arg0); end + + # source://commonmarker//lib/commonmarker/extension.rb#7 + def list_type; end + + # source://commonmarker//lib/commonmarker/extension.rb#7 + def list_type=(_arg0); end + + # source://commonmarker//lib/commonmarker/extension.rb#7 + def next_sibling; end + + # source://commonmarker//lib/commonmarker/extension.rb#7 + def node_to_commonmark(*_arg0); end + + # source://commonmarker//lib/commonmarker/extension.rb#7 + def node_to_html(*_arg0); end + + # source://commonmarker//lib/commonmarker/extension.rb#7 + def parent; end + + # source://commonmarker//lib/commonmarker/extension.rb#7 + def prepend_child(_arg0); end + + # source://commonmarker//lib/commonmarker/extension.rb#7 + def previous_sibling; end + + # source://commonmarker//lib/commonmarker/extension.rb#7 + def replace(_arg0); end + + # source://commonmarker//lib/commonmarker/extension.rb#7 + def source_position; end + + # source://commonmarker//lib/commonmarker/extension.rb#7 + def string_content; end + + # source://commonmarker//lib/commonmarker/extension.rb#7 + def string_content=(_arg0); end + + # source://commonmarker//lib/commonmarker/extension.rb#7 + def title; end + + # source://commonmarker//lib/commonmarker/extension.rb#7 + def title=(_arg0); end + + # Public: Convert the node to a CommonMark string. + # + # options - A {Symbol} or {Array of Symbol}s indicating the render options + # plugins - A {Hash} of additional plugins. + # + # Returns a {String}. + # + # @raise [TypeError] + # + # source://commonmarker//lib/commonmarker/node.rb#56 + def to_commonmark(options: T.unsafe(nil), plugins: T.unsafe(nil)); end + + # Public: Converts a node to an HTML string. + # + # options - A {Hash} of render, parse, and extension options to transform the text. + # plugins - A {Hash} of additional plugins. + # + # Returns a {String} of HTML. + # + # @raise [TypeError] + # + # source://commonmarker//lib/commonmarker/node.rb#41 + def to_html(options: T.unsafe(nil), plugins: T.unsafe(nil)); end + + # source://commonmarker//lib/commonmarker/extension.rb#7 + def type; end + + # source://commonmarker//lib/commonmarker/extension.rb#7 + def url; end + + # source://commonmarker//lib/commonmarker/extension.rb#7 + def url=(_arg0); end + + # Public: An iterator that "walks the tree," descending into children recursively. + # + # blk - A {Proc} representing the action to take for each child + # + # @yield [_self] + # @yieldparam _self [Commonmarker::Node] the object that the method was called on + # + # source://commonmarker//lib/commonmarker/node.rb#14 + def walk(&block); end + + class << self + # source://commonmarker//lib/commonmarker/extension.rb#7 + def new(*_arg0); end + end +end + +# source://commonmarker//lib/commonmarker/node/ast.rb#5 +class Commonmarker::Node::Ast; end + +# source://commonmarker//lib/commonmarker/node/inspect.rb#7 +module Commonmarker::Node::Inspect + # source://commonmarker//lib/commonmarker/node/inspect.rb#10 + def inspect; end + + # @param printer [PrettyPrint] pp + # + # source://commonmarker//lib/commonmarker/node/inspect.rb#15 + def pretty_print(printer); end +end + +# source://commonmarker//lib/commonmarker/node/inspect.rb#8 +Commonmarker::Node::Inspect::PP_INDENT_SIZE = T.let(T.unsafe(nil), Integer) + +# source://commonmarker//lib/commonmarker/renderer.rb#7 +class Commonmarker::Renderer; end + +# source://commonmarker//lib/commonmarker/utils.rb#6 +module Commonmarker::Utils + include ::Commonmarker::Constants + + # source://commonmarker//lib/commonmarker/utils.rb#9 + def fetch_kv(options, key, value, type); end +end + +# source://commonmarker//lib/commonmarker/version.rb#4 +Commonmarker::VERSION = T.let(T.unsafe(nil), String) diff --git a/sorbet/rbi/gems/crack@1.0.1.rbi b/sorbet/rbi/gems/crack@1.0.1.rbi new file mode 100644 index 00000000000..9e1f7b094e4 --- /dev/null +++ b/sorbet/rbi/gems/crack@1.0.1.rbi @@ -0,0 +1,145 @@ +# typed: true + +# DO NOT EDIT MANUALLY +# This is an autogenerated file for types exported from the `crack` gem. +# Please instead update this file by running `bin/tapioca gem crack`. + + +# source://crack//lib/crack/xml.rb#196 +module Crack; end + +# source://crack//lib/crack/xml.rb#197 +class Crack::REXMLParser + class << self + # source://crack//lib/crack/xml.rb#198 + def parse(xml); end + end +end + +# source://crack//lib/crack/xml.rb#225 +class Crack::XML + class << self + # source://crack//lib/crack/xml.rb#234 + def parse(xml); end + + # source://crack//lib/crack/xml.rb#226 + def parser; end + + # source://crack//lib/crack/xml.rb#230 + def parser=(parser); end + end +end + +# This is a slighly modified version of the XMLUtilityNode from +# http://merb.devjavu.com/projects/merb/ticket/95 (has.sox@gmail.com) +# It's mainly just adding vowels, as I ht cd wth n vwls :) +# This represents the hard part of the work, all I did was change the +# underlying parser. +# +# source://crack//lib/crack/xml.rb#23 +class REXMLUtilityNode + # @return [REXMLUtilityNode] a new instance of REXMLUtilityNode + # + # source://crack//lib/crack/xml.rb#56 + def initialize(name, normalized_attributes = T.unsafe(nil)); end + + # source://crack//lib/crack/xml.rb#73 + def add_node(node); end + + # source://crack//lib/crack/xml.rb#24 + def attributes; end + + # source://crack//lib/crack/xml.rb#24 + def attributes=(_arg0); end + + # source://crack//lib/crack/xml.rb#24 + def children; end + + # source://crack//lib/crack/xml.rb#24 + def children=(_arg0); end + + # Get the inner_html of the REXML node. + # + # source://crack//lib/crack/xml.rb#172 + def inner_html; end + + # source://crack//lib/crack/xml.rb#24 + def name; end + + # source://crack//lib/crack/xml.rb#24 + def name=(_arg0); end + + # source://crack//lib/crack/xml.rb#78 + def to_hash; end + + # Converts the node into a readable HTML node. + # + # @return [String] The HTML node in text form. + # + # source://crack//lib/crack/xml.rb#179 + def to_html; end + + # source://crack//lib/crack/xml.rb#185 + def to_s; end + + # source://crack//lib/crack/xml.rb#24 + def type; end + + # source://crack//lib/crack/xml.rb#24 + def type=(_arg0); end + + # Typecasts a value based upon its type. For instance, if + # +node+ has #type == "integer", + # {{[node.typecast_value("12") #=> 12]}} + # + # @note If +self+ does not have a "type" key, or if it's not one of the + # options specified above, the raw +value+ will be returned. + # @param value [String] The value that is being typecast. + # @return [Integer, TrueClass, FalseClass, Time, Date, Object] The result of typecasting +value+. + # + # source://crack//lib/crack/xml.rb#157 + def typecast_value(value); end + + # Take keys of the form foo-bar and convert them to foo_bar + # + # source://crack//lib/crack/xml.rb#164 + def undasherize_keys(params); end + + private + + # source://crack//lib/crack/xml.rb#191 + def unnormalize_xml_entities(value); end + + class << self + # source://crack//lib/crack/xml.rb#34 + def available_typecasts; end + + # source://crack//lib/crack/xml.rb#38 + def available_typecasts=(obj); end + + # source://crack//lib/crack/xml.rb#26 + def typecasts; end + + # source://crack//lib/crack/xml.rb#30 + def typecasts=(obj); end + end +end + +# The Reason behind redefining the String Class for this specific plugin is to +# avoid the dynamic insertion of stuff on it (see version previous to this commit). +# Doing that disables the possibility of efectuating a dump on the structure. This way it goes. +# +# source://crack//lib/crack/xml.rb#14 +class REXMLUtiliyNodeString < ::String + # Returns the value of attribute attributes. + # + # source://crack//lib/crack/xml.rb#15 + def attributes; end + + # Sets the attribute attributes + # + # @param value the value to set the attribute attributes to. + # + # source://crack//lib/crack/xml.rb#15 + def attributes=(_arg0); end +end diff --git a/sorbet/rbi/gems/csv@3.3.5.rbi b/sorbet/rbi/gems/csv@3.3.5.rbi new file mode 100644 index 00000000000..928f6c45e38 --- /dev/null +++ b/sorbet/rbi/gems/csv@3.3.5.rbi @@ -0,0 +1,9 @@ +# typed: true + +# DO NOT EDIT MANUALLY +# This is an autogenerated file for types exported from the `csv` gem. +# Please instead update this file by running `bin/tapioca gem csv`. + + +# THIS IS AN EMPTY RBI FILE. +# see https://github.com/Shopify/tapioca#manually-requiring-parts-of-a-gem diff --git a/sorbet/rbi/gems/date@3.5.1.rbi b/sorbet/rbi/gems/date@3.5.1.rbi new file mode 100644 index 00000000000..36681e81a09 --- /dev/null +++ b/sorbet/rbi/gems/date@3.5.1.rbi @@ -0,0 +1,403 @@ +# typed: false + +# DO NOT EDIT MANUALLY +# This is an autogenerated file for types exported from the `date` gem. +# Please instead update this file by running `bin/tapioca gem date`. + + +# source://date//lib/date.rb#6 +class Date + include ::Comparable + + # source://date//lib/date.rb#4 + def initialize(*_arg0); end + + # source://date//lib/date.rb#4 + def +(_arg0); end + + # source://date//lib/date.rb#4 + def -(_arg0); end + + # source://date//lib/date.rb#4 + def <<(_arg0); end + + # source://date//lib/date.rb#4 + def <=>(_arg0); end + + # source://date//lib/date.rb#4 + def ===(_arg0); end + + # source://date//lib/date.rb#4 + def >>(_arg0); end + + # source://date//lib/date.rb#4 + def ajd; end + + # source://date//lib/date.rb#4 + def amjd; end + + # source://date//lib/date.rb#4 + def asctime; end + + # source://date//lib/date.rb#4 + def ctime; end + + # source://date//lib/date.rb#4 + def cwday; end + + # source://date//lib/date.rb#4 + def cweek; end + + # source://date//lib/date.rb#4 + def cwyear; end + + # source://date//lib/date.rb#4 + def day; end + + # source://date//lib/date.rb#4 + def day_fraction; end + + # source://date//lib/date.rb#4 + def deconstruct_keys(_arg0); end + + # source://date//lib/date.rb#4 + def downto(_arg0); end + + # source://date//lib/date.rb#4 + def england; end + + # source://date//lib/date.rb#4 + def eql?(_arg0); end + + # source://date//lib/date.rb#4 + def friday?; end + + # source://date//lib/date.rb#4 + def gregorian; end + + # source://date//lib/date.rb#4 + def gregorian?; end + + # source://date//lib/date.rb#4 + def hash; end + + # source://date//lib/date.rb#4 + def httpdate; end + + # call-seq: + # infinite? -> false + # + # Returns +false+ + # + # @return [Boolean] + # + # source://date//lib/date.rb#13 + def infinite?; end + + # source://date//lib/date.rb#4 + def inspect; end + + # source://date//lib/date.rb#4 + def iso8601; end + + # source://date//lib/date.rb#4 + def italy; end + + # source://date//lib/date.rb#4 + def jd; end + + # source://date//lib/date.rb#4 + def jisx0301; end + + # source://date//lib/date.rb#4 + def julian; end + + # source://date//lib/date.rb#4 + def julian?; end + + # source://date//lib/date.rb#4 + def ld; end + + # source://date//lib/date.rb#4 + def leap?; end + + # source://date//lib/date.rb#4 + def marshal_dump; end + + # source://date//lib/date.rb#4 + def marshal_load(_arg0); end + + # source://date//lib/date.rb#4 + def mday; end + + # source://date//lib/date.rb#4 + def mjd; end + + # source://date//lib/date.rb#4 + def mon; end + + # source://date//lib/date.rb#4 + def monday?; end + + # source://date//lib/date.rb#4 + def month; end + + # source://date//lib/date.rb#4 + def new_start(*_arg0); end + + # source://date//lib/date.rb#4 + def next; end + + # source://date//lib/date.rb#4 + def next_day(*_arg0); end + + # source://date//lib/date.rb#4 + def next_month(*_arg0); end + + # source://date//lib/date.rb#4 + def next_year(*_arg0); end + + # source://date//lib/date.rb#4 + def prev_day(*_arg0); end + + # source://date//lib/date.rb#4 + def prev_month(*_arg0); end + + # source://date//lib/date.rb#4 + def prev_year(*_arg0); end + + # source://date//lib/date.rb#4 + def rfc2822; end + + # source://date//lib/date.rb#4 + def rfc3339; end + + # source://date//lib/date.rb#4 + def rfc822; end + + # source://date//lib/date.rb#4 + def saturday?; end + + # source://date//lib/date.rb#4 + def start; end + + # source://date//lib/date.rb#4 + def step(*_arg0); end + + # source://date//lib/date.rb#4 + def strftime(*_arg0); end + + # source://date//lib/date.rb#4 + def succ; end + + # source://date//lib/date.rb#4 + def sunday?; end + + # source://date//lib/date.rb#4 + def thursday?; end + + # source://date//lib/date.rb#4 + def to_date; end + + # source://date//lib/date.rb#4 + def to_datetime; end + + # source://date//lib/date.rb#4 + def to_s; end + + # source://date//lib/date.rb#4 + def to_time; end + + # source://date//lib/date.rb#4 + def tuesday?; end + + # source://date//lib/date.rb#4 + def upto(_arg0); end + + # source://date//lib/date.rb#4 + def wday; end + + # source://date//lib/date.rb#4 + def wednesday?; end + + # source://date//lib/date.rb#4 + def xmlschema; end + + # source://date//lib/date.rb#4 + def yday; end + + # source://date//lib/date.rb#4 + def year; end + + private + + # source://date//lib/date.rb#4 + def hour; end + + # source://date//lib/date.rb#4 + def initialize_copy(_arg0); end + + # source://date//lib/date.rb#4 + def min; end + + # source://date//lib/date.rb#4 + def minute; end + + # source://date//lib/date.rb#4 + def sec; end + + # source://date//lib/date.rb#4 + def second; end + + class << self + # source://date//lib/date.rb#4 + def _httpdate(*_arg0); end + + # source://date//lib/date.rb#4 + def _iso8601(*_arg0); end + + # source://date//lib/date.rb#4 + def _jisx0301(*_arg0); end + + # source://date//lib/date.rb#4 + def _load(_arg0); end + + # source://date//lib/date.rb#4 + def _parse(*_arg0); end + + # source://date//lib/date.rb#4 + def _rfc2822(*_arg0); end + + # source://date//lib/date.rb#4 + def _rfc3339(*_arg0); end + + # source://date//lib/date.rb#4 + def _rfc822(*_arg0); end + + # source://date//lib/date.rb#4 + def _strptime(*_arg0); end + + # source://date//lib/date.rb#4 + def _xmlschema(*_arg0); end + + # source://date//lib/date.rb#4 + def civil(*_arg0); end + + # source://date//lib/date.rb#4 + def commercial(*_arg0); end + + # source://date//lib/date.rb#4 + def gregorian_leap?(_arg0); end + + # source://date//lib/date.rb#4 + def httpdate(*_arg0); end + + # source://date//lib/date.rb#4 + def iso8601(*_arg0); end + + # source://date//lib/date.rb#4 + def jd(*_arg0); end + + # source://date//lib/date.rb#4 + def jisx0301(*_arg0); end + + # source://date//lib/date.rb#4 + def julian_leap?(_arg0); end + + # source://date//lib/date.rb#4 + def leap?(_arg0); end + + # source://date//lib/date.rb#4 + def ordinal(*_arg0); end + + # source://date//lib/date.rb#4 + def parse(*_arg0); end + + # source://date//lib/date.rb#4 + def rfc2822(*_arg0); end + + # source://date//lib/date.rb#4 + def rfc3339(*_arg0); end + + # source://date//lib/date.rb#4 + def rfc822(*_arg0); end + + # source://date//lib/date.rb#4 + def strptime(*_arg0); end + + # source://date//lib/date.rb#4 + def today(*_arg0); end + + # source://date//lib/date.rb#4 + def valid_civil?(*_arg0); end + + # source://date//lib/date.rb#4 + def valid_commercial?(*_arg0); end + + # source://date//lib/date.rb#4 + def valid_date?(*_arg0); end + + # source://date//lib/date.rb#4 + def valid_jd?(*_arg0); end + + # source://date//lib/date.rb#4 + def valid_ordinal?(*_arg0); end + + # source://date//lib/date.rb#4 + def xmlschema(*_arg0); end + end +end + +# source://date//lib/date.rb#17 +class Date::Infinity < ::Numeric + # @return [Infinity] a new instance of Infinity + # + # source://date//lib/date.rb#19 + def initialize(d = T.unsafe(nil)); end + + # source://date//lib/date.rb#33 + def +@; end + + # source://date//lib/date.rb#32 + def -@; end + + # source://date//lib/date.rb#35 + def <=>(other); end + + # source://date//lib/date.rb#30 + def abs; end + + # source://date//lib/date.rb#51 + def coerce(other); end + + # @return [Boolean] + # + # source://date//lib/date.rb#26 + def finite?; end + + # @return [Boolean] + # + # source://date//lib/date.rb#27 + def infinite?; end + + # @return [Boolean] + # + # source://date//lib/date.rb#28 + def nan?; end + + # source://date//lib/date.rb#59 + def to_f; end + + # @return [Boolean] + # + # source://date//lib/date.rb#25 + def zero?; end + + protected + + # source://date//lib/date.rb#21 + def d; end +end + +# source://date//lib/date.rb#7 +Date::VERSION = T.let(T.unsafe(nil), String) diff --git a/sorbet/rbi/gems/erb@6.0.1.rbi b/sorbet/rbi/gems/erb@6.0.1.rbi new file mode 100644 index 00000000000..cfe5487e402 --- /dev/null +++ b/sorbet/rbi/gems/erb@6.0.1.rbi @@ -0,0 +1,816 @@ +# typed: false + +# DO NOT EDIT MANUALLY +# This is an autogenerated file for types exported from the `erb` gem. +# Please instead update this file by running `bin/tapioca gem erb`. + + +# source://erb//lib/erb/version.rb#2 +class ERB + # :markup: markdown + # + # :call-seq: + # ERB.new(template, trim_mode: nil, eoutvar: '_erbout') + # + # Returns a new \ERB object containing the given string +template+. + # + # For details about `template`, its embedded tags, and generated results, see ERB. + # + # **Keyword Argument `trim_mode`** + # + # You can use keyword argument `trim_mode: '%'` + # to enable the [shorthand format][shorthand format] for execution tags. + # + # This value allows [blank line control][blank line control]: + # + # - `'-'`: Omit each blank line ending with `'%>'`. + # + # Other values allow [newline control][newline control]: + # + # - `'>'`: Omit newline for each line ending with `'%>'`. + # - `'<>'`: Omit newline for each line starting with `'<%'` and ending with `'%>'`. + # + # You can also [combine trim modes][combine trim modes]. + # + # **Keyword Argument `eoutvar`** + # + # The string value of keyword argument `eoutvar` specifies the name of the variable + # that method #result uses to construct its result string; + # see #src. + # + # This is useful when you need to run multiple \ERB templates through the same binding + # and/or when you want to control where output ends up. + # + # It's good practice to choose a variable name that begins with an underscore: `'_'`. + # + # [blank line control]: rdoc-ref:ERB@Suppressing+Unwanted+Blank+Lines + # [combine trim modes]: rdoc-ref:ERB@Combining+Trim+Modes + # [newline control]: rdoc-ref:ERB@Suppressing+Unwanted+Newlines + # [shorthand format]: rdoc-ref:ERB@Shorthand+Format+for+Execution+Tags + # + # @return [ERB] a new instance of ERB + # + # source://erb//lib/erb.rb#832 + def initialize(str, trim_mode: T.unsafe(nil), eoutvar: T.unsafe(nil)); end + + # :markup: markdown + # + # :call-seq: + # def_class(super_class = Object, method_name = 'result') -> new_class + # + # Returns a new nameless class whose superclass is `super_class`, + # and which has instance method `method_name`. + # + # Create a template from HTML that has embedded expression tags that use `@arg1` and `@arg2`: + # + # ``` + # html = <