Skip to content

perf: Formatter/CleanUp directory scans enumerate .git, bin, obj and process build-output copies #250

Description

@credfeto

Found by AI full-repo code analysis (bugs and performance sweep of non-test projects).

Problem

  • src/Credfeto.DotNet.Repo.Formatter/Commands.cs:333-346Directory.EnumerateFiles(directory, "*.*", AllDirectories) walks the entire tree (including .git, which in a large repo holds tens of thousands of loose objects/pack files) and filters by extension afterwards; bin is not excluded by IsGeneratedFile, so copied .cs content files under bin/ get processed.
  • src/Credfeto.DotNet.Repo.Tools.CleanUp/Services/BulkCodeCleanUp.cs:472-476CleanupTransactSqlAsync reads and reformats every .sql under bin//obj/ on each run.

Failure scenario

Running formatter cleanup . at the root of a large previously-built repo spends noticeable time enumerating .git/bin and reformats build-output copies whose changes are meaningless.

Suggested fix

Prune .git/bin/obj during enumeration (e.g. EnumerationOptions with directory skipping) and add bin to the exclusion markers.

Scope

  • src/Credfeto.DotNet.Repo.Formatter/Commands.cs
  • src/Credfeto.DotNet.Repo.Tools.CleanUp/Services/BulkCodeCleanUp.cs

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions