Skip to content

Commit

Permalink
Add lint & lint-verify commands (#5038)
Browse files Browse the repository at this point in the history
* add cmd_lint{_verify}

* Ignore IDE0010

* Force to use lang 10.0 (net 6)
  • Loading branch information
KonstantinTyukalov authored Nov 12, 2024
1 parent 8452104 commit 65a42bd
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ dotnet_diagnostic.IDE0007.severity = none
dotnet_diagnostic.IDE0008.severity = none

# IDE0010: Add missing cases
dotnet_diagnostic.IDE0010.severity = warning
dotnet_diagnostic.IDE0010.severity = none

# IDE0011: Add braces
dotnet_diagnostic.IDE0011.severity = suggestion
Expand Down
1 change: 1 addition & 0 deletions src/Common.props
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<Project>
<PropertyGroup>
<LangVersion>10.0</LangVersion>
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
<RuntimeIdentifier Condition="'$(BuildingInsideVisualStudio)' != 'true'">$(PackageRuntime)</RuntimeIdentifier>
<SelfContained>true</SelfContained>
Expand Down
14 changes: 14 additions & 0 deletions src/dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,18 @@ function cmd_report() {
fi
}

function cmd_lint() {
heading "Linting source code"

"${DOTNET_DIR}/dotnet" format -v diag "$REPO_ROOT/azure-pipelines-agent.sln" || checkRC "cmd_lint"
}

function cmd_lint_verify() {
heading "Validating linted code"

"${DOTNET_DIR}/dotnet" format --verify-no-changes -v diag "$REPO_ROOT/azure-pipelines-agent.sln" || checkRC "cmd_lint_verify"
}

detect_platform_and_runtime_id
echo "Current platform: $CURRENT_PLATFORM"
echo "Current runtime ID: $DETECTED_RUNTIME_ID"
Expand Down Expand Up @@ -414,6 +426,8 @@ case $DEV_CMD in
"p") cmd_package ;;
"hash") cmd_hash ;;
"report") cmd_report ;;
"lint") cmd_lint ;;
"lint-verify") cmd_lint_verify ;;
*) echo "Invalid command. Use (l)ayout, (b)uild, (t)est, test(l0), test(l1), or (p)ackage." ;;
esac

Expand Down

0 comments on commit 65a42bd

Please sign in to comment.