Skip to content

Commit 96fe03f

Browse files
committed
feat: expand linted file types to markdown and shell
Signed-off-by: Vladislav Doster <[email protected]>
1 parent 704f4be commit 96fe03f

File tree

9 files changed

+732
-752
lines changed

9 files changed

+732
-752
lines changed

.github/workflows/linting.yaml

+28-37
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,38 @@
1-
name: 👮 linting
2-
on: [push, pull_request, workflow_dispatch]
1+
name: Lint
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
push:
8+
branches:
9+
- main
10+
workflow_dispatch:
11+
312
jobs:
4-
build-matrix:
13+
14+
lint:
15+
name: Lint
516
runs-on: ubuntu-latest
6-
outputs:
7-
matrix: ${{ steps.set-matrix.outputs.matrix }}
817
steps:
9-
- name: "📡 Check out repository code"
10-
uses: actions/checkout@v3
18+
- uses: actions/checkout@v3
1119

12-
- name: "💬 Set matrix output"
13-
id: set-matrix
20+
- name: install dependencies
1421
run: |
15-
MATRIX="$(find . -type d -name 'doc' -prune -o -type f -iname '*.zsh' -print | jq -ncR '{"include": [{"file": inputs}]}')"
16-
echo "MATRIX=${MATRIX}" >&2
17-
echo "::set-output name=matrix::${MATRIX}"
22+
brew install shellcheck shfmt zsh
23+
pip3 install --user linkify-it-py mdformat mdformat-config mdformat-gfm mdformat-shfmt mdformat-tables mdformat-toc
1824
19-
lint:
20-
runs-on: ubuntu-latest
21-
needs: build-matrix
22-
strategy:
23-
fail-fast: false
24-
matrix: ${{ fromJSON(needs.build-matrix.outputs.matrix) }}
25+
- name: run mdformat
26+
run: find . -name '*.md' -type f -print0 | xargs -0 -n1 -P4 python3 -m mdformat --check --wrap 120
2527

26-
steps:
27-
- name: "📡 Check out repository code"
28-
uses: actions/checkout@v3
28+
- name: run shfmt
29+
run: find . -name '*.sh' -type f -print0 | xargs -0 -n1 -P4 shfmt -bn -ci -d -i 2 -ln bash -s -sr
2930

30-
- name: "📦 Install dependencies"
31-
run: |
32-
sudo apt install -y zsh
31+
- name: run shellcheck
32+
run: find . -name '*.sh' -type f -print0 | xargs -0 -n1 -P4 shellcheck
3333

34-
- name: "👓 zsh -n ${{ matrix.file }}"
35-
env:
36-
ZSH_FILE: ${{ matrix.file }}
37-
run: |
38-
zsh -n "${ZSH_FILE}"
34+
- name: "run zsh"
35+
run: find . -name '*.zsh' -type f -print0 | xargs -0 -n1 -P4 zsh -n
3936

40-
- name: "💎 zcompile ${{ matrix.file }}"
41-
env:
42-
ZSH_FILE: ${{ matrix.file }}
43-
run: |
44-
zsh -fc "zcompile ${ZSH_FILE}"
45-
rc=$?
46-
ls -al "${ZSH_FILE}.zwc"
47-
exit "$rc"
37+
- name: "run zcompile"
38+
run: find . -name '*.zsh' -type f -exec zsh -fc "zcompile {}" \;

README.md

+216-229
Large diffs are not rendered by default.

doc/CHANGELOG.md

+365-340
Large diffs are not rendered by default.

doc/HACKING.md

+20-21
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,32 @@
33
## README: Update the table of content
44

