Skip to content

Commit

Permalink
feat: dotnet linter
Browse files Browse the repository at this point in the history
  • Loading branch information
omar-muscatello-zupit committed Nov 18, 2023
1 parent 070013e commit 8f1468f
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .github/actions/dotnet/lint/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ runs:
steps:
- name: .NET lint style
shell: ${{ inputs.SHELL }}
run: dotnet format style --no-verify-changes
run: dotnet format style --verify-no-changes
working-directory: ${{ inputs.WORKING_DIRECTORY }}

- name: .NET lint analyzers
shell: ${{ inputs.SHELL }}
run: dotnet format analyzers --no-verify-changes
run: dotnet format analyzers --verify-no-changes
working-directory: ${{ inputs.WORKING_DIRECTORY }}
10 changes: 5 additions & 5 deletions .github/workflows/dotnet-workflow-common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,18 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3

- name: Check code formatting
uses: zupit-it/pipeline-templates/.github/actions/dotnet/format@v1.7.0
with:
WORKING_DIRECTORY: ${{ inputs.WORKING_DIRECTORY }}
# - name: Check code formatting
# uses: zupit-it/pipeline-templates/.github/actions/dotnet/format@v1.8.1
# with:
# WORKING_DIRECTORY: ${{ inputs.WORKING_DIRECTORY }}

- name: Build
uses: zupit-it/pipeline-templates/.github/actions/dotnet/[email protected]
with:
WORKING_DIRECTORY: ${{ inputs.WORKING_DIRECTORY }}
BUILD_CONFIG: "Debug"

- name: Run linter
- name: Lint
uses: zupit-it/pipeline-templates/.github/actions/dotnet/lint@dotnet-linter
with:
WORKING_DIRECTORY: ${{ inputs.WORKING_DIRECTORY }}
Expand Down
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,41 @@ steps:
SHELL: "bash"
```

#### .NET Action - Lint

This action:
- run the `dotnet format` command on the `WORKING_DIRECTORY`.

###### Requirements

- The `WORKING_DIRECTORY` directory must contain a solution or a project file.
- The correct .NET (6+) version must be installed.

_This workflow doesn't download the codebase. You have to check out the repo by yourself._

###### Action

**.github/actions/dotnet/lint** is the action that lints the code of a .NET solution.

It requires these inputs:

- **WORKING_DIRECTORY**: The directory where the runner can execute all the commands. It must contain a solution (`.sln`) or a project (`.csproj`) file.

In addition, it is possible to specify this optional input:

- **SHELL**: The shell type to use. By default, it is **bash**.

This is an example to show how data should be formatted.

```yaml
steps:
- name: Build
uses: zupit-it/pipeline-templates/.github/actions/dotnet/[email protected]
with:
WORKING_DIRECTORY: "back-end"
SHELL: "bash"
```

#### .NET Action - Test

This action:
Expand Down

0 comments on commit 8f1468f

Please sign in to comment.