You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use `developer-cli` exactly as written - do not expand to an absolute worktree path.
@@ -16,18 +16,28 @@ Use `developer-cli` exactly as written - do not expand to an absolute worktree p
16
16
-`--cli` - the developer CLI itself
17
17
-`--self-contained-system <name>` - narrows backend linting to one SCS (e.g. `account`, `main`)
18
18
-`--no-build` - skip the rebuild step (faster after a recent build)
19
+
-`--changed-only` - lint only `.cs` files changed against `origin/main` (much faster; see guidance below)
19
20
20
-
No arguments lints everything. Every finding fails CI regardless of severity - fix all of them.
21
+
No arguments lints the whole solution. Every finding fails CI regardless of severity - fix all of them.
21
22
22
23
After `build` succeeds, run `format`, `lint`, `test` in parallel with `--no-build`. Backend lint is slow - run last. Frontend lint often needs code rewrites - run after each bigger change.
23
24
25
+
## When to use `--changed-only`
26
+
27
+
Inspectcode has cross-file rules ("unused public method", "member can be private", flow analysis across method calls). `--changed-only` only inspects the listed files - it doesn't catch issues in untouched files that became invalid because of edits elsewhere.
28
+
29
+
-**Routine work:** use `--changed-only`. Most lint findings are local (style, naming, hints) and the saving is large (~4m → ~30s).
30
+
-**Larger changes that affect other files** (refactoring a public API, deleting a method's only caller, changing a widely-used type): omit `--changed-only` and lint the full solution.
31
+
32
+
CI always lints the full solution, so anything missed by a local `--changed-only` run gets caught before merge.
33
+
24
34
## Examples
25
35
26
36
```bash
27
-
dotnet run --project developer-cli -- lint --quiet # everything
28
-
dotnet run --project developer-cli -- lint --backend --quiet # all backend
29
-
dotnet run --project developer-cli -- lint --frontend --quiet # frontend
30
-
dotnet run --project developer-cli -- lint --backend --self-contained-system main --quiet # one SCS
run: dotnet run -- build --backend ${{ needs.detect-changes.outputs.backend_scope }} --quiet
135
+
run: dotnet run -- build --backend ${{ needs.detect-scope.outputs.backend_scope }} --quiet
134
136
135
137
- name: Run Backend Linting
136
138
working-directory: developer-cli
137
139
run: |
138
-
dotnet run lint --backend ${{ needs.detect-changes.outputs.backend_scope }} --no-build | tee lint-output.log
140
+
dotnet run lint --backend ${{ needs.detect-scope.outputs.backend_scope }} --no-build | tee lint-output.log
139
141
140
142
if ! grep -q "No backend issues found!" lint-output.log; then
141
143
echo "Code linting issues found."
@@ -162,7 +164,7 @@ jobs:
162
164
163
165
code-formatting:
164
166
name: Code Formatting
165
-
needs: detect-changes
167
+
needs: detect-scope
166
168
runs-on: ubuntu-24.04
167
169
168
170
steps:
@@ -193,21 +195,21 @@ jobs:
193
195
194
196
- name: Build Backend Solution
195
197
working-directory: developer-cli
196
-
run: dotnet run -- build --backend ${{ needs.detect-changes.outputs.backend_scope }} --quiet
198
+
run: dotnet run -- build --backend ${{ needs.detect-scope.outputs.backend_scope }} --quiet
197
199
198
200
- name: Check for Code Formatting Issues
199
201
working-directory: developer-cli
200
202
run: |
201
-
dotnet run format --backend ${{ needs.detect-changes.outputs.backend_scope }} ${{ needs.detect-changes.outputs.format_all_files_flag }} --no-build
203
+
dotnet run format --backend ${{ needs.detect-scope.outputs.backend_scope }} ${{ needs.detect-scope.outputs.format_all_files_flag }} --no-build
202
204
203
205
git diff --exit-code || {
204
-
echo "Formatting issues detected. Please run 'dotnet run --project developer-cli -- format --backend ${{ needs.detect-changes.outputs.backend_scope }} ${{ needs.detect-changes.outputs.format_all_files_flag }}' locally and commit the formatted code."
206
+
echo "Formatting issues detected. Please run 'dotnet run --project developer-cli -- format --backend ${{ needs.detect-scope.outputs.backend_scope }} ${{ needs.detect-scope.outputs.format_all_files_flag }}' locally and commit the formatted code."
varselfContainedSystemOption=newOption<string?>("<self-contained-system>","--self-contained-system","-s"){Description="The name of the self-contained system to lint (e.g., main, account, back-office)"};
18
18
varnoBuildOption=newOption<bool>("--no-build"){Description="Skip building and restoring the solution before running linting"};
19
+
varchangedOnlyOption=newOption<bool>("--changed-only"){Description="Lint only .cs files changed against origin/main. Default is to lint the full solution. Recommended for routine local runs; CI always lints the full solution."};
0 commit comments