Skip to content

Commit 65a42bd

Browse files
authored
Add lint & lint-verify commands (#5038)
* add cmd_lint{_verify} * Ignore IDE0010 * Force to use lang 10.0 (net 6)
1 parent 8452104 commit 65a42bd

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ dotnet_diagnostic.IDE0007.severity = none
5959
dotnet_diagnostic.IDE0008.severity = none
6060

6161
# IDE0010: Add missing cases
62-
dotnet_diagnostic.IDE0010.severity = warning
62+
dotnet_diagnostic.IDE0010.severity = none
6363

6464
# IDE0011: Add braces
6565
dotnet_diagnostic.IDE0011.severity = suggestion

src/Common.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<Project>
22
<PropertyGroup>
3+
<LangVersion>10.0</LangVersion>
34
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
45
<RuntimeIdentifier Condition="'$(BuildingInsideVisualStudio)' != 'true'">$(PackageRuntime)</RuntimeIdentifier>
56
<SelfContained>true</SelfContained>

src/dev.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,18 @@ function cmd_report() {
348348
fi
349349
}
350350

351+
function cmd_lint() {
352+
heading "Linting source code"
353+
354+
"${DOTNET_DIR}/dotnet" format -v diag "$REPO_ROOT/azure-pipelines-agent.sln" || checkRC "cmd_lint"
355+
}
356+
357+
function cmd_lint_verify() {
358+
heading "Validating linted code"
359+
360+
"${DOTNET_DIR}/dotnet" format --verify-no-changes -v diag "$REPO_ROOT/azure-pipelines-agent.sln" || checkRC "cmd_lint_verify"
361+
}
362+
351363
detect_platform_and_runtime_id
352364
echo "Current platform: $CURRENT_PLATFORM"
353365
echo "Current runtime ID: $DETECTED_RUNTIME_ID"
@@ -414,6 +426,8 @@ case $DEV_CMD in
414426
"p") cmd_package ;;
415427
"hash") cmd_hash ;;
416428
"report") cmd_report ;;
429+
"lint") cmd_lint ;;
430+
"lint-verify") cmd_lint_verify ;;
417431
*) echo "Invalid command. Use (l)ayout, (b)uild, (t)est, test(l0), test(l1), or (p)ackage." ;;
418432
esac
419433

0 commit comments

Comments
 (0)