Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autobump to typed: true using spoom #8021

Merged
merged 1 commit into from
Sep 13, 2023
Merged

Autobump to typed: true using spoom #8021

merged 1 commit into from
Sep 13, 2023

Conversation

JamieMagee
Copy link
Contributor

@JamieMagee JamieMagee commented Sep 12, 2023

Part of #7782

This PR uses spoom bump to automatically bump the type strictness from typed: false to typed: true where possible with no code changes. This takes us from 11% typed: true to 48% typed: true (autogenerated RBI definitions are included in the statistics). Just shy of the 50% I estimated 馃槃

Before
Sorbet static: 0.5.11012
Sorbet runtime: 0.5.11012

Content:
  files: 871
  files excluding rbis: 770
  modules: 1168
  classes: 5274
  methods: 54662
  methods excluding rbis: 6439

Sigils:
  false: 772 (89%)
  true: 99 (11%)

Methods:
  with signature: 1582 (3%)
  without signature: 53080 (97%)

Methods excluding RBIs
  with signature: 10 (0%)
  without signature: 6429 (100%)

Calls:
After
Sorbet static: 0.5.11012
Sorbet runtime: 0.5.11012

Content:
  files: 871
  files excluding rbis: 770
  modules: 1168
  classes: 5277
  methods: 54666
  methods excluding rbis: 6443

Sigils:
  false: 449 (52%)
  true: 422 (48%)

Methods:
  with signature: 1582 (3%)
  without signature: 53084 (97%)

Methods excluding RBIs
  with signature: 10 (0%)
  without signature: 6433 (100%)

Calls:
  typed: 11466 (37%)

This PR currently excludes the common and npm_and_yarn directories due to an error when running spoom bump:

Details
$ bundle exec spoom bump npm_and_yarn/
Checking files...

