Skip to content

Commit

Permalink
Add support for sorbet
Browse files Browse the repository at this point in the history
  • Loading branch information
Verseth committed Nov 15, 2024
1 parent ddc79d8 commit 63ce680
Show file tree
Hide file tree
Showing 68 changed files with 96,344 additions and 641 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: CI Ruby

on:
push:
branches: [ 'main', 'develop' ]
pull_request:
branches: [ 'main', 'develop' ]

jobs:
test:
runs-on: ubuntu-latest
env:
CI: true
strategy:
matrix:
ruby-version: ['3.1', '3.2', '3.3']
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install Ruby and gems
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: Run unit tests
run: bundle exec rake test

lint:
runs-on: ubuntu-latest
env:
CI: true
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install Ruby and gems
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'
bundler-cache: true
- name: Lint Ruby files
run: bundle exec rubocop --parallel

typecheck:
runs-on: ubuntu-latest
env:
CI: true
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install Ruby and gems
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'
bundler-cache: true
- name: Typecheck Ruby files
run: bundle exec srb tc
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
/pkg/
/spec/reports/
/tmp/
/.vscode
.byebug_history
my_examples
74 changes: 14 additions & 60 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,78 +1,32 @@
Style/StringLiterals:
Enabled: false

Style/SingleArgumentDig:
Enabled: false

Layout/LineLength:
Enabled: false
inherit_gem:
rubocop-espago: sorbet.yml

Style/Documentation:
Metrics/MethodLength:
Enabled: false

Style/ClassAndModuleChildren:
Enabled: false

Style/MethodCallWithArgsParentheses:
Enabled: false

Style/ModuleFunction:
EnforcedStyle: 'extend_self'

Style/MissingElse:
Sorbet/RedundantExtendTSig:
Enabled: false

Lint/NumberConversion:
Sorbet/HasSigil:
Enabled: false

Lint/ConstantResolution:
Metrics/ClassLength:
Enabled: false

Style/RescueStandardError:
Enabled: false

Style/FormatStringToken:
Enabled: false

Style/FormatString:
Enabled: false

Style/DocumentationMethod:
Enabled: false

Style/Copyright:
Enabled: false

Style/StringHashKeys:
Enabled: false

Style/InlineComment:
Enabled: false

Layout/FirstHashElementLineBreak:
Enabled: false

Layout/FirstMethodArgumentLineBreak:
Enabled: false

Style/ConstantVisibility:
Enabled: false

Layout/FirstArrayElementLineBreak:
Enabled: false

Layout/MultilineMethodArgumentLineBreaks:
Enabled: false
Sorbet/EnforceSignatures:
Exclude:
- 'bin/*'
- 'test/**/*'

Layout/MultilineAssignmentLayout:
Sorbet/ForbidTUnsafe:
Enabled: false

Bundler/GemComment:
Naming/BlockForwarding:
Enabled: false

AllCops:
TargetRubyVersion: 3.1.0
EnabledByDefault: true
Exclude:
- 'bin/*'
- 'spec/**/*'
- 'test/**/*'
- 'sorbet/**/*'
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.7.4
3.3.6
6 changes: 0 additions & 6 deletions .travis.yml

This file was deleted.

6 changes: 5 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,9 @@
"optparse",
"solargraph",
"testtask"
]
],
"sorbet.enabled": true,
"[ruby]": {
"editor.defaultFormatter": "Shopify.ruby-lsp"
}
}
12 changes: 11 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
# frozen_string_literal: true

source "https://rubygems.org"
source 'https://rubygems.org'

# Specify your gem's dependencies in simple_feature_flags.gemspec
gemspec

gem 'byebug', '~> 11.1' # debugger
gem 'minitest', '~> 5.0' # test library
gem 'rake', '~> 13.0' # automation tasks
gem 'redis', '~> 5.3' # redis client
gem 'redis-namespace', '~> 1.11' # namespaces for redis
gem 'rubocop-espago', '~> 1.0' # ruby linter
gem 'rubocop-sorbet', '~> 0.8' # rubocop for sorbet
gem 'sorbet', '>= 0.5' # static typechecker
gem 'tapioca', '> 0.13' # RBI generator for sorbet
148 changes: 79 additions & 69 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,91 +1,101 @@
PATH
remote: .
specs:
simple_feature_flags (1.2.0)
simple_feature_flags (1.3.0)
sorbet-runtime (> 0.5)

GEM
remote: https://rubygems.org/
specs:
ast (2.4.2)
backport (1.2.0)
benchmark (0.2.0)
bundler-audit (0.9.0.1)
bundler (>= 1.2.0, < 3)
thor (~> 1.0)
byebug (11.1.3)
diff-lcs (1.5.0)
e2mmap (0.1.0)
jaro_winkler (1.5.4)
kramdown (2.3.1)
rexml
kramdown-parser-gfm (1.1.0)
kramdown (~> 2.0)
mini_portile2 (2.7.1)
minitest (5.15.0)
nokogiri (1.13.1)
mini_portile2 (~> 2.7.0)
racc (~> 1.4)
parallel (1.21.0)
parser (3.1.0.0)
connection_pool (2.4.1)
erubi (1.13.0)
json (2.8.2)
language_server-protocol (3.17.0.3)
minitest (5.25.1)
netrc (0.11.0)
parallel (1.26.3)
parser (3.3.6.0)
ast (~> 2.4.1)
racc (1.6.0)
racc
prism (1.2.0)
racc (1.8.1)
rainbow (3.1.1)
rake (12.3.3)
redis (4.6.0)
redis-namespace (1.8.1)
redis (>= 3.0.4)
regexp_parser (2.2.1)
reverse_markdown (2.1.1)
nokogiri
rexml (3.2.5)
rubocop (1.25.1)
rake (13.2.1)
rbi (0.2.1)
prism (~> 1.0)
sorbet-runtime (>= 0.5.9204)
redis (5.3.0)
redis-client (>= 0.22.0)
redis-client (0.22.2)
connection_pool
redis-namespace (1.11.0)
redis (>= 4)
regexp_parser (2.9.2)
rubocop (1.68.0)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.1.0.0)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml
rubocop-ast (>= 1.15.1, < 2.0)
regexp_parser (>= 2.4, < 3.0)
rubocop-ast (>= 1.32.2, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.15.2)
parser (>= 3.0.1.1)
ruby-progressbar (1.11.0)
solargraph (0.44.3)
backport (~> 1.2)
benchmark
bundler (>= 1.17.2)
diff-lcs (~> 1.4)
e2mmap
jaro_winkler (~> 1.5)
kramdown (~> 2.3)
kramdown-parser-gfm (~> 1.1)
parser (~> 3.0)
reverse_markdown (>= 1.0.5, < 3)
rubocop (>= 0.52)
thor (~> 1.0)
tilt (~> 2.0)
yard (~> 0.9, >= 0.9.24)
thor (1.2.1)
tilt (2.0.10)
unicode-display_width (2.1.0)
webrick (1.7.0)
yard (0.9.27)
webrick (~> 1.7.0)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.36.1)
parser (>= 3.3.1.0)
rubocop-espago (1.1.5)
rubocop
rubocop-sorbet (0.8.7)
rubocop (>= 1)
ruby-progressbar (1.13.0)
sorbet (0.5.11647)
sorbet-static (= 0.5.11647)
sorbet-runtime (0.5.11647)
sorbet-static (0.5.11647-aarch64-linux)
sorbet-static (0.5.11647-universal-darwin)
sorbet-static (0.5.11647-x86_64-linux)
sorbet-static-and-runtime (0.5.11647)
sorbet (= 0.5.11647)
sorbet-runtime (= 0.5.11647)
spoom (1.5.0)
erubi (>= 1.10.0)
prism (>= 0.28.0)
sorbet-static-and-runtime (>= 0.5.10187)
thor (>= 0.19.2)
tapioca (0.16.4)
bundler (>= 2.2.25)
netrc (>= 0.11.0)
parallel (>= 1.21.0)
rbi (~> 0.2)
sorbet-static-and-runtime (>= 0.5.11087)
spoom (>= 1.2.0)
thor (>= 1.2.0)
yard-sorbet
thor (1.3.2)
unicode-display_width (2.6.0)
yard (0.9.37)
yard-sorbet (0.9.0)
sorbet-runtime
yard

PLATFORMS
ruby
aarch64-linux
universal-darwin
x86_64-linux

DEPENDENCIES
bundler
bundler-audit
byebug
byebug (~> 11.1)
minitest (~> 5.0)
rake (~> 12.0)
redis
redis-namespace
rubocop
rake (~> 13.0)
redis (~> 5.3)
redis-namespace (~> 1.11)
rubocop-espago (~> 1.0)
rubocop-sorbet (~> 0.8)
simple_feature_flags!
solargraph
sorbet (>= 0.5)
tapioca (> 0.13)

BUNDLED WITH
2.1.4
2.5.22
10 changes: 5 additions & 5 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# frozen_string_literal: true

require "bundler/gem_tasks"
require "rake/testtask"
require 'bundler/gem_tasks'
require 'rake/testtask'

Rake::TestTask.new(:test) do |t|
t.libs << "test"
t.libs << "lib"
t.test_files = FileList["test/**/*_test.rb"]
t.libs << 'test'
t.libs << 'lib'
t.test_files = FileList['test/**/*_test.rb']
end

task default: :test
Loading

0 comments on commit 63ce680

Please sign in to comment.