Skip to content

[FEATURE]: Make lint print the number of files checked #271

@noahkawaguchi

Description

@noahkawaguchi

Feature Description

I would like Codebook's lint command to print not only the number of spelling errors and number of files with errors, but also the total number of files that were checked.

Use Case

This feature would help by providing fuller information about the check that happened, allowing users to confirm that the files they expected to be checked were actually checked. For example, with the current behavior, it might print 0 errors in 0 files, but I had made a mistake with the globs, paths, ignore logic, etc., missing spelling errors in files I thought were being checked.

Proposed Solution

In run_lint in crates/codebook-lsp/src/lint.rs, add another counter for the number of files that pass the ignore path and include path checks, and then print it in the subsequent eprintln!.

Alternative Solutions

  1. This change could be behind a verbose flag or something instead of unconditionally printed. Personally, I don't particularly think that would be necessary if only adding the number of files checked. However, it might make more sense to do that if there was more information to be included behind the verbose flag in the future.

  2. It looks like it would also be relatively simple to count and print the number of files ignored and excluded and the total. For example, something like this:

Out of 88 total file(s), checked 87, ignored 1, and excluded 0.
Found 148 spelling error(s) in 16 file(s).

I primarily want to see the number checked, but I also see the merit in showing the ignored/excluded/total as an extension of the same reasoning. The more I think about it, it might be worth it to just go ahead and add in all this information since it could be helpful. I'm open to any other ideas.

Examples

Current output examples:

  • Found 921 spelling error(s) in 132 file(s).
  • Found 0 unique spelling error(s) in 0 file(s).

Proposed output examples:

  • Checked 266 file(s) and found 921 spelling error(s) in 132 file(s).
  • Checked 19 file(s) and found 0 unique spelling error(s) in 0 file(s).

The total number of files checked is something I miss about CSpell, which has output that looks like this:

  • CSpell: Files checked: 265, Issues found: 182 in 16 files.

Additional Context

I'd love to open a PR if this is something you want to move forward with. It seems like a very small change. All the examples above were actual output from me tinkering with the repo.

If so, I'd like to know what exactly the wording of the new output should be. Checked 266 file(s) and found 921 spelling error(s) in 132 file(s). was just one idea, but anything that conveys the information would be fine for me.

I could also make any of the additional changes I mentioned in the Alternative Solutions section.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions