Skip to content

Incorrect error when using the --output-format=summary flagΒ #943

@eitamal

Description

@eitamal

I think I found a bug! πŸ›
(just a small one)

When invoking StyLua with the summary output format and without the check flag, e.g.

stylua --output-format=summary file.lua

I get an error:

error: --output-format=unified and --output-format=standard can only be used when --check is enabled

which, as you might have noticed, doesn't mention summary. So, I had a look at the code to see if I was missing something, and found this:

 // Check for incompatible options
    if !opt.check
        && matches!(
            opt.output_format,
            opt::OutputFormat::Unified | opt::OutputFormat::Summary
        )
    {
        bail!("--output-format=unified and --output-format=standard can only be used when --check is enabled");
    }

So it looks like either the check is missing standard and the error message is missing summary or the check should be checking standard instead of summary. But I don't know Rust, and I'm not sure what the expected behaviour should be - so I'm not sure how/what the fix would be.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions