-
Notifications
You must be signed in to change notification settings - Fork 16
The .parlour file
The .parlour
file is a YAML file which should reside in the root of your project. It must define your output RBI file, and can then optionally define your styles, required files, and plugins.
Defines the file which the generated RBI file will be written to. This path is relative to the location of your .parlour
file.
output_file: rbi/project.rbi
Overrides the default styling options used when generating RBIs. You can specify any number of the options listed below; unspecified options will use their defaults.
Changes the number of spaces used for each indentation in the RBI file. Defaults to 2 spaces.
style:
tab_size: 4 # use 4 spaces per indent instead of 2
If the number of parameters in a Sorbet method signature (sig
) is equal to or greater than this number, then the signature is broken onto multiple lines. Defaults to 4.
style:
break_params: 0 # break all signatures across multiple lines
An array of gems which should be required (using require
) to allow all specified plugins to be resolved. Defaults to none.
requires:
- a_gem_containing_a_plugin
- another_gem
An array of file paths, relative to .parlour
, which should be required (using require_relative
) to allow all specified plugins to be resolved. Defaults to none.
relative_requires:
- parlour_plugins/some_plugin.rb
- parlour_plugins/some_other_plugin.rb
An associative array of plugin names to the configuration for that plugin. A plugin's name is its full module/class path. Plugin configuration should be an associative array; if you do not need to specify any configuration, then write {}
.
plugins:
Gem1::Plugin: {} # no configuration
Gem2::Plugin: # two configuration options, foo and bar
foo: 2
bar: 4
Whether to use Parlour's parser to load type signatures from the current project before running plugins. By default, the parser runs, but set to false
to prevent this. This key can accept children to control the behaviour of the parser and loader:
The root of the Sorbet project to begin loading from, default .
.
A list of paths to include while loading; all other files in the project will be ignored. (This acts as a filter on the set of Ruby files already detected by Sorbet, so you cannot e.g. include a file from outside of this project directory.)
A list of paths to exclude while loading; all other files in the project will be loaded.
This is an example of a complete .parlour
file, which uses the Sord::ParlourPlugin
plugin from the sord
gem, with some configuration.
output_file: rbi/project.rbi
style:
break_params: 0 # break all signatures onto their own lines
requires:
- sord
plugins:
Sord::ParlourPlugin:
replace_unresolved_with_untyped: yes