Skip to content

Commit 14f4eef

Browse files
author
Gonzalo Diaz
committed
[CONFIG] [FIX] yamllint warnings and errors fixed.
False positive in "on:" adrienverge/yamllint#430 (comment) Can't use "%YAML 1.2" directive because brakes Github Actions How to split long command as multiple lines (cross-SO way) https://stackoverflow.com/a/65808412/6366150
1 parent 901dace commit 14f4eef

File tree

10 files changed

+123
-79
lines changed

10 files changed

+123
-79
lines changed

.github/dependabot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# package ecosystems to update and where the package manifests are located.
33
# Please see the documentation for all configuration options:
44
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5-
5+
---
66
version: 2
77
updates:
88
# Maintain dependencies for GitHub Actions

.github/workflows/docker-image.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
---
12
name: Docker Image CI
23

3-
on:
4+
on: # yamllint disable-line rule:truthy
45
push:
56
branches: [main, develop, feature/*]
67
pull_request:
@@ -23,22 +24,29 @@ jobs:
2324
- name: Run test in Docker image
2425
run: make compose/run
2526
- name: Tag Docker image
26-
run: docker tag algorithm-exercises-csharp:latest algorithm-exercises-csharp:${{ github.sha }}
27+
run: >
28+
docker tag
29+
algorithm-exercises-csharp:latest
30+
algorithm-exercises-csharp:${{ github.sha }}
2731
2832
- name: Run Snyk to check Docker image for vulnerabilities
2933
# Snyk can be used to break the build when it detects vulnerabilities.
3034
# In this case we want to upload the issues to GitHub Code Scanning
3135
continue-on-error: true
3236
uses: snyk/actions/docker@master
3337
env:
38+
# yamllint disable rule:line-length
3439
# In order to use the Snyk Action you will need to have a Snyk API token.
3540
# See https://docs.snyk.io/integrations/ci-cd-integrations/github-actions-integration#getting-your-snyk-token
3641
# or you can sign up for free at https://snyk.io/login
42+
# yamllint enable rule:line-length
3743
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
3844
with:
3945
image: algorithm-exercises-csharp:latest
4046
args: --file=Dockerfile
47+
# yamllint disable rule:comments-indentation
4148
# - name: Upload result to GitHub Code Scanning
4249
# uses: github/codeql-action/upload-sarif@v2
4350
# with:
4451
# sarif_file: snyk.sarif
52+
# yamllint enable rule:comments-indentation

.github/workflows/dotnet-coverage.yml

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,39 @@
1+
# yamllint disable rule:line-length
12
# This workflow will build a .NET project
23
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
4+
# yamllint enable rule:line-length
5+
6+
---
37

48
name: .NET Coverage
59

6-
on:
10+
on: # yamllint disable-line rule:truthy
711
push:
8-
branches: [ main, develop, feature/* ]
12+
branches: ["main", "develop", "feature/*"]
913
pull_request:
10-
branches: [ main ]
14+
branches: ["main"]
1115

1216
jobs:
1317
build:
1418
name: "Run CI"
1519
strategy:
16-
fail-fast: false
17-
matrix:
18-
os: ["windows-latest"]
20+
fail-fast: false
21+
matrix:
22+
os: ["windows-latest"]
1923
runs-on: ${{ matrix.os }}
2024
steps:
21-
- uses: actions/checkout@v4
22-
- name: Setup .NET
23-
uses: actions/setup-dotnet@v4
24-
with:
25-
dotnet-version: 8.0.x
26-
- name: Restore dependencies
27-
run: dotnet restore --verbosity normal
28-
- name: Build
29-
run: dotnet build --no-restore --verbosity normal
30-
- name: Test
31-
run: dotnet test --no-build --verbosity normal
32-
- name: Upload coverage reports to Codecov
33-
uses: codecov/[email protected]
34-
with:
35-
token: ${{ secrets.CODECOV_TOKEN }}
25+
- uses: actions/checkout@v4
26+
- name: Setup .NET
27+
uses: actions/setup-dotnet@v4
28+
with:
29+
dotnet-version: 8.0.x
30+
- name: Restore dependencies
31+
run: dotnet restore --verbosity normal
32+
- name: Build
33+
run: dotnet build --no-restore --verbosity normal
34+
- name: Test
35+
run: dotnet test --no-build --verbosity normal
36+
- name: Upload coverage reports to Codecov
37+
uses: codecov/[email protected]
38+
with:
39+
token: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/dotnet-snyk.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
1+
# yamllint disable rule:line-length
12
# This workflow will build a .NET project
23
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
4+
# yamllint enable rule:line-length
5+
6+
---
37

48
name: .NET Snyk Code analysis
59

6-
on:
10+
on: # yamllint disable-line rule:truthy
711
push:
8-
branches: [ main, develop, feature/* ]
12+
branches: ["main", "develop", "feature/*"]
913
pull_request:
10-
branches: [ main ]
14+
branches: ["main"]
1115

1216
jobs:
1317
security:
@@ -22,6 +26,9 @@ jobs:
2226
- name: Restore dependencies
2327
run: dotnet restore algorithm-exercises-csharp.sln
2428
- name: Run Snyk to check for vulnerabilities
25-
run: snyk test algorithm-exercises-csharp/ algorithm-exercises-csharp-test/
29+
run: >
30+
snyk test
31+
algorithm-exercises-csharp/
32+
algorithm-exercises-csharp-test/
2633
env:
2734
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}

.github/workflows/dotnet.yml

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,41 @@
1+
# yamllint disable rule:line-length
12
# This workflow will build a .NET project
23
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
4+
# yamllint enable rule:line-length
5+
6+
---
37

48
name: .NET Tests
59

6-
on:
10+
on: # yamllint disable-line rule:truthy
711
push:
8-
branches: [ main, develop, feature/* ]
12+
branches: ["main", "develop", "feature/*"]
913
pull_request:
10-
branches: [ main ]
14+
branches: ["main"]
1115

1216
jobs:
1317
build:
1418
name: "Run CI"
1519
strategy:
16-
fail-fast: false
17-
matrix:
18-
os: [
19-
"windows-latest",
20-
"ubuntu-latest",
21-
"macOS-latest"
22-
]
20+
fail-fast: false
21+
matrix:
22+
os: [
23+
"windows-latest",
24+
"ubuntu-latest",
25+
"macOS-latest"
26+
]
2327
runs-on: ${{ matrix.os }}
2428
steps:
25-
- uses: actions/checkout@v4
26-
- name: Setup .NET
27-
uses: actions/setup-dotnet@v4
28-
with:
29-
dotnet-version: 8.0.x
30-
- name: Restore dependencies
31-
run: dotnet restore
32-
- name: Build
33-
run: dotnet build --no-restore
34-
- name: Lint (codestyle)
35-
run: dotnet format --verify-no-changes --verbosity normal
36-
- name: Test
37-
run: dotnet test --no-build --verbosity normal
29+
- uses: actions/checkout@v4
30+
- name: Setup .NET
31+
uses: actions/setup-dotnet@v4
32+
with:
33+
dotnet-version: 8.0.x
34+
- name: Restore dependencies
35+
run: dotnet restore
36+
- name: Build
37+
run: dotnet build --no-restore
38+
- name: Lint (codestyle)
39+
run: dotnet format --verify-no-changes --verbosity normal
40+
- name: Test
41+
run: dotnet test --no-build --verbosity normal

.github/workflows/gitleaks.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1+
---
2+
13
name: gitleaks
2-
on:
4+
5+
on: # yamllint disable-line rule:truthy
36
pull_request:
47
push:
58
workflow_dispatch:
@@ -16,4 +19,5 @@ jobs:
1619
- uses: gitleaks/gitleaks-action@v2
1720
env:
1821
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19-
# GITLEAKS_LICENSE: ${{ secrets.GITLEAKS_LICENSE}} # Only required for Organizations, not personal accounts.
22+
# Only required for Organizations, not personal accounts.
23+
# GITLEAKS_LICENSE: ${{ secrets.GITLEAKS_LICENSE}}

.github/workflows/markdown-lint.yml

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
---
2+
13
name: Markdown Lint
24

3-
on:
5+
on: # yamllint disable-line rule:truthy
46
push:
5-
branches: [ main, develop, feature/* ]
7+
branches: ["main", "develop", "feature/*"]
68
pull_request:
7-
branches: [ main ]
9+
branches: ["main"]
810

911
permissions: read-all
1012

@@ -17,20 +19,22 @@ jobs:
1719
matrix:
1820
os: [ubuntu-latest]
1921
node-version: [22.x]
20-
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
22+
# See supported Node.js release schedule
23+
# at https://nodejs.org/en/about/releases/
2124

2225
steps:
23-
- name: Checkout repository
24-
uses: actions/checkout@v4
25-
26-
- name: Set up Node.js ${{ matrix.node-version }}
27-
uses: actions/setup-node@v4
28-
with:
29-
node-version: ${{ matrix.node-version }}
26+
- name: Checkout repository
27+
uses: actions/checkout@v4
3028

31-
- name: Install dependencies
32-
run: npm install -g markdownlint-cli
29+
- name: Set up Node.js ${{ matrix.node-version }}
30+
uses: actions/setup-node@v4
31+
with:
32+
node-version: ${{ matrix.node-version }}
3333

34-
- name: Lint
35-
run: markdownlint '**/*.md' --ignore node_modules && echo '✔ Your code looks good.'
34+
- name: Install dependencies
35+
run: npm install -g markdownlint-cli
3636

37+
- name: Lint
38+
run: >
39+
markdownlint '**/*.md' --ignore node_modules
40+
&& echo '✔ Your code looks good.'

.github/workflows/sonarcloud.yml

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
---
2+
13
name: SonarCloud
24

3-
on:
5+
on: # yamllint disable-line rule:truthy
46
push:
57
branches:
68
- main
@@ -16,10 +18,12 @@ jobs:
1618
uses: actions/setup-java@v4
1719
with:
1820
java-version: 21
19-
distribution: 'temurin' # Alternative distribution options are available.
21+
# Alternative distribution options are available.
22+
distribution: 'temurin'
2023
- uses: actions/checkout@v4
2124
with:
22-
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
25+
# Shallow clones should be disabled for a better relevancy of analysis
26+
fetch-depth: 0
2327
- name: Cache SonarCloud packages
2428
uses: actions/cache@v4
2529
with:
@@ -41,13 +45,19 @@ jobs:
4145
dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner
4246
- name: Build and analyze
4347
env:
44-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
4548
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
49+
# Needed to get PR information, if any
50+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4651
shell: powershell
4752
run: |
48-
.\.sonar\scanner\dotnet-sonarscanner begin /k:"sir-gon_algorithm-exercises-csharp" /o:"sir-gon" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.opencover.reportsPaths=**/coverage.opencover.xml
53+
.\.sonar\scanner\dotnet-sonarscanner begin `
54+
/k:"sir-gon_algorithm-exercises-csharp" `
55+
/o:"sir-gon" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" `
56+
/d:sonar.host.url="https://sonarcloud.io" `
57+
/d:sonar.cs.opencover.reportsPaths=**/coverage.opencover.xml
4958
5059
dotnet restore
5160
dotnet build --no-restore
5261
dotnet test --no-build --verbosity normal
53-
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"
62+
.\.sonar\scanner\dotnet-sonarscanner end `
63+
/d:sonar.token="${{ secrets.SONAR_TOKEN }}"

.markdownlint.yaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
---
2+
# yamllint disable rule:line-length
3+
14
# Example markdownlint configuration with all properties set to their default value
25

36
# Default state for all rules
@@ -203,9 +206,7 @@ MD042: true
203206
# MD043/required-headings/required-headers - Required heading structure
204207
MD043:
205208
# List of headings
206-
headings: [
207-
"*"
208-
]
209+
headings: ["*"]
209210
# Match case of headings
210211
match_case: false
211212

@@ -255,3 +256,4 @@ MD053:
255256
# Ignored definitions
256257
ignored_definitions:
257258
- "//"
259+
# yamllint enable rule:line-length

compose.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
services:
23
algorithm-exercises-csharp:
34
image: algorithm-exercises-csharp:latest
@@ -17,8 +18,8 @@ services:
1718
context: .
1819
target: mdlint
1920
# environment:
20-
# LOG_LEVEL: ${LOG_LEVEL:-info} ## (1) ## info | debug
21-
# BRUTEFORCE: ${BRUTEFORCE:-false} ## (1) ## true | false
21+
#  LOG_LEVEL: ${LOG_LEVEL:-info} ## (1) ## info | debug
22+
#  BRUTEFORCE: ${BRUTEFORCE:-false} ## (1) ## true | false
2223
volumes:
2324
- ./:/app
2425
profiles: ["lint"]

0 commit comments

Comments
 (0)