Skip to content

Config value type errors do not name the file or key #46

Description

@ElbertePlinio

Found during review of #45 (issue #43), and present on main at b7b327e. #45 does not change it.

Values of the wrong type pass key validation and only fail when the merged config is deserialized, so the error names neither the file nor the key. A user config of

{"languages":{"go":{"limits":{"depth":"4"}}}}

fails with

error: invalid configuration: invalid type: string "4", expected usize

and a repo .pickcheck.json of {"hook":{"max_blocks":-1}} fails with

error: invalid configuration: invalid value: integer `-1`, expected usize

With a user config and a repo config both loaded, the user cannot tell which file or key to fix. load_config in crates/core/src/config.rs calls serde_json::from_value once after merge_file has merged both files.

Acceptance

  • A value type error names the config file and the full key path, the way key errors do.
  • Tests cover a wrong type in a global limit, a per-language limit, and hook.max_blocks.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions