Skip to content

Commit ae52df6

Browse files
authored
Add markdownlint (#20512)
Add `markdownlint` linter and fix issues. Config is based on the one from electron's repo with a few rules relaxed.
1 parent 6554d51 commit ae52df6

File tree

68 files changed

+1336
-820
lines changed

Some content is hidden

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

68 files changed

+1336
-820
lines changed

Diff for: .editorconfig

-3
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,3 @@ indent_style = tab
2626

2727
[*.svg]
2828
insert_final_newline = false
29-
30-
[*.md]
31-
trim_trailing_whitespace = false

Diff for: .markdownlint.yaml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
commands-show-output: false
2+
fenced-code-language: false
3+
first-line-h1: false
4+
header-increment: false
5+
line-length: {code_blocks: false, tables: false, stern: true, line_length: -1}
6+
no-alt-text: false
7+
no-bare-urls: false
8+
no-blanks-blockquote: false
9+
no-duplicate-header: {allow_different_nesting: true}
10+
no-emphasis-as-header: false
11+
no-empty-links: false
12+
no-hard-tabs: {code_blocks: false}
13+
no-inline-html: false
14+
no-space-in-code: false
15+
no-space-in-emphasis: false
16+
no-trailing-punctuation: false
17+
no-trailing-spaces: {br_spaces: 0}
18+
single-h1: false

Diff for: CHANGELOG.md

+49-5
Large diffs are not rendered by default.

Diff for: CONTRIBUTING.md

+66-56
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,12 @@ Here's how to run the test suite:
8181
|``make lint-frontend`` | lint frontend files |
8282
|``make lint-backend`` | lint backend files |
8383

84-
- run test code (Suggest run in Linux)
84+
- run test code (Suggest run in Linux)
8585

8686
| | |
8787
| :------------------------------------- | :----------------------------------------------- |
8888
|``make test[\#TestSpecificName]`` | run unit test |
89-
|``make test-sqlite[\#TestSpecificName]``| run [integration](integrations) test for SQLite |
89+
|``make test-sqlite[\#TestSpecificName]``| run [integration](integrations) test for SQLite |
9090
|[More details about integrations](integrations/README.md) |
9191

9292
## Vendoring
@@ -127,14 +127,14 @@ the *[How to get faster PR reviews](https://github.com/kubernetes/community/blob
127127
it has lots of useful tips for any project you may want to contribute.
128128
Some of the key points:
129129

130-
* Make small pull requests. The smaller, the faster to review and the
130+
- Make small pull requests. The smaller, the faster to review and the
131131
more likely it will be merged soon.
132-
* Don't make changes unrelated to your PR. Maybe there are typos on
132+
- Don't make changes unrelated to your PR. Maybe there are typos on
133133
some comments, maybe refactoring would be welcome on a function... but
134134
if that is not related to your PR, please make *another* PR for that.
135-
* Split big pull requests into multiple small ones. An incremental change
135+
- Split big pull requests into multiple small ones. An incremental change
136136
will be faster to review than a huge PR.
137-
* Use the first comment as a summary explainer of your PR and you should keep this up-to-date as the PR evolves.
137+
- Use the first comment as a summary explainer of your PR and you should keep this up-to-date as the PR evolves.
138138

139139
If your PR could cause a breaking change you must add a BREAKING section to this comment e.g.:
140140

@@ -146,7 +146,8 @@ To explain how this could affect users and how to mitigate these changes.
146146

147147
## Styleguide
148148

149-
For imports you should use the following format (_without_ the comments)
149+
For imports you should use the following format (*without* the comments)
150+
150151
```go
151152
import (
152153
// stdlib
@@ -181,11 +182,15 @@ To maintain understandable code and avoid circular dependencies it is important
181182
## API v1
182183

183184
The API is documented by [swagger](http://try.gitea.io/api/swagger) and is based on [GitHub API v3](https://developer.github.com/v3/).
184-
Thus, Gitea´s API should use the same endpoints and fields as GitHub´s API as far as possible, unless there are good reasons to deviate.
185-
If Gitea provides functionality that GitHub does not, a new endpoint can be created.
185+
186+
Thus, Gitea´s API should use the same endpoints and fields as GitHub´s API as far as possible, unless there are good reasons to deviate.
187+
188+
If Gitea provides functionality that GitHub does not, a new endpoint can be created.
189+
186190
If information is provided by Gitea that is not provided by the GitHub API, a new field can be used that doesn't collide with any GitHub fields.
187191

188192
Updating an existing API should not remove existing fields unless there is a really good reason to do so.
193+
189194
The same applies to status responses. If you notice a problem, feel free to leave a comment in the code for future refactoring to APIv2 (which is currently not planned).
190195

191196
All expected results (errors, success, fail messages) should be documented
@@ -194,28 +199,33 @@ All expected results (errors, success, fail messages) should be documented
194199
All JSON input types must be defined as a struct in [modules/structs/](modules/structs/)
195200
([example](https://github.com/go-gitea/gitea/blob/c620eb5b2d0d874da68ebd734d3864c5224f71f7/modules/structs/issue.go#L76-L91))
196201
and referenced in
197-
[routers/api/v1/swagger/options.go](https://github.com/go-gitea/gitea/blob/c620eb5b2d0d874da68ebd734d3864c5224f71f7/routers/api/v1/swagger/options.go).
202+
[routers/api/v1/swagger/options.go](https://github.com/go-gitea/gitea/blob/c620eb5b2d0d874da68ebd734d3864c5224f71f7/routers/api/v1/swagger/options.go).
203+
198204
They can then be used like the following:
199205
([example](https://github.com/go-gitea/gitea/blob/c620eb5b2d0d874da68ebd734d3864c5224f71f7/routers/api/v1/repo/issue.go#L318)).
200206

201207
All JSON responses must be defined as a struct in [modules/structs/](modules/structs/)
202208
([example](https://github.com/go-gitea/gitea/blob/c620eb5b2d0d874da68ebd734d3864c5224f71f7/modules/structs/issue.go#L36-L68))
203209
and referenced in its category in [routers/api/v1/swagger/](routers/api/v1/swagger/)
204-
([example](https://github.com/go-gitea/gitea/blob/c620eb5b2d0d874da68ebd734d3864c5224f71f7/routers/api/v1/swagger/issue.go#L11-L16))
210+
([example](https://github.com/go-gitea/gitea/blob/c620eb5b2d0d874da68ebd734d3864c5224f71f7/routers/api/v1/swagger/issue.go#L11-L16))
211+
205212
They can be used like the following:
206213
([example](https://github.com/go-gitea/gitea/blob/c620eb5b2d0d874da68ebd734d3864c5224f71f7/routers/api/v1/repo/issue.go#L277-L279))
207214

208215
In general, HTTP methods are chosen as follows:
209-
* **GET** endpoints return requested object and status **OK (200)**
210-
* **DELETE** endpoints return status **No Content (204)**
211-
* **POST** endpoints return status **Created (201)**, used to **create** new objects (e.g. a User)
212-
* **PUT** endpoints return status **No Content (204)**, used to **add/assign** existing Objects (e.g. User) to something (e.g. Org-Team)
213-
* **PATCH** endpoints return changed object and status **OK (200)**, used to **edit/change** an existing object
216+
217+
- **GET** endpoints return requested object and status **OK (200)**
218+
- **DELETE** endpoints return status **No Content (204)**
219+
- **POST** endpoints return status **Created (201)**, used to **create** new objects (e.g. a User)
220+
- **PUT** endpoints return status **No Content (204)**, used to **add/assign** existing Objects (e.g. User) to something (e.g. Org-Team)
221+
- **PATCH** endpoints return changed object and status **OK (200)**, used to **edit/change** an existing object
214222

215223
An endpoint which changes/edits an object expects all fields to be optional (except ones to identify the object, which are required).
224+
216225
### Endpoints returning lists should
217-
* support pagination (`page` & `limit` options in query)
218-
* set `X-Total-Count` header via **SetTotalCountHeader** ([example](https://github.com/go-gitea/gitea/blob/7aae98cc5d4113f1e9918b7ee7dd09f67c189e3e/routers/api/v1/repo/issue.go#L444))
226+
227+
- support pagination (`page` & `limit` options in query)
228+
- set `X-Total-Count` header via **SetTotalCountHeader** ([example](https://github.com/go-gitea/gitea/blob/7aae98cc5d4113f1e9918b7ee7dd09f67c189e3e/routers/api/v1/repo/issue.go#L444))
219229

220230
## Large Character Comments
221231

@@ -368,35 +378,35 @@ and lead the development of Gitea.
368378
To honor the past owners, here's the history of the owners and the time
369379
they served:
370380

371-
* 2022-01-01 ~ 2022-12-31 - https://github.com/go-gitea/gitea/issues/17872
372-
* [Lunny Xiao](https://gitea.com/lunny) <[email protected]>
373-
* [Matti Ranta](https://gitea.com/techknowlogick) <[email protected]>
374-
* [Andrew Thornton](https://gitea.com/zeripath) <[email protected]>
381+
- 2022-01-01 ~ 2022-12-31 - https://github.com/go-gitea/gitea/issues/17872
382+
- [Lunny Xiao](https://gitea.com/lunny) <[email protected]>
383+
- [Matti Ranta](https://gitea.com/techknowlogick) <[email protected]>
384+
- [Andrew Thornton](https://gitea.com/zeripath) <[email protected]>
375385

376-
* 2021-01-01 ~ 2021-12-31 - https://github.com/go-gitea/gitea/issues/13801
377-
* [Lunny Xiao](https://gitea.com/lunny) <[email protected]>
378-
* [Lauris Bukšis-Haberkorns](https://gitea.com/lafriks) <[email protected]>
379-
* [Matti Ranta](https://gitea.com/techknowlogick) <[email protected]>
386+
- 2021-01-01 ~ 2021-12-31 - https://github.com/go-gitea/gitea/issues/13801
387+
- [Lunny Xiao](https://gitea.com/lunny) <[email protected]>
388+
- [Lauris Bukšis-Haberkorns](https://gitea.com/lafriks) <[email protected]>
389+
- [Matti Ranta](https://gitea.com/techknowlogick) <[email protected]>
380390

381-
* 2020-01-01 ~ 2020-12-31 - https://github.com/go-gitea/gitea/issues/9230
382-
* [Lunny Xiao](https://gitea.com/lunny) <[email protected]>
383-
* [Lauris Bukšis-Haberkorns](https://gitea.com/lafriks) <[email protected]>
384-
* [Matti Ranta](https://gitea.com/techknowlogick) <[email protected]>
391+
- 2020-01-01 ~ 2020-12-31 - https://github.com/go-gitea/gitea/issues/9230
392+
- [Lunny Xiao](https://gitea.com/lunny) <[email protected]>
393+
- [Lauris Bukšis-Haberkorns](https://gitea.com/lafriks) <[email protected]>
394+
- [Matti Ranta](https://gitea.com/techknowlogick) <[email protected]>
385395

386-
* 2019-01-01 ~ 2019-12-31 - https://github.com/go-gitea/gitea/issues/5572
387-
* [Lunny Xiao](https://github.com/lunny) <[email protected]>
388-
* [Lauris Bukšis-Haberkorns](https://github.com/lafriks) <[email protected]>
389-
* [Matti Ranta](https://github.com/techknowlogick) <[email protected]>
396+
- 2019-01-01 ~ 2019-12-31 - https://github.com/go-gitea/gitea/issues/5572
397+
- [Lunny Xiao](https://github.com/lunny) <[email protected]>
398+
- [Lauris Bukšis-Haberkorns](https://github.com/lafriks) <[email protected]>
399+
- [Matti Ranta](https://github.com/techknowlogick) <[email protected]>
390400

391-
* 2018-01-01 ~ 2018-12-31 - https://github.com/go-gitea/gitea/issues/3255
392-
* [Lunny Xiao](https://github.com/lunny) <[email protected]>
393-
* [Lauris Bukšis-Haberkorns](https://github.com/lafriks) <[email protected]>
394-
* [Kim Carlbäcker](https://github.com/bkcsoft) <[email protected]>
401+
- 2018-01-01 ~ 2018-12-31 - https://github.com/go-gitea/gitea/issues/3255
402+
- [Lunny Xiao](https://github.com/lunny) <[email protected]>
403+
- [Lauris Bukšis-Haberkorns](https://github.com/lafriks) <[email protected]>
404+
- [Kim Carlbäcker](https://github.com/bkcsoft) <[email protected]>
395405

396-
* 2016-11-04 ~ 2017-12-31
397-
* [Lunny Xiao](https://github.com/lunny) <[email protected]>
398-
* [Thomas Boerger](https://github.com/tboerger) <[email protected]>
399-
* [Kim Carlbäcker](https://github.com/bkcsoft) <[email protected]>
406+
- 2016-11-04 ~ 2017-12-31
407+
- [Lunny Xiao](https://github.com/lunny) <[email protected]>
408+
- [Thomas Boerger](https://github.com/tboerger) <[email protected]>
409+
- [Kim Carlbäcker](https://github.com/bkcsoft) <[email protected]>
400410

401411
## Versions
402412

@@ -413,20 +423,20 @@ be reviewed by two maintainers and must pass the automatic tests.
413423

414424
## Releasing Gitea
415425

416-
* Let $vmaj, $vmin and $vpat be Major, Minor and Patch version numbers, $vpat should be rc1, rc2, 0, 1, ...... $vmaj.$vmin will be kept the same as milestones on github or gitea in future.
417-
* Before releasing, confirm all the version's milestone issues or PRs has been resolved. Then discuss the release on Discord channel #maintainers and get agreed with almost all the owners and mergers. Or you can declare the version and if nobody against in about serval hours.
418-
* If this is a big version first you have to create PR for changelog on branch `main` with PRs with label `changelog` and after it has been merged do following steps:
419-
* Create `-dev` tag as `git tag -s -F release.notes v$vmaj.$vmin.0-dev` and push the tag as `git push origin v$vmaj.$vmin.0-dev`.
420-
* When CI has finished building tag then you have to create a new branch named `release/v$vmaj.$vmin`
421-
* If it is bugfix version create PR for changelog on branch `release/v$vmaj.$vmin` and wait till it is reviewed and merged.
422-
* Add a tag as `git tag -s -F release.notes v$vmaj.$vmin.$`, release.notes file could be a temporary file to only include the changelog this version which you added to `CHANGELOG.md`.
423-
* And then push the tag as `git push origin v$vmaj.$vmin.$`. Drone CI will automatically create a release and upload all the compiled binary. (But currently it doesn't add the release notes automatically. Maybe we should fix that.)
424-
* If needed send a frontport PR for the changelog to branch `main` and update the version in `docs/config.yaml` to refer to the new version.
425-
* Send PR to [blog repository](https://gitea.com/gitea/blog) announcing the release.
426-
* Verify all release assets were correctly published through CI on dl.gitea.io and GitHub releases. Once ACKed:
427-
* bump the version of https://dl.gitea.io/gitea/version.json
428-
* merge the blog post PR
429-
* announce the release in discord `#announcements`
426+
- Let $vmaj, $vmin and $vpat be Major, Minor and Patch version numbers, $vpat should be rc1, rc2, 0, 1, ...... $vmaj.$vmin will be kept the same as milestones on github or gitea in future.
427+
- Before releasing, confirm all the version's milestone issues or PRs has been resolved. Then discuss the release on Discord channel #maintainers and get agreed with almost all the owners and mergers. Or you can declare the version and if nobody against in about serval hours.
428+
- If this is a big version first you have to create PR for changelog on branch `main` with PRs with label `changelog` and after it has been merged do following steps:
429+
- Create `-dev` tag as `git tag -s -F release.notes v$vmaj.$vmin.0-dev` and push the tag as `git push origin v$vmaj.$vmin.0-dev`.
430+
- When CI has finished building tag then you have to create a new branch named `release/v$vmaj.$vmin`
431+
- If it is bugfix version create PR for changelog on branch `release/v$vmaj.$vmin` and wait till it is reviewed and merged.
432+
- Add a tag as `git tag -s -F release.notes v$vmaj.$vmin.$`, release.notes file could be a temporary file to only include the changelog this version which you added to `CHANGELOG.md`.
433+
- And then push the tag as `git push origin v$vmaj.$vmin.$`. Drone CI will automatically create a release and upload all the compiled binary. (But currently it doesn't add the release notes automatically. Maybe we should fix that.)
434+
- If needed send a frontport PR for the changelog to branch `main` and update the version in `docs/config.yaml` to refer to the new version.
435+
- Send PR to [blog repository](https://gitea.com/gitea/blog) announcing the release.
436+
- Verify all release assets were correctly published through CI on dl.gitea.io and GitHub releases. Once ACKed:
437+
- bump the version of https://dl.gitea.io/gitea/version.json
438+
- merge the blog post PR
439+
- announce the release in discord `#announcements`
430440

431441
## Copyright
432442

Diff for: Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,7 @@ lint-frontend: node_modules
313313
npx eslint --color --max-warnings=0 --ext js,vue web_src/js build *.config.js docs/assets/js
314314
npx stylelint --color --max-warnings=0 web_src/less
315315
npx spectral lint -q -F hint $(SWAGGER_SPEC)
316+
npx markdownlint docs *.md
316317

317318
.PHONY: lint-backend
318319
lint-backend: golangci-lint vet editorconfig-checker

Diff for: README.md

+9-6
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ NOTES:
100100

101101
## Translating
102102

103-
Translations are done through Crowdin. If you want to translate to a new language ask one of the managers in the Crowdin project to add a new language there.
103+
Translations are done through Crowdin. If you want to translate to a new language ask one of the managers in the Crowdin project to add a new language there.
104104

105105
You can also just create an issue for adding a language or ask on discord on the #translation channel. If you need context or find some translation issues, you can leave a comment on the string or ask on Discord. For general translation questions there is a section in the docs. Currently a bit empty but we hope to fill it as questions pop up.
106106

@@ -113,15 +113,17 @@ https://docs.gitea.io/en-us/translation-guidelines/
113113
For more information and instructions about how to install Gitea, please look at our [documentation](https://docs.gitea.io/en-us/).
114114
If you have questions that are not covered by the documentation, you can get in contact with us on our [Discord server](https://discord.gg/Gitea) or create a post in the [discourse forum](https://discourse.gitea.io/).
115115

116-
We maintain a list of Gitea-related projects at [gitea/awesome-gitea](https://gitea.com/gitea/awesome-gitea).
117-
The Hugo-based documentation theme is hosted at [gitea/theme](https://gitea.com/gitea/theme).
116+
We maintain a list of Gitea-related projects at [gitea/awesome-gitea](https://gitea.com/gitea/awesome-gitea).
117+
118+
The Hugo-based documentation theme is hosted at [gitea/theme](https://gitea.com/gitea/theme).
119+
118120
The official Gitea CLI is developed at [gitea/tea](https://gitea.com/gitea/tea).
119121

120122
## Authors
121123

122-
* [Maintainers](https://github.com/orgs/go-gitea/people)
123-
* [Contributors](https://github.com/go-gitea/gitea/graphs/contributors)
124-
* [Translators](options/locale/TRANSLATORS)
124+
- [Maintainers](https://github.com/orgs/go-gitea/people)
125+
- [Contributors](https://github.com/go-gitea/gitea/graphs/contributors)
126+
- [Translators](options/locale/TRANSLATORS)
125127

126128
## Backers
127129

@@ -161,6 +163,7 @@ See the [LICENSE](https://github.com/go-gitea/gitea/blob/main/LICENSE) file
161163
for the full license text.
162164

163165
## Screenshots
166+
164167
Looking for an overview of the interface? Check it out!
165168

166169
|![Dashboard](https://dl.gitea.io/screenshots/home_timeline.png)|![User Profile](https://dl.gitea.io/screenshots/user_profile.png)|![Global Issues](https://dl.gitea.io/screenshots/global_issues.png)|

Diff for: SECURITY.md

+12-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Reporting security issues
22

3-
The Gitea maintainers take security seriously.
3+
The Gitea maintainers take security seriously.
4+
45
If you discover a security issue, please bring it to their attention right away!
56

67
## Reporting a Vulnerability
@@ -11,12 +12,16 @@ Please **DO NOT** file a public issue, instead send your report privately to `se
1112

1213
Due to the sensitive nature of security information, you can use below GPG public key encrypt your mail body.
1314

14-
The PGP key is valid until June 24, 2024.
15-
Key ID: 6FCD2D5B
16-
Key Type: RSA
17-
Expires: 6/24/2024
18-
Key Size: 4096/4096
19-
Fingerprint: 3DE0 3D1E 144A 7F06 9359 99DC AAFD 2381 6FCD 2D5B
15+
The PGP key is valid until June 24, 2024.
16+
17+
```
18+
Key ID: 6FCD2D5B
19+
Key Type: RSA
20+
Expires: 6/24/2024
21+
Key Size: 4096/4096
22+
Fingerprint: 3DE0 3D1E 144A 7F06 9359 99DC AAFD 2381 6FCD 2D5B
23+
```
24+
2025
UserID: Gitea Security <[email protected]>
2126

2227
```

Diff for: docs/content/doc/advanced/clone-filter.en-us.md

-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ see Git version of the server.
3030
By default, clone filters are enabled, unless `DISABLE_PARTIAL_CLONE` under
3131
`[git]` is set to `true`.
3232

33-
3433
See [GitHub blog post: Get up to speed with partial clone](https://github.blog/2020-12-21-get-up-to-speed-with-partial-clone-and-shallow-clone/)
3534
for common use cases of clone filters (blobless and treeless clones), and
3635
[GitLab docs for partial clone](https://docs.gitlab.com/ee/topics/git/partial_clone.html)

0 commit comments

Comments
 (0)