Skip to content

Commit ac4049b

Browse files
authored
ci(docs): add markdown linters and editorconfig (#5055)
* ci(docs): add markdown linters * fixes issues in md detected by the linter * fix workflow * pre commit * add editor config * fix test * review
1 parent e7ff1c9 commit ac4049b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+1139
-779
lines changed

.editorconfig

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# EditorConfig helps developers define and maintain consistent
2+
# coding styles between different editors and IDEs
3+
# editorconfig.org
4+
5+
root = true
6+
7+
[*]
8+
9+
# Change these settings to your own preference
10+
indent_style = space
11+
indent_size = 2
12+
13+
# We recommend you to keep these unchanged
14+
end_of_line = lf
15+
charset = utf-8
16+
trim_trailing_whitespace = true
17+
insert_final_newline = true
18+
19+
[Makefile]
20+
indent_style = tab

.github/ISSUE_TEMPLATE/---bug-report.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ assignees: ''
2020
**Anything else we need to know?**:
2121

2222
**Environment**:
23+
2324
- External-DNS version (use `external-dns --version`):
2425
- DNS provider:
2526
- Others:

.github/workflows/json-yaml-validate.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: json-yaml-validate
1+
name: json-yaml-validate
22
on:
33
push:
44
branches: [ master ]

.github/workflows/lint.yaml

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,27 @@
11
name: Lint
22

33
on:
4-
push:
5-
branches: [ master ]
64
pull_request:
75
branches: [ master ]
86

9-
permissions:
10-
contents: read # to fetch code (actions/checkout)
11-
checks: write
12-
137
jobs:
14-
15-
build:
8+
lint:
9+
name: Markdown, Go and OAS
10+
runs-on: ubuntu-latest
1611
permissions:
1712
contents: read # to fetch code (actions/checkout)
18-
checks: write # to create a new check based on the results (shogo82148/actions-goveralls)
19-
20-
name: Build
21-
runs-on: ubuntu-latest
13+
checks: write
2214
steps:
2315

2416
- name: Check out code into the Go module directory
2517
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2618

19+
- name: Lint markdown
20+
uses: nosborn/[email protected]
21+
with:
22+
files: '.'
23+
config_file: ".markdownlint.json"
24+
2725
- name: Set up Go 1.x
2826
uses: actions/setup-go@v5
2927
with:

.markdownlint.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"default": true,
3+
"MD010": { "code_blocks": false },
4+
"MD013": { "line_length": "300" },
5+
"MD033": false,
6+
"MD036": false,
7+
"MD024": false,
8+
"MD041": false,
9+
"MD029": false,
10+
"MD034": false,
11+
"MD038": false,
12+
"MD046": false
13+
}

.pre-commit-config.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
default_language_version:
3+
node: system
4+
5+
repos:
6+
- repo: https://github.com/pre-commit/pre-commit-hooks
7+
rev: v4.5.0
8+
hooks:
9+
- id: check-added-large-files
10+
- id: check-case-conflict
11+
- id: check-executables-have-shebangs
12+
- id: check-merge-conflict
13+
- id: check-shebang-scripts-are-executable
14+
- id: check-symlinks
15+
- id: destroyed-symlinks
16+
- id: end-of-file-fixer
17+
- id: fix-byte-order-marker
18+
- id: forbid-new-submodules
19+
- id: mixed-line-ending
20+
- id: trailing-whitespace
21+
22+
- repo: https://github.com/igorshubovych/markdownlint-cli
23+
rev: v0.44.0
24+
hooks:
25+
- id: markdownlint
26+
27+
minimum_pre_commit_version: !!str 3.2

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Welcome to Kubernetes. We are excited about the prospect of you joining our [community](https://git.k8s.io/community)! The Kubernetes community abides by the CNCF [code of conduct](code-of-conduct.md). Here is an excerpt:
44

5-
_As contributors and maintainers of this project, and in the interest of fostering an open and welcoming community, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities._
5+
_In the interest of fostering an open and welcoming community, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or other activities._
66

77
## Getting Started
88

Makefile

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,16 @@ ko:
162162
scripts/install-ko.sh
163163

164164
# generate-flags-documentation: Generate documentation (docs/flags.md)
165-
.PHONE: generate-flags-documentation
165+
.PHONY: generate-flags-documentation
166166
generate-flags-documentation:
167167
go run internal/gen/docs/flags/main.go
168+
169+
pre-commit-install: ## Install pre-commit hooks
170+
@pre-commit install
171+
@pre-commit gc
172+
173+
pre-commit-uninstall: ## Uninstall hooks
174+
@pre-commit uninstall
175+
176+
pre-commit-validate: ## Validate files with pre-commit hooks
177+
@pre-commit run --all-files

0 commit comments

Comments
 (0)