Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Add rbs signatures #1161

Draft
wants to merge 15 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,6 @@ qpixel-import.tar.gz
*.swp

dump.rdb

# RBS related
/.gem_rbs_collection/
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,7 @@ group :development do
gem 'listen', '~> 3.7'
gem 'spring', '~> 4.0'
gem 'web-console', '~> 4.2'

gem 'rbs_rails', require: false
gem 'typeprof', require: false, git: '[email protected]:ruby/typeprof.git', branch: 'master'
end
8 changes: 8 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,10 @@ GEM
rb-fsevent (0.11.2)
rb-inotify (0.10.1)
ffi (~> 1.0)
rbs (3.1.3)
rbs_rails (0.12.0)
parser
rbs (>= 1)
redis (4.8.0)
regexp_parser (2.5.0)
responders (3.0.1)
Expand Down Expand Up @@ -355,6 +359,8 @@ GEM
timeout (0.3.0)
tins (1.31.1)
sync
typeprof (0.21.7)
rbs (>= 1.8.1)
tzinfo (2.0.5)
concurrent-ruby (~> 1.0)
tzinfo-data (1.2022.3)
Expand Down Expand Up @@ -424,6 +430,7 @@ DEPENDENCIES
rails (~> 7.0.0)
rails-controller-testing (~> 1.0)
rails-html-sanitizer (~> 1.4)
rbs_rails
redis (~> 4.8)
reverse_markdown (~> 2.1)
rmagick (~> 5.0)
Expand All @@ -442,6 +449,7 @@ DEPENDENCIES
term-ansicolor (~> 1.7)
terser (~> 1.1)
thwait (~> 0.2)
typeprof
tzinfo-data (~> 1.2022.3)
web-console (~> 4.2)
webdrivers (~> 5.2)
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/abilities_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module AbilitiesHelper
# to x=(4y-2)/(1-y) and use that for the progress bar.
def linearize_progress(score)
linear_score = ((4 * score) - 2) / (1 - score)
[0, linear_score].max
[0.0, linear_score].max
end

def ability_err_msg(internal_id, action = nil)
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def user_signed_in?
end

# Check if the current request is a direct user request, or a resource load.
# @return true if the request is direct, false if not, or nil if it cannot be determined
# @return [Boolean, Nil] true if the request is direct, false if not, or nil if it cannot be determined
def direct_request?
if request.headers['Sec-Fetch-Mode'].present? && request.headers['Sec-Fetch-Mode'] == 'navigate'
true
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/post_types_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def post_type_criteria
def post_type_ids(**opts)
key = post_type_criteria.map { |a| opts[a] ? '1' : '0' }.join
Rails.cache.fetch "network/post_types/post_type_ids/#{key}", include_community: false do
PostType.where(**opts).select(:id).map(&:id)
PostType.where(**opts).ids
end
end
end
5 changes: 0 additions & 5 deletions app/helpers/tags_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,4 @@ def tag_classes(tag, category)
moderator = moderator_ids&.include?(tag.id) ? 'is-red is-outlined' : ''
"badge is-tag #{required} #{topic} #{moderator}"
end

def post_ids_for_tags(tag_ids)
sql = "SELECT post_id FROM posts_tags WHERE tag_id IN #{ApplicationRecord.sanitize_sql_in(tag_ids)}"
ActiveRecord::Base.connection.execute(sql).to_a.flatten
end
end
16 changes: 16 additions & 0 deletions lib/tasks/rbs.rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
require 'rbs_rails/rake_task'

RbsRails::RakeTask.new do |task|
# If you want to avoid generating RBS for some classes, comment in it.
# default: nil
#
# task.ignore_model_if = -> (klass) { klass == MyClass }

# If you want to change the rake task namespace, comment in it.
# default: :rbs_rails
# task.name = :cool_rbs_rails

