Skip to content

Modernize CODESTYLE to the canonical structure - #12

Closed
ptr727 wants to merge 0 commit into
developfrom
docs/modernize-codestyle
Closed

ptr727 wants to merge 0 commit into
developfrom
docs/modernize-codestyle

Conversation

@ptr727

@ptr727 ptr727 commented Jul 15, 2026

Copy link
Copy Markdown
Owner

Replaces PhotoCleaner's pre-restructure CODESTYLE.md wholesale with the current canonical template version, adopting the General/.NET/Python structure now used across the fleet.

The old CODESTYLE predated the template's General/.NET/Python reorganization. This brings PhotoCleaner in line with the current template rules (US-English spelling, README+HISTORY CI spell-check scope, current .NET and Python style guidance).

Docs-only change: only CODESTYLE.md is modified. Validated with markdownlint-cli2 (0 errors).

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings July 15, 2026 19:12
@codecov

codecov Bot commented Jul 15, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 44.39%. Comparing base (6eaf1cb) to head (cb2c150).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop      #12   +/-   ##
========================================
  Coverage    44.39%   44.39%           
========================================
  Files           25       25           
  Lines         3347     3347           
  Branches       253      253           
========================================
  Hits          1486     1486           
  Misses        1819     1819           
  Partials        42       42           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates PhotoCleaner’s CODESTYLE.md to match the fleet’s canonical “General / .NET / Python” structure, consolidating cross-cutting rules and standardizing documentation around linting, spelling, and per-language clean-compile workflows.

Changes:

  • Replaces the prior CODESTYLE with the canonical template layout and guidance (General + language-specific sections).
  • Documents repo-wide Markdown linting and scoped spelling checks (README/HISTORY), plus clean-compile expectations.
  • Adds/updates .NET and Python style/tooling guidance in the template’s current format.

Comment thread CODESTYLE.md Outdated

### Tooling Names and Casing

Use each tool's official casing in task labels, docs, and prose - `.NET` (not `.Net`), `CSharpier`, `ruff`, `pyright`, `uv`. Don't invent personal variants.
Comment thread CODESTYLE.md Outdated
Comment on lines +52 to +54
1. **The `.NET Format` clean-compile task** (see [Clean-Compile Verification][clean-compile-verification])
- The .NET clean-compile is the **`.NET Format`** VS Code task, which chains `CSharpier Format` -> `.NET Build` -> `dotnet format style --verify-no-changes`. These three task definitions are carried verbatim in [`.vscode/tasks.json`][vscode-tasks].
- After any code change it must pass before commit. Run the `.NET Format` task. To run it natively instead, reproduce that task chain from [`.vscode/tasks.json`][vscode-tasks] exactly - `CSharpier Format`, then `.NET Build`, then the `dotnet format style --verify-no-changes --severity=info ...` verify - without dropping or loosening any argument (tasks.json is the canonical command spec). Bare `dotnet format` alone, skipping CSharpier or the build, is not sufficient.
Comment thread CODESTYLE.md Outdated
Comment on lines +56 to +58
2. **Analyzer configuration**
- `<EnableNETAnalyzers>true</EnableNETAnalyzers>` with `<AnalysisLevel>latest-all</AnalysisLevel>` and `<AnalysisMode>All</AnalysisMode>` (full analyzer set enabled)
- `<TreatWarningsAsErrors>true</TreatWarningsAsErrors>` - any diagnostic surfaced as a warning fails the build, so it must be fixed or deliberately suppressed, not left to accumulate (see [Analyzer Diagnostics and Suppressions][analyzer-diagnostics-and-suppressions])
Comment thread CODESTYLE.md Outdated
These apply repo-wide, in every directory:

1. **Markdown linting**: All `.md` files must be lint-clean (error and warning free) via the VS Code `markdownlint` extension. [`.markdownlint-cli2.jsonc`][markdownlint-cli2] at the repo root is the single source of truth - the davidanson `markdownlint` extension and a command-line `markdownlint-cli2` run both read it, so the IDE and CLI stay in lock-step. Rules it deliberately disables (e.g. `MD013` line-length, `MD033` inline HTML) are **intentional** - do not "fix" them. Fix violations at the source rather than disabling rules.
2. **Spelling**: All spelling must be clean via the CSpell VS Code integration; words must be correctly spelled in **US English** (the repo-wide convention - see [AGENTS.md][agents]). The shared `cspell.json` sets `"language": "en-US"` so British spellings are flagged - a bare `"en"` accepts both US and British and silently passes the wrong spelling. Project-specific terms go in the shared `cspell.json` `words` list - it is the single source of truth the extension, CLI, and CI all read. The `.code-workspace` must **not** carry its own `cspell.words`/`cSpell.words` block; when externalizing words into `cspell.json`, delete any word list left in the workspace (a leftover one duplicates the list and silently drifts).
Comment thread CODESTYLE.md Outdated
logger.LogError(exception, "{Function}", function);
```

2. **Libraries log through abstractions, never a concrete backend.** A NuGet **library** depends only on `Microsoft.Extensions.Logging.Abstractions` and exposes an `ILoggerFactory` seam - a settable global factory defaulting to `NullLoggerFactory.Instance` (fallback `NullLogger.Instance`) with `SetFactory`/`TrySetFactory`, and/or an `ILoggerFactory`/`ILogger` parameter in its API. It must **not** reference Serilog or any sink - that forces a logging framework on every consumer and drags in AOT-incompatible dependencies. The consuming **application** owns the concrete logger (Serilog is fine there), bridges it to `ILoggerFactory` (e.g. `SerilogLoggerFactory` from `Serilog.Extensions.Logging`), and injects it. Reference: `LanguageTags` - `LogOptions` in the library; the CLI's `LoggerFactory` builds the Serilog-backed factory and injects it via `LogOptions.SetFactory`.
Comment thread CODESTYLE.md Outdated

#### Testing Conventions

1. **Framework**: **xUnit v3 or later** (the `xunit.v3` package, never the legacy v2 `xunit` package) with **AwesomeAssertions** for every assertion; native xUnit asserts (`Assert.Equal`, `Assert.True`, ...) are not allowed - use the fluent `.Should()` API
@ptr727

ptr727 commented Jul 15, 2026

Copy link
Copy Markdown
Owner Author

Closing: a verbatim copy of the template CODESTYLE misdescribes this repo (Copilot flagged real mismatches inline). Converting to a repo-adapted conformance fix tracked in #13, to be resolved with local repo context. See #13.

@ptr727 ptr727 closed this Jul 15, 2026
@ptr727
ptr727 deleted the docs/modernize-codestyle branch July 15, 2026 19:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants