diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 9df0fcc0895..b35bee3c7d9 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -18,7 +18,6 @@ jobs: uses: github/super-linter@v4 env: DEFAULT_BRANCH: ${{ github.base_ref }} - DISABLE_ERRORS: true EDITORCONFIG_FILE_NAME: .editorconfig LINTER_RULES_PATH: /src/ VALIDATE_ALL_CODEBASE: false diff --git a/docs/contribute.md b/docs/contribute.md index 70ec61154ce..a350b846b19 100644 --- a/docs/contribute.md +++ b/docs/contribute.md @@ -158,3 +158,11 @@ cat (Runner/Worker)_TIMESTAMP.log # view your log file We use the .NET Foundation and CoreCLR style guidelines [located here]( https://github.com/dotnet/corefx/blob/master/Documentation/coding-guidelines/coding-style.md) + +### Format C# Code + +To format both staged and unstaged .cs files +``` +cd ./src +./dev.(cmd|sh) format +``` \ No newline at end of file diff --git a/src/dev.sh b/src/dev.sh index fed033d3886..6ed5462a769 100755 --- a/src/dev.sh +++ b/src/dev.sh @@ -203,6 +203,13 @@ function runtest () dotnet msbuild -t:test -p:PackageRuntime="${RUNTIME_ID}" -p:BUILDCONFIG="${BUILD_CONFIG}" -p:RunnerVersion="${RUNNER_VERSION}" ./dir.proj || failed "failed tests" } +function format() +{ + heading "Formatting..." + files="$(git status -s "*.cs" | awk '{print $2}' | tr '\n' ' ')" + dotnet format ${SCRIPT_DIR}/ActionsRunner.sln --exclude / --include $files || failed "failed formatting" +} + function package () { if [ ! -d "${LAYOUT_DIR}/bin" ]; then @@ -360,7 +367,9 @@ case $DEV_CMD in "l") layout;; "package") package;; "p") package;; - *) echo "Invalid cmd. Use build(b), test(t), layout(l) or package(p)";; + "format") format;; + "f") format;; + *) echo "Invalid cmd. Use build(b), test(t), layout(l), package(p), or format(f)";; esac popd