# If you want to change where RBS Rails writes RBSs into, comment in it.
# default: Rails.root / 'sig/rbs_rails'
# task.signature_root_dir = Rails.root / 'my_sig/rbs_rails'
end
274 changes: 274 additions & 0 deletions rbs_collection.lock.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,274 @@
---
sources:
- type: git
name: ruby/gem_rbs_collection
revision: d114ffa80f35b138aceb7660a224d78afa1b2a63
remote: https://github.com/ruby/gem_rbs_collection.git
repo_dir: gems
path: ".gem_rbs_collection"
gems:
- name: actionmailer
version: '7.0'
source:
type: git
name: ruby/gem_rbs_collection
revision: d114ffa80f35b138aceb7660a224d78afa1b2a63
remote: https://github.com/ruby/gem_rbs_collection.git
repo_dir: gems
- name: actionpack
version: '6.0'
source:
type: git
name: ruby/gem_rbs_collection
revision: d114ffa80f35b138aceb7660a224d78afa1b2a63
remote: https://github.com/ruby/gem_rbs_collection.git
repo_dir: gems
- name: actionview
version: '6.0'
source:
type: git
name: ruby/gem_rbs_collection
revision: d114ffa80f35b138aceb7660a224d78afa1b2a63
remote: https://github.com/ruby/gem_rbs_collection.git
repo_dir: gems
- name: activejob
version: '6.0'
source:
type: git
name: ruby/gem_rbs_collection
revision: d114ffa80f35b138aceb7660a224d78afa1b2a63
remote: https://github.com/ruby/gem_rbs_collection.git
repo_dir: gems
- name: activemodel
version: '7.0'
source:
type: git
name: ruby/gem_rbs_collection
revision: d114ffa80f35b138aceb7660a224d78afa1b2a63
remote: https://github.com/ruby/gem_rbs_collection.git
repo_dir: gems
- name: activerecord
version: '7.0'
source:
type: git
name: ruby/gem_rbs_collection
revision: d114ffa80f35b138aceb7660a224d78afa1b2a63
remote: https://github.com/ruby/gem_rbs_collection.git
repo_dir: gems
- name: activestorage
version: '6.1'
source:
type: git
name: ruby/gem_rbs_collection
revision: d114ffa80f35b138aceb7660a224d78afa1b2a63
remote: https://github.com/ruby/gem_rbs_collection.git
repo_dir: gems
- name: activesupport
version: '7.0'
source:
type: git
name: ruby/gem_rbs_collection
revision: d114ffa80f35b138aceb7660a224d78afa1b2a63
remote: https://github.com/ruby/gem_rbs_collection.git
repo_dir: gems
- name: ast
version: '2.4'
source:
type: git
name: ruby/gem_rbs_collection
revision: d114ffa80f35b138aceb7660a224d78afa1b2a63
remote: https://github.com/ruby/gem_rbs_collection.git
repo_dir: gems
- name: bcrypt
version: '3.1'
source:
type: git
name: ruby/gem_rbs_collection
revision: d114ffa80f35b138aceb7660a224d78afa1b2a63
remote: https://github.com/ruby/gem_rbs_collection.git
repo_dir: gems
- name: cgi
version: '0'
source:
type: stdlib
- name: chunky_png
version: 1.4.0
source:
type: git
name: ruby/gem_rbs_collection
revision: d114ffa80f35b138aceb7660a224d78afa1b2a63
remote: https://github.com/ruby/gem_rbs_collection.git
repo_dir: gems
- name: concurrent-ruby
version: '1.1'
source:
type: git
name: ruby/gem_rbs_collection
revision: d114ffa80f35b138aceb7660a224d78afa1b2a63
remote: https://github.com/ruby/gem_rbs_collection.git
repo_dir: gems
- name: date
version: '0'
source:
type: stdlib
- name: globalid
version: '1.1'
source:
type: git
name: ruby/gem_rbs_collection
revision: d114ffa80f35b138aceb7660a224d78afa1b2a63
remote: https://github.com/ruby/gem_rbs_collection.git
repo_dir: gems
- name: hashie
version: '5.0'
source:
type: git
name: ruby/gem_rbs_collection
revision: d114ffa80f35b138aceb7660a224d78afa1b2a63
remote: https://github.com/ruby/gem_rbs_collection.git
repo_dir: gems
- name: i18n
version: '1.10'
source:
type: git
name: ruby/gem_rbs_collection
revision: d114ffa80f35b138aceb7660a224d78afa1b2a63
remote: https://github.com/ruby/gem_rbs_collection.git
repo_dir: gems
- name: json
version: '0'
source:
type: stdlib
- name: listen
version: '3.2'
source:
type: git
name: ruby/gem_rbs_collection
revision: d114ffa80f35b138aceb7660a224d78afa1b2a63
remote: https://github.com/ruby/gem_rbs_collection.git
repo_dir: gems
- name: logger
version: '0'
source:
type: stdlib
- name: mail
version: '2.8'
source:
type: git
name: ruby/gem_rbs_collection
revision: d114ffa80f35b138aceb7660a224d78afa1b2a63
remote: https://github.com/ruby/gem_rbs_collection.git
repo_dir: gems
- name: minitest
version: '0'
source:
type: stdlib
- name: monitor
version: '0'
source:
type: stdlib
- name: mutex_m
version: '0'
source:
type: stdlib
- name: nokogiri
version: '1.11'
source:
type: git
name: ruby/gem_rbs_collection
revision: d114ffa80f35b138aceb7660a224d78afa1b2a63
remote: https://github.com/ruby/gem_rbs_collection.git
repo_dir: gems
- name: openssl
version: '0'
source:
type: stdlib
- name: parallel
version: '1.20'
source:
type: git
name: ruby/gem_rbs_collection
revision: d114ffa80f35b138aceb7660a224d78afa1b2a63
remote: https://github.com/ruby/gem_rbs_collection.git
repo_dir: gems
- name: rack
version: '2.2'
source:
type: git
name: ruby/gem_rbs_collection
revision: d114ffa80f35b138aceb7660a224d78afa1b2a63
remote: https://github.com/ruby/gem_rbs_collection.git
repo_dir: gems
- name: rails-dom-testing
version: '2.0'
source:
type: git
name: ruby/gem_rbs_collection
revision: d114ffa80f35b138aceb7660a224d78afa1b2a63
remote: https://github.com/ruby/gem_rbs_collection.git
repo_dir: gems
- name: railties
version: '6.0'
source:
type: git
name: ruby/gem_rbs_collection
revision: d114ffa80f35b138aceb7660a224d78afa1b2a63
remote: https://github.com/ruby/gem_rbs_collection.git
repo_dir: gems
- name: rainbow
version: '3.0'
source:
type: git
name: ruby/gem_rbs_collection
revision: d114ffa80f35b138aceb7660a224d78afa1b2a63
remote: https://github.com/ruby/gem_rbs_collection.git
repo_dir: gems
- name: redis
version: '4.2'
source:
type: git
name: ruby/gem_rbs_collection
revision: d114ffa80f35b138aceb7660a224d78afa1b2a63
remote: https://github.com/ruby/gem_rbs_collection.git
repo_dir: gems
- name: securerandom
version: '0'
source:
type: stdlib
- name: singleton
version: '0'
source:
type: stdlib
- name: socket
version: '0'
source:
type: stdlib
- name: stackprof
version: '0.2'
source:
type: git
name: ruby/gem_rbs_collection
revision: d114ffa80f35b138aceb7660a224d78afa1b2a63
remote: https://github.com/ruby/gem_rbs_collection.git
repo_dir: gems
- name: tempfile
version: '0'
source:
type: stdlib
- name: time
version: '0'
source:
type: stdlib
- name: timeout
version: '0'
source:
type: stdlib
- name: tsort
version: '0'
source:
type: stdlib
- name: uri
version: '0'
source:
type: stdlib
gemfile_lock_path: Gemfile.lock
Loading