solargraph icon indicating copy to clipboard operation
solargraph copied to clipboard

Allow levels to be changed for typechecking rules in .solargraph.yml

Open apiology opened this issue 1 month ago • 0 comments

Includes to be able to build:

  • https://github.com/castwide/solargraph/pull/1120

Suggested updates for https://solargraph.org/guides/configuration:

  1. Change block in Defaults section to:
include:
- "**/*.rb"
exclude:
- spec/**/*
- test/**/*
- vendor/**/*
- ".bundle/**/*"
require: []
domains: []
reporters:
- rubocop
- require_not_found
formatter:
  rubocop:
    cops: safe
    except: []
    only: []
    extra_args: []
type_checker:
  rules: {}
max_files: 5000
  1. Add section 'formatter' (hadn't been added)

Specify configuration for code formatters used in the LSP. Currently supports 'rubocop' as the subsection, with the following keys:

  • cops: Valid values: 'all', 'safe'
  • except: List of cops to pass to the --except argument in the RuboCop CLI
  • only: List of cops to pass to the --only argument in the RuboCop CLI
  • extra_args: Additional arguments to pass to the RuboCop CLI
  1. Add section 'type_checker.rules'

Override which rules are applied at a given typechecking level. Example:

type_checker:
  rules:
    validate_calls: typed # make 'typed' level more strict without
                          # bringing in other rules

For the current list of typechecking rules, see [rules.rb]https://github.com/castwide/solargraph/blob/master/lib/solargraph/type_checker/rules.rb) in the Solargraph source.

apiology avatar Nov 27 '25 10:11 apiology