Skip to content

Latest commit

 

History

History
152 lines (106 loc) · 7.06 KB

CONFIGURING.md

File metadata and controls

152 lines (106 loc) · 7.06 KB

SpacemanDMM suite configuration

All 'opinionated' errors in the suite have an associated configuration option to redefine their Severity or to disable them completely.

Errors that would fail to compile in the DM compiler or will always cause a runtime cannot be disabled (eg: bad keyword arguments).

As of writing, all front ends have the functionality to accept a configuration file. They default to using SpacemanDMM.toml located in the same directory as the .dme file.

Defaults are subject to change.

Diagnostic Options

Diagnostic options can be set to the following:

  • "error", "errors" - Diagnostic is an error
  • "warning", "warnings" - Diagnostic is a warning
  • "info", "infos" - Diagnostic is informational
  • "hint", "hints" - Diagnostic is a hint (displayed inline, but not in the error list)
  • "disabled", "false", "off" - Diagnostic is disabled completely
  • "unset", or not present in the config file - Uses the default

Display

The [display] section has the following options:

  • error_level - Sets the level at which errors are registered instead of being ignored

Diagnostics

The [diagnostics] section has the following options:

Raised by lexer:

  • integer_precision_loss - Raised where an integer is out of integer range and is implicitly formatted as a float

Raised by preprocessor:

  • duplicate_include - Raised where the same file is included twice
  • macro_redefined - Raised where a macro is defined a second time
  • macro_undefined_no_definition - Raised where a macro is undefined where no such macro is defined

Raised by parser:

  • var_in_proc_parameter - Raised where var/ is used in proc arguments
  • static_in_proc_parameter - Raised where static/ is used in proc arguments
  • semicolon_in_proc_parameter - Raised where ; is used in proc arguments
  • in_precedes_as - Raised where input() calls are using as after in which DM silently ignores
  • tmp_no_effect - Raised where local vars are defined as tmp which has no effect
  • final_no_effect - Raised where local vars are defined as SpacemanDMM_final which has no effect
  • as_local_var - Raised where local vars are defined using the as Foo syntax which has no effect

Raised by object tree:

Raised by DreamChecker:

  • disabled_directive - Raised when attempting to disable a set SpacemanDMM_* directive that cannot be disabled
  • sets_directive_twice - Raised when a directive is set twice in the same proc
  • invalid_lint_directive_value - Raised when attempting to set a directive value to something other than 1, 0, TRUE, FALSE
  • invalid_set_value - Raised on invalid values used with builtin set directives
  • unknown_linter_setting - Raised when setting a SpacemanDMM_* directive that DreamChecker doesn't implement
  • override_missing_keyword_arg - Raised when proc overrides are missing keyword arguments
  • must_not_override - SpacemanDMM_should_not_override directive
  • must_call_parent - SpacemanDMM_should_call_parent directive
  • must_not_call_parent - SpacemanDMM_should_not_call_parent directive
  • final_var - SpacemanDMM_final var type
  • private_proc - SpacemanDMM_private_proc directive
  • protected_proc - SpacemanDMM_protected_proc directive
  • private_var - SpacemanDMM_private var type
  • protected_var - SpacemanDMM_protected var type
  • must_be_pure - SpacemanDMM_should_be_pure directive
  • must_not_sleep - SpacemanDMM_should_not_sleep directive
  • redefined_proc - SpacemanDMM_can_be_redefined directive
  • ambiguous_in_lhs - Raised on ambiguous operations on the left hand side of an in operation
  • ambiguous_not_bitwise - Raised on an ambiguous ! on the left hand side of a bitwise operation
  • no_typehint_implicit_new - Raised on the use of new where no typehint is avaliable
  • field_access_static_type - Raised on using .field_name on a variable with no typehint
  • proc_call_static_type - Raised on using .proc_name() on a variable with no typehint
  • proc_has_no_parent - Raised on calling ..() in a proc with no parent.
  • no_operator_overload - Raised on using a unary operator on a non-primative that doesn't define it's own override, eg somemob++
  • unreachable_code - Raised on finding code that can never be executed
  • control_condition_static - Raised on a control condition such as if/while having a static condition such as 1 or "string"
  • if_condition_determinate - Raised on if condition being always true or always false
  • loop_condition_determinate - Raised on loop condition such as in for being always true or always false
  • improper_index - Raised on accessing a non list with []

Code standards

These are extremely opinionated lint warnings and as such default to disabled. Set them to true to enable them.

The [code_standards] section has the following options:

  • disallow_relative_proc_definitions - Raised on relative pathed proc definitions
  • disallow_relative_type_definitions - Raised on relative pathed subtype defintions

DreamChecker

The [dreamchecker] section has the following options:

  • sleep_analysis_version - Selects the SpacemanDMM_should_not_sleep analysis version.
    • 1 - Basic call-tree analysis. Default before 2026-09.
    • 2 - Full dynamic dispatch analysis. Catches nearly every case, but has false positives, especially with procs that sleep or not depending on their arguments.
    • 3 - Receiver provenance analysis. Has much fewer false positives but doesn't catch some edge cases. Default.

Language server

The [langserver] section has the following options:

  • dreamchecker - Set to true to run dreamchecker within the language server.

DMDoc

The [dmdoc] section has the following options:

  • use_typepath_names - Set to true to have dmdoc use the true typepath name instead of the value of the name var for types.
  • index_file - Set to a .md filename to override the contents of the documentation homepage.
  • module_directories - A list of directories to search for additional .md and .txt files to include in the Modules section. The default is to use any directory mentioned in a #include in the .dme file.

Debugger

The [debugger] section has the following options:

Map Renderer

The [map_renderer] section has the following options:

  • render_passes - A map from render pass name to true or false to enable or disable a render pass by default.
  • fancy_layers - A map from typepath to layer number to use in the fancy-layers pass.
  • hide_invisible - A list of typepaths to hide in the hide-invisible pass.

Example

[display]
error_level = "hint"

[langserver]
dreamchecker = true

[diagnostics]
duplicate_include = "error"
macro_redefined = "off"