squabble.config module

class squabble.config.Config(reporter, plugins, rules)

Bases: tuple

plugins

Alias for field number 1

reporter

Alias for field number 0

rules

Alias for field number 2

exception squabble.config.UnknownPresetException(preset)[source]

Bases: squabble.SquabbleException

Raised when user tries to apply a preset that isn’t defined.

squabble.config.discover_config_location()[source]

Try to locate a config file in some likely locations.

Used when no config path is specified explicitly. In order, this will check for a file named .squabblerc:

  • in the current directory.
  • in the root of the repository (if working in a git repo).
  • in the user’s home directory.
squabble.config.get_base_config(preset_names=None)[source]

Return a basic config value that can be overridden by user configuration files.

Parameters:preset_names – The named presets to use (applied in order), or None
squabble.config.load_config(config_file, preset_names=None, reporter_name=None)[source]

Load configuration from a file, optionally applying a predefined set of rules.

Parameters:
  • config_file (str) – Path to JSON file containing user configuration.
  • preset_name (str) – Preset to use as a base before applying user configuration.
  • reporter_name (str) – Override the reporter named in configuration.
squabble.config.apply_file_config(base, contents)[source]

Given a base configuration object and the contents of a file, return a new config that applies any file-specific rule additions/deletions.

Returns None if the file should be skipped.