Skip to content

Commit 7c9f415

Browse files
authored
Add a workflow to check documentations (httpie#1151)
* Add a workflow to check documentations * Fix markdown issues * Install Ruby 2.7 * Finally, handle and fix GitHub templates * Minor improvement in the feature request template * Verbose mode to be sure all files are checked
1 parent 4c8633c commit 7c9f415

11 files changed

+130
-85
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

+17-7
Original file line numberDiff line numberDiff line change
@@ -7,34 +7,44 @@ assignees: ''
77

88
---
99

10-
**Checklist**
10+
## Checklist
1111

1212
- [ ] I've searched for similar issues.
1313
- [ ] I'm using the latest version of HTTPie.
1414

1515
---
1616

17-
**What are the steps to reproduce the problem?**
17+
## Minimal reproduction code and steps
1818

1919
1.
2020
2.
2121
3.
2222

23+
---
24+
25+
## Expected result
2326

24-
**What is the expected result?**
27+
28+
29+
---
2530

31+
## Current result
2632

27-
**What happens instead?**
33+
2834

35+
---
2936

30-
**Debug output**
37+
## Debug output
3138

3239
Please re-run the command with `--debug`, then copy the entire command & output and paste both below:
3340

34-
```
41+
```bash
3542
$ http --debug <COMPLETE ARGUMENT LIST THAT TRIGGERS THE ERROR>
3643
<COMPLETE OUTPUT>
3744
```
3845

46+
---
47+
48+
## Additional information, screenshots, or code examples
3949

40-
**Provide any additional information, screenshots, or code examples below:**
50+

.github/ISSUE_TEMPLATE/feature_request.md

+11-5
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,25 @@ labels: "new, enhancement"
66
assignees: ''
77

88
---
9-
**Checklist**
9+
10+
## Checklist
1011

1112
- [ ] I've searched for similar feature requests.
1213

1314
---
1415

15-
**What enhancement would you like to see?**
16+
## Enhancement request
17+
18+
1619

20+
---
1721

18-
**What problem does it solve?**
22+
## Problem it solves
1923

20-
E.g. “I'm always frustrated when [...]”, “I’m trying to do [] so that []”.
24+
E.g. “I'm always frustrated when []”, “I’m trying to do [] so that []”.
2125

26+
---
2227

23-
**Provide any additional information, screenshots, or code examples below:**
28+
## Additional information, screenshots, or code examples
2429

30+

.github/workflows/documentations.yml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Check documentations
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- "*.md"
7+
- "**/*.md"
8+
9+
jobs:
10+
doc:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v2
14+
- name: Setup Ruby
15+
uses: ruby/setup-ruby@v1
16+
with:
17+
ruby-version: 2.7
18+
- name: Install the linter
19+
run: sudo gem install mdl
20+
- name: Check files
21+
run: make doc-check

CODE_OF_CONDUCT.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ members of the project's leadership.
6868
## Attribution
6969

7070
This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org),
71-
version 1.4, available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
71+
version 1.4, available at <https://www.contributor-covenant.org/version/1/4/code-of-conduct.html>
7272

7373
For answers to common questions about this code of conduct, see
74-
https://www.contributor-covenant.org/faq
74+
<https://www.contributor-covenant.org/faq>

CONTRIBUTING.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Consider also adding a [CHANGELOG](https://github.com/httpie/httpie/blob/master/
4444

4545
#### Getting the code
4646

47-
Go to https://github.com/httpie/httpie and fork the project repository.
47+
Go to <https://github.com/httpie/httpie> and fork the project repository.
4848

4949
```bash
5050
# Clone your fork
@@ -89,7 +89,7 @@ a hack but it works™.)
8989
You should now see `(httpie)` next to your shell prompt, and
9090
the `http` command should point to your development copy:
9191

92-
```
92+
```bash
9393
(httpie) ~/Code/httpie $ which http
9494
/Users/<user>/Code/httpie/venv/bin/http
9595
(httpie) ~/Code/httpie $ http --version

Makefile

+5
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,11 @@ codecov-upload:
138138
@echo
139139

140140

141+
doc-check:
142+
@echo $(H1)Running documentations checks$(H1END)
143+
mdl --verbose --git-recurse --style docs/linter/mdl-styles.rb .
144+
145+
141146
###############################################################################
142147
# Publishing to PyPi
143148
###############################################################################

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -44,25 +44,25 @@ They use simple and natural syntax and provide formatted and colorized output.
4444

4545
Hello World:
4646

47-
```
47+
```bash
4848
$ https httpie.io/hello
4949
```
5050

5151
Custom [HTTP method](https://httpie.io/docs#http-method), [HTTP headers](https://httpie.io/docs#http-headers) and [JSON](https://httpie.io/docs#json) data:
5252

53-
```
53+
```bash
5454
$ http PUT pie.dev/put X-API-Token:123 name=John
5555
```
5656