bundler: failed to load command: spoom (/usr/local/rvm/gems/ruby-3.1.4/bin/spoom)
/usr/local/rvm/gems/ruby-3.1.4/gems/spoom-1.2.3/lib/spoom/sorbet/errors.rb:52:in `match?': invalid byte sequence in US-ASCII (ArgumentError)
        from /usr/local/rvm/gems/ruby-3.1.4/gems/spoom-1.2.3/lib/spoom/sorbet/errors.rb:52:in `block in parse'
        from /usr/local/rvm/gems/ruby-3.1.4/gems/spoom-1.2.3/lib/spoom/sorbet/errors.rb:51:in `each_line'
        from /usr/local/rvm/gems/ruby-3.1.4/gems/spoom-1.2.3/lib/spoom/sorbet/errors.rb:51:in `parse'
        from /usr/local/rvm/gems/ruby-3.1.4/gems/sorbet-runtime-0.5.11012/lib/types/private/methods/call_validation.rb:256:in `bind_call'
        from /usr/local/rvm/gems/ruby-3.1.4/gems/sorbet-runtime-0.5.11012/lib/types/private/methods/call_validation.rb:256:in `validate_call'
        from /usr/local/rvm/gems/ruby-3.1.4/gems/sorbet-runtime-0.5.11012/lib/types/private/methods/_methods.rb:275:in `block in _on_method_added'
        from /usr/local/rvm/gems/ruby-3.1.4/gems/spoom-1.2.3/lib/spoom/sorbet/errors.rb:38:in `parse_string'
        from /usr/local/rvm/gems/ruby-3.1.4/gems/sorbet-runtime-0.5.11012/lib/types/private/methods/call_validation.rb:256:in `bind_call'
        from /usr/local/rvm/gems/ruby-3.1.4/gems/sorbet-runtime-0.5.11012/lib/types/private/methods/call_validation.rb:256:in `validate_call'
        from /usr/local/rvm/gems/ruby-3.1.4/gems/sorbet-runtime-0.5.11012/lib/types/private/methods/_methods.rb:275:in `block in _on_method_added'
        from /usr/local/rvm/gems/ruby-3.1.4/gems/spoom-1.2.3/lib/spoom/cli/bump.rb:144:in `bump'
        from /usr/local/rvm/gems/ruby-3.1.4/gems/sorbet-runtime-0.5.11012/lib/types/private/methods/call_validation.rb:256:in `bind_call'
        from /usr/local/rvm/gems/ruby-3.1.4/gems/sorbet-runtime-0.5.11012/lib/types/private/methods/call_validation.rb:256:in `validate_call'
        from /usr/local/rvm/gems/ruby-3.1.4/gems/sorbet-runtime-0.5.11012/lib/types/private/methods/_methods.rb:275:in `block in _on_method_added'
        from /usr/local/rvm/gems/ruby-3.1.4/gems/thor-1.2.2/lib/thor/command.rb:27:in `run'
        from /usr/local/rvm/gems/ruby-3.1.4/gems/thor-1.2.2/lib/thor/invocation.rb:127:in `invoke_command'
        from /usr/local/rvm/gems/ruby-3.1.4/gems/thor-1.2.2/lib/thor.rb:392:in `dispatch'
        from /usr/local/rvm/gems/ruby-3.1.4/gems/thor-1.2.2/lib/thor/invocation.rb:116:in `invoke'
        from /usr/local/rvm/gems/ruby-3.1.4/gems/thor-1.2.2/lib/thor.rb:243:in `block in subcommand'
        from /usr/local/rvm/gems/ruby-3.1.4/gems/thor-1.2.2/lib/thor/command.rb:27:in `run'
        from /usr/local/rvm/gems/ruby-3.1.4/gems/thor-1.2.2/lib/thor/invocation.rb:127:in `invoke_command'
        from /usr/local/rvm/gems/ruby-3.1.4/gems/thor-1.2.2/lib/thor.rb:392:in `dispatch'
        from /usr/local/rvm/gems/ruby-3.1.4/gems/thor-1.2.2/lib/thor/base.rb:485:in `start'
        from /usr/local/rvm/gems/ruby-3.1.4/gems/spoom-1.2.3/exe/spoom:7:in `<top (required)>'
        from /usr/local/rvm/gems/ruby-3.1.4/bin/spoom:25:in `load'
        from /usr/local/rvm/gems/ruby-3.1.4/bin/spoom:25:in `<top (required)>'
        from /usr/local/rvm/gems/ruby-3.1.4/gems/bundler-2.4.19/lib/bundler/cli/exec.rb:58:in `load'
        from /usr/local/rvm/gems/ruby-3.1.4/gems/bundler-2.4.19/lib/bundler/cli/exec.rb:58:in `kernel_load'
        from /usr/local/rvm/gems/ruby-3.1.4/gems/bundler-2.4.19/lib/bundler/cli/exec.rb:23:in `run'
        from /usr/local/rvm/gems/ruby-3.1.4/gems/bundler-2.4.19/lib/bundler/cli.rb:492:in `exec'
        from /usr/local/rvm/gems/ruby-3.1.4/gems/bundler-2.4.19/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
        from /usr/local/rvm/gems/ruby-3.1.4/gems/bundler-2.4.19/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
        from /usr/local/rvm/gems/ruby-3.1.4/gems/bundler-2.4.19/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
        from /usr/local/rvm/gems/ruby-3.1.4/gems/bundler-2.4.19/lib/bundler/cli.rb:34:in `dispatch'
        from /usr/local/rvm/gems/ruby-3.1.4/gems/bundler-2.4.19/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
        from /usr/local/rvm/gems/ruby-3.1.4/gems/bundler-2.4.19/lib/bundler/cli.rb:28:in `start'
        from /usr/local/rvm/gems/ruby-3.1.4/gems/bundler-2.4.19/exe/bundle:37:in `block in <top (required)>'
        from /usr/local/rvm/gems/ruby-3.1.4/gems/bundler-2.4.19/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors'
        from /usr/local/rvm/gems/ruby-3.1.4/gems/bundler-2.4.19/exe/bundle:29:in `<top (required)>'
        from /usr/local/rvm/gems/ruby-3.1.4/bin/bundle:25:in `load'
        from /usr/local/rvm/gems/ruby-3.1.4/bin/bundle:25:in `<main>'
        from /usr/local/rvm/gems/ruby-3.1.4/bin/ruby_executable_hooks:22:in `eval'
        from /usr/local/rvm/gems/ruby-3.1.4/bin/ruby_executable_hooks:22:in `<main>'

I'll continue to work on this and open a follow-up PR.

@JamieMagee JamieMagee requested a review from a team as a code owner September 12, 2023 20:53
@github-actions github-actions bot added L: php:composer Issues and code for Composer L: ruby:bundler RubyGems via bundler L: elixir:hex Elixir packages via hex L: java:gradle Maven packages via Gradle L: go:modules Golang modules L: github:actions GitHub Actions L: elm Elm packages L: git:submodules Git submodules L: terraform Terraform packages L: docker Docker containers L: rust:cargo Rust crates via cargo L: dotnet:nuget NuGet packages via nuget or dotnet L: java:maven Maven packages via Maven L: dart:pub Dart packages via pub L: javascript L: python L: swift Swift packages labels Sep 12, 2023
@JamieMagee
Copy link
Contributor Author

I narrowed down the errors in common to:

it { is_expected.to start_with("!! 0.0.5銇嬨倝0.0.6銇鏇寸偣:") }

and

it { is_expected.to start_with("!! 0.0.5銇嬨倝0.0.6銇鏇寸偣:") }

and the error in npm_and_yarn to:

expect { described_class.new("馃し") }.to raise_error(described_class::InvalidPackageName)

Adding the usual magic strings doesn't seem to resolve the error:

# encoding: UTF-8
# coding: UTF-8
# -*- coding: UTF-8 -*-

But adding a UTF-8 BOM does 馃

@JamieMagee
Copy link
Contributor Author

Opened Shopify/spoom#462

@jurre jurre merged commit 0fd225e into dependabot:main Sep 13, 2023
97 checks passed
@JamieMagee JamieMagee deleted the jamiemagee/spoom-bump branch September 13, 2023 15:52
brettfo pushed a commit to brettfo/dependabot-core that referenced this pull request Oct 11, 2023
@JamieMagee JamieMagee added the sorbet 馃崷 Relates to Sorbet types label Dec 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
L: dart:pub Dart packages via pub L: docker Docker containers L: dotnet:nuget NuGet packages via nuget or dotnet L: elixir:hex Elixir packages via hex L: elm Elm packages L: git:submodules Git submodules L: github:actions GitHub Actions L: go:modules Golang modules L: java:gradle Maven packages via Gradle L: java:maven Maven packages via Maven L: javascript L: php:composer Issues and code for Composer L: python L: ruby:bundler RubyGems via bundler L: rust:cargo Rust crates via cargo L: swift Swift packages L: terraform Terraform packages sorbet 馃崷 Relates to Sorbet types
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants