--include / --files documentation is confusing

Open Beginner friendly
#634 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
1-3 hours
Newbie friendliness
68/100
Issue type
Documentation
Clarity
Mostly clear
Activity status
Quiet
Tech stack
csharp
Domain
cli, documentation

Research direction

Start in the README's "How to use" section, especially the --include example, and compare it with the reported --files commands and the --folder behavior. Clarify how file selection differs between workspace and folder mode, with an example that makes pre-commit usage unambiguous; the README should explain why only one file may not be formatted.

Written by the indexing model from the issue text.

Description

Documentation

When I run dotnet format --files .\src\ProjectFolder\Program.cs -v detailed I always see

  Formatting code files in workspace 'SOLUTION_FOLDER\Solution.sln'.
  Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings.
  Formatted 0 of 321 files.
  Format complete in 5402ms.

I would have expected to see only one file formatted.

it works, when I run dotnet format --folder . --files .\src\ProjectFolder\Program.cs -v detailed (kudos to https://github.com/dotnet/format/issues/403)

But in the README it's described as dotnet format --include Programs.cs Utility\Logging.cs without further explanation (https://github.com/dotnet/format#how-to-use) - maybe it could be improved?

Background:

The reason I want to specify only specific files, is to run it as a pre-commit hook as quickly as possible.

Dominant language
No language data
Stars
1.9k
Forks
173
Avg merge
10d 13h
Merged PRs (30d)
1

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from dotnet/format

All issues in dotnet/format

Similar issues

More CLI issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.