5757
Build and print a request without sending it using [offline mode](https://httpie.io/docs#offline-mode):
5858

59-
```
59+
```bash
6060
$ http --offline pie.dev/post hello=offline
6161
```
6262

6363
Use [GitHub API](https://developer.github.com/v3/issues/comments/#create-a-comment) to post a comment on an [Issue](https://github.com/httpie/httpie/issues/83) with [authentication](https://httpie.io/docs#authentication):
6464

65-
```
65+
```bash
6666
$ http -a USERNAME POST https://api.github.com/repos/httpie/httpie/issues/83/comments body='HTTPie is awesome! :heart:'
6767
```
6868

docs/README.md

+29-29
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ $ apk add httpie
101101
$ eopkg install httpie
102102
```
103103

104-
### Windows, etc.
104+
### Windows, universal
105105

106106
A universal installation method (that works on Linux, macOS and Windows, and always provides the latest version) is to use [pip](https://pypi.org/project/pip/):
107107

@@ -1474,40 +1474,40 @@ To set a cookie within a Session there are three options:
14741474
14751475
1. Get a `Set-Cookie` header in a response from a server
14761476
1477-
```bash
1478-
$ http --session=./session.json pie.dev/cookie/set?foo=bar
1479-
```
1477+
```bash
1478+
$ http --session=./session.json pie.dev/cookie/set?foo=bar
1479+
```
14801480
14811481
2. Set the cookie name and value through the command line as seen in [cookies](#cookies)
14821482
1483-
```bash
1484-
$ http --session=./session.json pie.dev/headers Cookie:foo=bar
1485-
```
1483+
```bash
1484+
$ http --session=./session.json pie.dev/headers Cookie:foo=bar
1485+
```
14861486
14871487
3. Manually set cookie parameters in the JSON file of the session
14881488
1489-
```json
1490-
{
1491-
"__meta__": {
1492-
"about": "HTTPie session file",
1493-
"help": "https://httpie.org/doc#sessions",
1494-
"httpie": "2.2.0-dev"
1495-
},
1496-
"auth": {
1497-
"password": null,
1498-
"type": null,
1499-
"username": null
1500-
},
1501-
"cookies": {
1502-
"foo": {
1503-
"expires": null,
1504-
"path": "/",
1505-
"secure": false,
1506-
"value": "bar"
1507-
}
1508-
}
1509-
}
1510-
```
1489+
```json
1490+
{
1491+
"__meta__": {
1492+
"about": "HTTPie session file",
1493+
"help": "https://httpie.org/doc#sessions",
1494+
"httpie": "2.2.0-dev"
1495+
},
1496+
"auth": {
1497+
"password": null,
1498+
"type": null,
1499+
"username": null
1500+
},
1501+
"cookies": {
1502+
"foo": {
1503+
"expires": null,
1504+
"path": "/",
1505+
"secure": false,
1506+
"value": "bar"
1507+
}
1508+
}
1509+
}
1510+
```
15111511
15121512
Cookies will be set in the session file with the priority specified above.
15131513
For example, a cookie set through the command line will overwrite a cookie of the same name stored in the session file.

docs/linter/mdl-styles.rb

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Load all rules by default
2+
all
3+
4+
#
5+
# Tweak rules
6+
#
7+
8+
# MD002 First header should be a top level header
9+
# Because we use HTML to hide them on the website.
10+
exclude_rule 'MD002'
11+
12+
# MD013 Line length
13+
exclude_rule 'MD013'
14+
15+
# MD014 Dollar signs used before commands without showing output
16+
exclude_rule 'MD014'
17+
18+
# Tell the linter to use ordered lists:
19+
# 1. Foo
20+
# 2. Bar
21+
# 3. Baz
22+
#
23+
# Instead of:
24+
# 1. Foo
25+
# 1. Bar
26+
# 1. Baz
27+
rule 'MD029', :style => :ordered
28+
29+
# MD033 Inline HTML
30+
# TODO: Tweak elements when https://github.com/markdownlint/markdownlint/issues/118 will be done?
31+
exclude_rule 'MD033'
32+
33+
# MD034 Bare URL used
34+
# TODO: Remove when https://github.com/markdownlint/markdownlint/issues/328 will be fixed.
35+
exclude_rule 'MD034'
36+
37+
# MD041 First line in file should be a top level header
38+
# Because we use HTML to hide them on the website.
39+
exclude_rule 'MD041'

setup.py

-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
'flake8-deprecated',
2020
'flake8-mutable',
2121
'flake8-tuple',
22-
'mdformat',
2322
'pytest-cov',
2423
'twine',
2524
'wheel',

tests/test_docs.py

-35
This file was deleted.

0 commit comments

Comments
 (0)