Skip to content

Configuration #219

@MichaReiser

Description

@MichaReiser

Support configuring Red Knot in a persistent configuration:

  • Configuration in the project's pyproject.toml or knot.toml.
  • Configuration sections:
    • rules: enable and disable rules
    • environment: (python version, platform, search paths)
    • files: Override a sub-set of settings on a path level
    • src: Which files should be considered first-party and what's the src root
    • terminal: Configure color output, etc.
    • root options (for now, only respect-ignore-files)
    • requires-python (I'm leaning towards just making it a field on ProjectMetadata because we only respect the requires-python constraint in the project's configuration file)
  • Path anchoring in configuration files (relative paths are relative to the current working directory, the configuration file, or the project root)
  • Track the source of a configuration value for better error reporting: E.g. clippy tells you why a rule is enabled. Is it because the rule is enabled by default or because you enabled it in the configuration or in the CLI? Ideally, we'd have this for all options so that we can refer users to the right configuration file if we detect an invalid setting.
  • User-level configuration
  • Support overriding configuration options from the CLI
  • Hierarchical configuration (knot.toml in any ancestor directory)
  • Generate a JSON schema

Sub-issues

Metadata

Metadata

Assignees

Labels

configurationRelated to settings and configuration

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions