Skip to content

Commit

Permalink
Merge pull request #86 from Azure/add-linter
Browse files Browse the repository at this point in the history
Add linter and link checker
  • Loading branch information
jfaurskov authored Sep 3, 2024
2 parents 6817472 + a6a3349 commit 461bd40
Show file tree
Hide file tree
Showing 4 changed files with 115 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .github/actions-config/.linkspector.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
dirs:
- ./
#baseUrl: https://example.com
# ignorePatterns:
# - pattern: '^https://example.com/skip/.*$'
# - pattern: "^(ftp)://[^\\s/$?#]*\\.[^\\s]*$"
# replacementPatterns:
# - pattern: "(https?://example.com)/(\\w+)/(\\d+)"
# replacement: '$1/id/$3'
# - pattern: "\\[([^\\]]+)\\]\\((https?://example.com)/file\\)"
# replacement: '<a href="$2/file">$1</a>'
aliveStatusCodes:
- 200
- 201
- 204
useGitIgnore: true
modifiedFilesOnly: false
35 changes: 35 additions & 0 deletions .github/linters/.markdown-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
###########################
###########################
## Markdown Linter rules ##
###########################
###########################

# Linter rules doc:
# - https://github.com/DavidAnson/markdownlint
#
# Note:
# To comment out a single error:
# <!-- markdownlint-disable -->
# any violations you want
# <!-- markdownlint-restore -->
#

###############
# Rules by id #
###############
MD004: false # Unordered list style
MD007:
indent: 2 # Unordered list indentation
MD013:
line_length: 900 # Line length 80 is far to short
MD026:
punctuation: ".,;:!。,;:" # List of not allowed
MD029: false # Ordered list item prefix
MD033: false # Allow inline HTML
MD036: false # Emphasis used instead of a heading

#################
# Rules by tags #
#################
blank_lines: false # Error on blank lines
6 changes: 6 additions & 0 deletions .github/linters/.yaml-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
rules:
line-length:
max: 150
allow-non-breakable-words: true
allow-non-breakable-inline-mappings: false
56 changes: 56 additions & 0 deletions .github/workflows/code-review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
---
name: Code Review - Linting & Link Checks

on:
pull_request:
branches:
- main
workflow_dispatch: {}

jobs:
lint:
name: Lint code base
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Run github/super-linter
uses: github/[email protected]
env:
# Lint all code - disabled in as part of #262
VALIDATE_ALL_CODEBASE: false
# Need to define main branch as default is set to master in super-linter
DEFAULT_BRANCH: main
# Enable setting the status of each individual linter run in the Checks section of a pull request
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# The following linter types will be enabled:
VALIDATE_JSON: true
VALIDATE_MARKDOWN: true
VALIDATE_POWERSHELL: true
VALIDATE_YAML: true
#YAMLLINT_CONFIG_FILE: .github/linters/.yamllint.yml
#VALIDATE_EDITORCONFIG: true
# Disable errors to only generate a report
#DISABLE_ERRORS: true

markdown-link-check:
name: Markdown Link Check
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@master
with:
fetch-depth: 0

- name: Run linkspector
uses: umbrelladocs/[email protected]
with:
github_token: ${{ secrets.github_token }}
reporter: github-pr-review
fail_on_error: true
config_file: ".github/actions-config/.linkspector.yml"

0 comments on commit 461bd40

Please sign in to comment.