Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

341
Visualizações
How to configure Steep to find RBS files for a gem outside the stdlib?
Cannot find type `Sinatra::Base`

ruby file

class StaticApp < Sinatra::Base
end  

rbs file

class StaticApp < Sinatra::Base
end  

run

bundle exec steep check --log-level=fatal

result

[error] Cannot find type `Sinatra::Base`
Diagnostic ID: RBS::UnknownTypeName 

I use steep gem. It seems it is needed to require some files. But

library 'sinatra' 

doesn't work.

#<RBS::EnvironmentLoader::UnknownLibraryError: Cannot find type definitions for library: sinatra ([nil])>

What do I wrong? Thanks.

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

But library 'sinatra' doesn't work .. RBS::EnvironmentLoader::UnknownLibraryError

Short answer

# Steepfile
target :app do
  repo_path 'vendor/rbs'

Create a directory structure like vendor/rbs/sinatra/0/sinatra.rbs.

How you write or generate the contents of sinatra.rbs is out of the scope of this answer, but check out gem_rbs_collection. Rails people, see rbs_rails.

Long answer

Steep is using an RBS::EnvironmentLoader.

# steep-0.47.0/lib/steep/project/target.rb:54
loader = RBS::EnvironmentLoader.new(core_root: core_root_path, repository: repo)
options.libraries.each do |lib|
  name, version = lib.split(/:/, 2)
  loader.add(library: name, version: version)
end

The EnvironmentLoader can find a library in either gem_sig_path (I think this would be a sig folder distributed in the gem), or in a repository.

# rbs-1.7.1/lib/rbs/environment_loader.rb:68
def has_library?(library:, version:)
  if self.class.gem_sig_path(library, version) || repository.lookup(library, version)
    true
  else
    false
  end
end

In a Steepfile, repositories are configured via repo_path.

# Steepfile
repo_path 'vendor/rbs'

For the directory structure of a repository, I took https://github.com/ruby/rbs/tree/master/stdlib as an example.

ls -R vendor/rbs
activesupport

vendor/rbs/activesupport:
0

vendor/rbs/activesupport/0:
activesupport.rbs
over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda