1
0
mirror of https://github.com/httpie/cli.git synced 2025-07-13 01:30:54 +02:00

Add a workflow to check documentations (#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
This commit is contained in:
Mickaël Schoentgen
2021-09-09 15:52:24 +02:00
committed by GitHub
parent 4c8633c6e5
commit 7c9f415107
11 changed files with 130 additions and 85 deletions

View File

@ -7,34 +7,44 @@ assignees: ''
--- ---
**Checklist** ## Checklist
- [ ] I've searched for similar issues. - [ ] I've searched for similar issues.
- [ ] I'm using the latest version of HTTPie. - [ ] I'm using the latest version of HTTPie.
--- ---
**What are the steps to reproduce the problem?** ## Minimal reproduction code and steps
1. 1.
2. 2.
3. 3.
---
**What is the expected result?** ## Expected result
**What happens instead?** ---
## Current result
**Debug output**
---
## Debug output
Please re-run the command with `--debug`, then copy the entire command & output and paste both below: Please re-run the command with `--debug`, then copy the entire command & output and paste both below:
``` ```bash
$ http --debug <COMPLETE ARGUMENT LIST THAT TRIGGERS THE ERROR> $ http --debug <COMPLETE ARGUMENT LIST THAT TRIGGERS THE ERROR>
<COMPLETE OUTPUT> <COMPLETE OUTPUT>
``` ```
---
**Provide any additional information, screenshots, or code examples below:** ## Additional information, screenshots, or code examples

View File

@ -6,19 +6,25 @@ labels: "new, enhancement"
assignees: '' assignees: ''
--- ---
**Checklist**
## Checklist
- [ ] I've searched for similar feature requests. - [ ] I've searched for similar feature requests.
--- ---
**What enhancement would you like to see?** ## Enhancement request
**What problem does it solve?** ---
E.g. “I'm always frustrated when [...]”, “I’m trying to do […] so that […]”. ## Problem it solves
E.g. “I'm always frustrated when […]”, “I’m trying to do […] so that […]”.
**Provide any additional information, screenshots, or code examples below:** ---
## Additional information, screenshots, or code examples

21
.github/workflows/documentations.yml vendored Normal file
View File

@ -0,0 +1,21 @@
name: Check documentations
on:
pull_request:
paths:
- "*.md"
- "**/*.md"
jobs:
doc:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
- name: Install the linter
run: sudo gem install mdl
- name: Check files
run: make doc-check

View File

@ -68,7 +68,7 @@ members of the project's leadership.
## Attribution ## Attribution
This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org), This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org),
version 1.4, available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html version 1.4, available at <https://www.contributor-covenant.org/version/1/4/code-of-conduct.html>
For answers to common questions about this code of conduct, see For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq <https://www.contributor-covenant.org/faq>

View File

@ -44,7 +44,7 @@ Consider also adding a [CHANGELOG](https://github.com/httpie/httpie/blob/master/
#### Getting the code #### Getting the code
Go to https://github.com/httpie/httpie and fork the project repository. Go to <https://github.com/httpie/httpie> and fork the project repository.
```bash ```bash
# Clone your fork # Clone your fork
@ -89,7 +89,7 @@ a hack but it works™.)
You should now see `(httpie)` next to your shell prompt, and You should now see `(httpie)` next to your shell prompt, and
the `http` command should point to your development copy: the `http` command should point to your development copy:
``` ```bash
(httpie) ~/Code/httpie $ which http (httpie) ~/Code/httpie $ which http
/Users/<user>/Code/httpie/venv/bin/http /Users/<user>/Code/httpie/venv/bin/http
(httpie) ~/Code/httpie $ http --version (httpie) ~/Code/httpie $ http --version

View File

@ -138,6 +138,11 @@ codecov-upload:
@echo @echo
doc-check:
@echo $(H1)Running documentations checks$(H1END)
mdl --verbose --git-recurse --style docs/linter/mdl-styles.rb .
############################################################################### ###############################################################################
# Publishing to PyPi # Publishing to PyPi
############################################################################### ###############################################################################

View File

@ -44,25 +44,25 @@ They use simple and natural syntax and provide formatted and colorized output.
Hello World: Hello World:
``` ```bash
$ https httpie.io/hello $ https httpie.io/hello
``` ```
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: 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:
``` ```bash
$ http PUT pie.dev/put X-API-Token:123 name=John $ http PUT pie.dev/put X-API-Token:123 name=John
``` ```
Build and print a request without sending it using [offline mode](https://httpie.io/docs#offline-mode): Build and print a request without sending it using [offline mode](https://httpie.io/docs#offline-mode):
``` ```bash
$ http --offline pie.dev/post hello=offline $ http --offline pie.dev/post hello=offline
``` ```
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): 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):
``` ```bash
$ http -a USERNAME POST https://api.github.com/repos/httpie/httpie/issues/83/comments body='HTTPie is awesome! :heart:' $ http -a USERNAME POST https://api.github.com/repos/httpie/httpie/issues/83/comments body='HTTPie is awesome! :heart:'
``` ```

View File

@ -101,7 +101,7 @@ $ apk add httpie
$ eopkg install httpie $ eopkg install httpie
``` ```
### Windows, etc. ### Windows, universal
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/): 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/):
@ -1474,20 +1474,20 @@ To set a cookie within a Session there are three options:
}, },
"cookies": { "cookies": {
"foo": { "foo": {
"expires": null, "expires": null,
"path": "/", "path": "/",
"secure": false, "secure": false,
"value": "bar" "value": "bar"
} }
} }
} }
``` ```
Cookies will be set in the session file with the priority specified above. Cookies will be set in the session file with the priority specified above.
For example, a cookie set through the command line will overwrite a cookie of the same name stored in the session file. For example, a cookie set through the command line will overwrite a cookie of the same name stored in the session file.
If the server returns a `Set-Cookie` header with a cookie of the same name, the returned cookie will overwrite the preexisting cookie. If the server returns a `Set-Cookie` header with a cookie of the same name, the returned cookie will overwrite the preexisting cookie.
Expired cookies are never stored. Expired cookies are never stored.
If a cookie in a session file expires, it will be removed before sending a new request. If a cookie in a session file expires, it will be removed before sending a new request.
If the server expires an existing cookie, it will also be removed from the session file. If the server expires an existing cookie, it will also be removed from the session file.
@ -1506,8 +1506,8 @@ $ http --session=./session.json pie.dev/headers Cookie:foo=bar
On Windows, the config file is located at `%APPDATA%\httpie\config.json`. On Windows, the config file is located at `%APPDATA%\httpie\config.json`.
The config directory can be changed by setting the `$HTTPIE_CONFIG_DIR` environment variable: The config directory can be changed by setting the `$HTTPIE_CONFIG_DIR` environment variable:
```bash ```bash
$ export HTTPIE_CONFIG_DIR=/tmp/httpie $ export HTTPIE_CONFIG_DIR=/tmp/httpie
$ http pie.dev/get $ http pie.dev/get

39
docs/linter/mdl-styles.rb Normal file
View File

@ -0,0 +1,39 @@
# Load all rules by default
all
#
# Tweak rules
#
# MD002 First header should be a top level header
# Because we use HTML to hide them on the website.
exclude_rule 'MD002'
# MD013 Line length
exclude_rule 'MD013'
# MD014 Dollar signs used before commands without showing output
exclude_rule 'MD014'
# Tell the linter to use ordered lists:
# 1. Foo
# 2. Bar
# 3. Baz
#
# Instead of:
# 1. Foo
# 1. Bar
# 1. Baz
rule 'MD029', :style => :ordered
# MD033 Inline HTML
# TODO: Tweak elements when https://github.com/markdownlint/markdownlint/issues/118 will be done?
exclude_rule 'MD033'
# MD034 Bare URL used
# TODO: Remove when https://github.com/markdownlint/markdownlint/issues/328 will be fixed.
exclude_rule 'MD034'
# MD041 First line in file should be a top level header
# Because we use HTML to hide them on the website.
exclude_rule 'MD041'

View File

@ -19,7 +19,6 @@ dev_require = [
'flake8-deprecated', 'flake8-deprecated',
'flake8-mutable', 'flake8-mutable',
'flake8-tuple', 'flake8-tuple',
'mdformat',
'pytest-cov', 'pytest-cov',
'twine', 'twine',
'wheel', 'wheel',

View File

@ -1,35 +0,0 @@
import os
import pytest
from httpie.compat import is_windows
from .utils import TESTS_ROOT
ROOT = TESTS_ROOT.parent
SOURCE_DIRECTORIES = [
'docs',
'extras',
'httpie',
'tests',
]
def md_filenames():
yield from ROOT.glob('*.md')
for directory in SOURCE_DIRECTORIES:
yield from (ROOT / directory).glob('**/*.md')
filenames = sorted(md_filenames())
assert filenames
@pytest.mark.skipif(is_windows and 'CI' in os.environ,
reason='Does not pass on GitHub.')
@pytest.mark.parametrize('filename', filenames)
def test_md_file_syntax(filename):
mdformat = pytest.importorskip('mdformat._cli')
args = ['--end-of-line', 'lf', '--number']
err = f'Running "python -m mdformat {" ".join(args)} {filename}; git diff" should help.'
assert mdformat.run(args + ['--check', str(filename)]) == 0, err