55
1. Install [doctoc](https://github.com/thlorenz/doctoc)
6-
2. To update the TOC run the following command:
6+
1. To update the TOC run the following command:
77

88
```zsh
99
doctoc --github README.md
1010
```
1111

1212
## Update asciidoc and/or zshelldoc
1313

14-
1. Make sure you have [docker](https://www.docker.com/) or
15-
[podman](https://podman.io/) installed.
16-
2. From the root of the repo, run:
14+
1. Make sure you have [docker](https://www.docker.com/) or [podman](https://podman.io/) installed.
15+
1. From the root of the repo, run:
1716

1817
```zsh
1918
make doc-container
2019
```
2120

22-
If for some reason you want to build the zshelldocs or the PDF manually, you'll
23-
need:
21+
If for some reason you want to build the zshelldocs or the PDF manually, you'll need:
2422

2523
1. Patience, zsd is very finicky about locales. You have been warned.
26-
2. [zshelldoc (zsd)](https://github.com/zdharma-continuum/zshelldoc)
27-
3. [asciidoc](https://asciidoc.org/)
28-
4. `make doc`
24+
1. [zshelldoc (zsd)](https://github.com/zdharma-continuum/zshelldoc)
25+
1. [asciidoc](https://asciidoc.org/)
26+
1. `make doc`
2927

3028
## Generate the manpage (doc/zinit.1)
3129

3230
1. Install [pandoc](https://pandoc.org/)
33-
2. From the root of the repo run:
31+
1. From the root of the repo run:
3432

3533
```zsh
3634
pandoc --standalone --to man README.md -o doc/zinit.1
@@ -39,17 +37,18 @@ pandoc --standalone --to man README.md -o doc/zinit.1
3937
## Updating the gh-pages (zdharma-continuum.github.io)
4038

4139
1. Check out the [documentation branch](https://github.com/zdharma-continuum/zinit/tree/documentation)
40+
4241
```shell
4342
git fetch origin documentation
4443
git checkout documentation
4544
```
46-
2. Do your modifications and push your changes
47-
3. Keep an eye on [the CI logs](https://github.com/zdharma-continuum/zinit/actions/workflows/gh-pages.yaml)
48-
4. If all went well you can head to https://zdharma-continuum.github.io/ to see your changes live.
4945

50-
**NOTE:** If you really **need** to push directly, without CI please refer to
51-
[the README in the documentation]https://github.com/zdharma-continuum/zinit/blob/documentation/README.md
46+
2. Do your modifications and push your changes
47+
1. Keep an eye on [the CI logs](https://github.com/zdharma-continuum/zinit/actions/workflows/gh-pages.yaml)
48+
1. If all went well you can head to https://zdharma-continuum.github.io/ to see your changes live.
5249

50+
**NOTE:** If you really **need** to push directly, without CI please refer to \[the README in the
51+
documentation\]https://github.com/zdharma-continuum/zinit/blob/documentation/README.md
5352

5453
# Testing
5554

@@ -115,13 +114,12 @@ zunit --verbose tests/your_test.zunit
115114

116115
## Debugging tests
117116

118-
If you ever need to inspect the `ZINIT[HOME_DIR]` dir, where zinit's internal
119-
data is stored you can do so by commenting out the `@teardown` section in your
120-
test. Then you can re-run said test and head over to
121-
`${TMPDIR:-/tmp}/zunit-zinit`. Good luck!
122-
117+
If you ever need to inspect the `ZINIT[HOME_DIR]` dir, where zinit's internal data is stored you can do so by commenting
118+
out the `@teardown` section in your test. Then you can re-run said test and head over to `${TMPDIR:-/tmp}/zunit-zinit`.
119+
Good luck!
123120

124121
# Misc
122+
125123
## Get the list of supported ices
126124

127125
To get the list in a quick-and-dirty fashion you issue:
@@ -130,5 +128,6 @@ To get the list in a quick-and-dirty fashion you issue:
130128
zinit --help | tail -1
131129
```
132130

133-
See [zinit-autoload.zsh](https://github.com/zdharma-continuum/zinit/blob/2feb41cf70d2f782386bbaa6fda691e3bdc7f1ac/zinit-autoload.zsh#L3445-L3447)
131+
See
132+
[zinit-autoload.zsh](https://github.com/zdharma-continuum/zinit/blob/2feb41cf70d2f782386bbaa6fda691e3bdc7f1ac/zinit-autoload.zsh#L3445-L3447)
134133
for implementation details.

doc/zsdoc/README.md

+15-11
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,22 @@
11
# Code documentation
22

3-
Here is `Asciidoc` code documentation generated using [Zshelldoc](https://github.com/zdharma-continuum/zshelldoc).
4-
There are `4` Zinit's source files, the main one is [zinit.zsh](zinit.zsh.adoc). The documentation
5-
lists all functions, interactions between them, their comments and features used.
3+
Here is `Asciidoc` code documentation generated using [Zshelldoc](https://github.com/zdharma-continuum/zshelldoc). There
4+
are `4` Zinit's source files, the main one is [zinit.zsh](zinit.zsh.adoc). The documentation lists all functions,
5+
interactions between them, their comments and features used.
66

77
Github allows to directly view `Asciidoc` documents:
8-
* [zinit.zsh](zinit.zsh.adoc) – always loaded, in `.zshrc` ([pdf](https://zdharma-continuum.github.io/zinit/wiki/zinit.zsh))
9-
* [zinit-side.zsh](zinit-side.zsh.adoc) – common functions, loaded by `*-install` and `*-autoload` scripts ([pdf](https://zdharma-continuum.github.io/zinit/wiki/zinit-side.zsh))
10-
* [zinit-install.zsh](zinit-install.zsh.adoc) – functions used only when installing a plugin or snippet ([pdf](https://zdharma-continuum.github.io/zinit/wiki/zinit-install.zsh))
11-
* [zinit-autoload.zsh](zinit-autoload.zsh.adoc) – functions used only in interactive `Zinit` invocations ([pdf](https://zdharma-continuum.github.io/zinit/wiki/zinit-autoload.zsh/))
8+
9+
- [zinit.zsh](zinit.zsh.adoc) – always loaded, in `.zshrc`
10+
([pdf](https://zdharma-continuum.github.io/zinit/wiki/zinit.zsh))
11+
- [zinit-side.zsh](zinit-side.zsh.adoc) – common functions, loaded by `*-install` and `*-autoload` scripts
12+
([pdf](https://zdharma-continuum.github.io/zinit/wiki/zinit-side.zsh))
13+
- [zinit-install.zsh](zinit-install.zsh.adoc) – functions used only when installing a plugin or snippet
14+
([pdf](https://zdharma-continuum.github.io/zinit/wiki/zinit-install.zsh))
15+
- [zinit-autoload.zsh](zinit-autoload.zsh.adoc) – functions used only in interactive `Zinit` invocations
16+
([pdf](https://zdharma-continuum.github.io/zinit/wiki/zinit-autoload.zsh/))
1217

1318
# PDFs, man pages, etc.
1419

15-
Formats other than `Asciidoc` can be produced by using provided Makefile. For example, issuing
16-
`make pdf` will create and populate a new directory `pdf` (requires `asciidoctor`, install with
17-
`gem install asciidoctor-pdf --pre`). `make man` will create man pages (requires package `asciidoc`,
18-
uses its command `a2x`, which is quite slow).
20+
Formats other than `Asciidoc` can be produced by using provided Makefile. For example, issuing `make pdf` will create
21+
and populate a new directory `pdf` (requires `asciidoctor`, install with `gem install asciidoctor-pdf --pre`).
22+
`make man` will create man pages (requires package `asciidoc`, uses its command `a2x`, which is quite slow).

scripts/docker-build.sh

+12-13
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
#!/usr/bin/env bash
22

33
build() {
4-
cd "$(cd "$(dirname "$0")" >/dev/null 2>&1; pwd -P)" || exit 9
4+
cd "$(
5+
cd "$(dirname "$0")" > /dev/null 2>&1
6+
pwd -P
7+
)" || exit 9
58

69
local image_name="${1:-zinit}"
710
local tag="${2:-latest}"
@@ -10,15 +13,14 @@ build() {
1013

1114
local dockerfile="../docker/Dockerfile"
1215

13-
if [[ -n "$zsh_version" ]]
14-
then
16+
if [[ -n $zsh_version ]]; then
1517
tag="zsh${zsh_version}-${tag}"
1618
fi
1719

1820
echo -e "\e[34mBuilding image: ${image_name}\e[0m" >&2
1921

2022
local -a args
21-
[[ -n "$NO_CACHE" ]] && args+=(--no-cache "$@")
23+
[[ -n $NO_CACHE ]] && args+=(--no-cache "$@")
2224

2325
if docker build \
2426
--build-arg "PUSERNAME=$(id -u -n)" \
@@ -29,8 +31,7 @@ build() {
2931
--file "$dockerfile" \
3032
--tag "${image_name}:${tag}" \
3133
"${args[@]}" \
32-
"$(realpath ..)"
33-
then
34+
"$(realpath ..)"; then
3435
{
3536
echo -e "\e[34mTo use this image for zunit tests run: \e[0m"
3637
echo -e "\e[34mexport CONTAINER_IMAGE=\"${image_name}\" CONTAINER_TAG=\"${tag}\"\e[0m"
@@ -42,25 +43,23 @@ build() {
4243
fi
4344
}
4445

45-
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]
46-
then
46+
if [[ ${BASH_SOURCE[0]} == "${0}" ]]; then
4747
BUILD_ZSH_VERSION="${BUILD_ZSH_VERSION:-}"
4848
CONTAINER_IMAGE="${CONTAINER_IMAGE:-ghcr.io/zdharma-continuum/zinit}"
4949
CONTAINER_TAG="${CONTAINER_TAG:-latest}"
5050
NO_CACHE="${NO_CACHE:-}"
5151

52-
while [[ -n "$*" ]]
53-
do
52+
while [[ -n $* ]]; do
5453
case "$1" in
55-
--image|-i)
54+
--image | -i)
5655
CONTAINER_IMAGE="$2"
5756
shift 2
5857
;;
59-
--no-cache|-N)
58+
--no-cache | -N)
6059
NO_CACHE=1
6160
shift
6261
;;
63-
--zsh-version|-zv|--zv)
62+
--zsh-version | -zv | --zv)
6463
BUILD_ZSH_VERSION="${2}"
6564
shift 2
6665
;;

0 commit comments

Comments
 (0)