drahnr / cargo-spellcheck

Checks all your documentation for spelling and grammar mistakes with hunspell and a nlprule based checker for grammar
Apache License 2.0
326 stars 33 forks source link

subcommand `config` exits with error #222

Closed KuabeM closed 3 years ago

KuabeM commented 3 years ago

Describe the bug

Running cargo spellcheck config --stdout throws an error:

Error:
   0: Failed to convert to toml
   1: values must be emitted before tables

Location:
   src/config/mod.rs:145

The error messages hints that there is something wrong with the config struct. I'll investigate further which part is responsible.

To Reproduce

Steps to reproduce the behaviour:

  1. checkout master
  2. Run cargo spellcheck config --stdout (or --user)
  3. Spellcheck fails with an error

Expected behavior

Prints default config on stdout.

Screenshots

Please complete the following information:

Additional context

Here is the output of running with high verbosity. Backtrace does not contain much information, so I skipped it.

cargo r -- config --stdout -vvvvvv
   Compiling cargo-spellcheck v0.9.0-rc1 (/home/korbinian/RustProjects/cargo-spellcheck)
    Finished dev [unoptimized + debuginfo] target(s) in 9.20s
     Running `target/debug/cargo-spellcheck config --stdout -vvvvvv`
[2021-10-27T20:54:10Z TRACE cargo_spellcheck::config::args] Derived action Config from flags/args/cmds
[2021-10-27T20:54:10Z DEBUG cargo_spellcheck::config::args] Attempting to load configuration by priority.
[2021-10-27T20:54:10Z DEBUG cargo_spellcheck::config::args] No cfg flag present
[2021-10-27T20:54:10Z DEBUG cargo_spellcheck::config::args] Using /home/korbinian/RustProjects/cargo-spellcheck/Cargo.toml manifest as anchor file
[2021-10-27T20:54:10Z DEBUG cargo_spellcheck::config::args] Using configuration file /home/korbinian/RustProjects/cargo-spellcheck/.config/spellcheck.toml
[2021-10-27T20:54:10Z TRACE cargo_spellcheck::config::hunspell] Sanitized (/home/korbinian/RustProjects/cargo-spellcheck/.config + .) -> /home/korbinian/RustProjects/cargo-spellcheck/.config
[2021-10-27T20:54:10Z TRACE cargo_spellcheck::config::args] Derived action Config from flags/args/cmds
[2021-10-27T20:54:10Z TRACE cargo_spellcheck] Configuration chore
[2021-10-27T20:54:10Z DEBUG cargo_spellcheck::config] Config { dev_comments: false, skip_readme: false, hunspell: Some(HunspellConfig { lang: Lang5 { lang: eng, country: US }, search_dirs: SearchDirs([]), skip_os_lookups: false, use_builtin: true, extra_dictionaries: [], quirks: Quirks { transform_regex: [], allow_concatenation: false, allow_dashes: false, allow_emojis: true }, tokenization_splitchars: "\",;:.!?#(){}[]|/_-‒'`&@§¶…" }), nlprules: Some(NlpRulesConfig { override_rules: None, override_tokenizer: None }), reflow: Some(ReflowConfig { max_line_length: 80 }) }
Error:
   0: Failed to convert to toml
   1: values must be emitted before tables

Location:
   src/config/mod.rs:146

Backtrace omitted.
Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.
drahnr commented 3 years ago

Since I can't reproduce it, could you run with RUST_BACKTRACE=full?

KuabeM commented 3 years ago

Weird that everything worked fine on your side.. for me it was also broken on Ubuntu 20.04 with rust 1.54 and 1.56..

drahnr commented 3 years ago

I think I mixed up two issues, so I could reproduce it.