Skip to content

Commit c3b622c

Browse files
Add markdown linting (#2284)
* fix docs * add markdown action * use different action * change linter * add checkout * change globs * change wildcard * Aktualisieren von markdown_v3.yml * fix ignore * comment ignore * change version * use master * new action used for linting * Fix config * Remove ignore * Ignore docstring dir * ignore GitHub * Aktualisieren von markdown_v3.yml * use dot true * Aktualisieren von markdown_v3.yml * Use new action * Fix continue-on-error * Remove unnecessary code * Add markdownlint config * Rename . markdownlint-cli2.yaml to .markdownlint-cli2.yaml * Use config file * Simplify globs * Use globs and ignore in config file * Ignore $ errors * Ignore src and .github * Use only config file * Fix general glob * Ignore inline html * Disable MD010 * Fix language * dont warn trailing punctuation * fix warnings * fix a warning * reduce ignore * fix warnings * fail check, if markdownlint fails * add runner script and hook * Update documentation/builders/components/power/onoff-shim.md Co-authored-by: Alvin Schiller <[email protected]> * Update playlists-livestreams-podcasts.md * add documentation for documentation with md * get rid of docker * fix comments * incorporate comments * Update documentation/developers/documentation.md Co-authored-by: Alvin Schiller <[email protected]> * check, if cmd does not exisr --------- Co-authored-by: Alvin Schiller <[email protected]>
1 parent 2b5ef6e commit c3b622c

29 files changed

+492
-93
lines changed

.githooks/pre-commit

+17
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
# Note: This only checks the modified files
1010
# - docs build of if any python file is staged
1111
# Note: This builds the entire documentation if a changed file goes into the documentation
12+
# - Markdownlint if any markdown file is staged
13+
# Note: This checks all markdown files as configured in .markdownlint-cli2.yaml
14+
1215
#
1316
# If there are problem with this script, commit may still be done with
1417
# git commit --no-verify
@@ -40,6 +43,20 @@ fi
4043

4144
code=$(( flake8_code + doc_code ))
4245

46+
# Pass all staged markdown files through markdownlint-cli2
47+
MD_FILES="$(git diff --diff-filter=d --staged --name-only -- **/*.md)"
48+
markdownlint_code=0
49+
if [[ -n $MD_FILES ]]; then
50+
echo -e "\n**************************************************************"
51+
echo "Modified Markdown files. Running markdownlint-cli2 ... "
52+
echo -e "**************************************************************\n"
53+
./run_markdownlint.sh
54+
markdownlint_code=$?
55+
echo "Markdownlint-cli2 return code: $markdownlint_code"
56+
fi
57+
58+
code=$(( flake8_code + doc_code + markdownlint_code))
59+
4360
if [[ code -gt 0 ]]; then
4461
echo -e "\n**************************************************************"
4562
echo -e "ERROR(s) during pre-commit checks. Aborting commit!"

.github/ISSUE_TEMPLATE/bug_template.md

-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ Please post here the output of 'tail -n 500 /var/log/syslog' or 'journalctl -u m
3333
i.e. `find logfiles at https://paste.ubuntu.com/p/cRS7qM8ZmP/`
3434
-->
3535

36-
3736
## Software
3837

3938
### Base image and version
@@ -59,7 +58,6 @@ the following command will help with that
5958
i.e. `scripts/installscripts/buster-install-default.sh`
6059
-->
6160

62-
6361
## Hardware
6462

6563
### RaspberryPi version

.github/workflows/markdown_v3.yml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Markdown Linting
2+
3+
on:
4+
push:
5+
branches:
6+
- 'future3/**'
7+
paths:
8+
- '**.md'
9+
pull_request:
10+
branches:
11+
- 'future3/**'
12+
paths:
13+
- '**.md'
14+
15+
jobs:
16+
build:
17+
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v4
23+
24+
- name: Linting markdown
25+
uses: DavidAnson/markdownlint-cli2-action@v15
26+
with:
27+
config: .markdownlint-cli2.yaml
28+
#continue-on-error: true

.markdownlint-cli2.yaml

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#
2+
# markdownlint-cli2 configuration, see https://github.com/DavidAnson/markdownlint-cli2?tab=readme-ov-file#configuration
3+
#
4+
5+
# rules, see https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md
6+
config:
7+
line-length: false
8+
# ignore dollar signs
9+
commands-show-output: false
10+
no-trailing-punctuation: false
11+
12+
# Include a custom rule package
13+
#customRules:
14+
# - markdownlint-rule-titlecase
15+
16+
# Fix no fixable errors
17+
fix: false
18+
19+
# Define a custom front matter pattern
20+
#frontMatter: "<head>[^]*<\/head>"
21+
22+
# Define glob expressions to use (only valid at root)
23+
globs:
24+
- "**.md"
25+
26+
# Define glob expressions to ignore
27+
ignores:
28+
- "documentation/developers/docstring/*"
29+
- "src/**"
30+
31+
# Use a plugin to recognize math
32+
#markdownItPlugins:
33+
# -
34+
# - "@iktakahiro/markdown-it-katex"
35+
36+
# Additional paths to resolve module locations from
37+
#modulePaths:
38+
# - "./modules"
39+
40+
# Enable inline config comments
41+
noInlineConfig: false
42+
43+
# Disable progress on stdout (only valid at root)
44+
noProgress: true
45+
46+
# Use a specific formatter (only valid at root)
47+
#outputFormatters:
48+
# -
49+
# - markdownlint-cli2-formatter-default
50+
51+
# Show found files on stdout (only valid at root)
52+
showFound: true

CODE_OF_CONDUCT.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1+
# Contributor Covenant Code of Conduct
12

2-
Dear Phonieboxians,
3-
4-
As the Phoniebox community is growing, somebody suggested a pull request with the below document. I was hesitant to include it right away, but at the same time I thought: it might be good to have some kind of document to formulate the foundation this project is built on. To tell you the truth, this document is not it. However, it is a start and I thought: why not open this in the spirit of open source, sharing and pull requests and see if and how you or you or you want to change or add parts of this very *standard and corporate* document. Like most of you, I also have a small kid and my time is scarce, I might find some time though to add a bit.
5-
6-
All the best, Micz
3+
> [!NOTE]
4+
> Dear Phonieboxians,
5+
>
6+
> As the Phoniebox community is growing, somebody suggested a pull request with the below document. I was hesitant to include it right away, but at the same time I thought: it might be good to have some kind of document to formulate the foundation this project is built on. To tell you the truth, this document is not it. However, it is a start and I thought: why not open this in the spirit of open source, sharing and pull requests and see if and how you or you or you want to change or add parts of this very *standard and corporate* document. Like most of you, I also have a small kid and my time is scarce, I might find some time though to add a bit.
7+
>
8+
> All the best, Micz
79
810
2018-08-21
911

10-
# Contributor Covenant Code of Conduct
11-
1212
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
1313

1414
## Our Pledge

CONTRIBUTING.md

+8-7
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,16 @@ as local, temporary scratch areas.
4545

4646
Contributors have played a bigger role over time to keep Phoniebox on the edge of innovation :)
4747

48-
Our goal is to make it simple for you to contribute changes that improve functionality in your specific environment.
49-
To achieve this, we have a set of guidelines that we kindly request contributors to adhere to.
48+
Our goal is to make it simple for you to contribute changes that improve functionality in your specific environment.
49+
To achieve this, we have a set of guidelines that we kindly request contributors to adhere to.
5050
These guidelines help us maintain a streamlined process and stay on top of incoming contributions.
5151

5252
To report bug fixes and improvements, please follow the steps outlined below:
53+
5354
1. For bug fixes and minor improvements, simply open a new issue or pull request (PR).
5455
2. If you intend to port a feature from Version 2.x to future3 or wish to implement a new feature, we recommend reaching out to us beforehand.
55-
- In such cases, please create an issue outlining your plans and intentions.
56-
- We will ensure that there are no ongoing efforts on the same topic.
56+
* In such cases, please create an issue outlining your plans and intentions.
57+
* We will ensure that there are no ongoing efforts on the same topic.
5758

5859
We eagerly await your contributions! You can review the current [feature list](documentation/developers/status.md) to check for available features and ongoing work.
5960

@@ -108,7 +109,7 @@ Run the checks below on the code. Fix those issues! Or you are running in delays
108109
We provide git hooks for those checks for convenience. To activate
109110

110111
~~~bash
111-
cp .githooks/pre-commit` .git/hooks/.
112+
cp .githooks/pre-commit .git/hooks/.
112113
~~~
113114

114115
### Python Code
@@ -152,7 +153,7 @@ to detect in advance.
152153

153154
If the code change results in a test failure, we will make our best effort to
154155
correct the error. If a fix cannot be determined and committed within 24 hours
155-
of its discovery, the commit(s) responsible _may_ be reverted, at the
156+
of its discovery, the commit(s) responsible *may* be reverted, at the
156157
discretion of the committer and Phonie maintainers.
157158
The original contributor will be notified of the revert.
158159

@@ -163,7 +164,7 @@ The original contributor will be notified of the revert.
163164

164165
## Guidelines
165166

166-
* Phoniebox runs on Raspberry Pi OS.
167+
* Phoniebox runs on Raspberry Pi OS.
167168
* Minimum python version is currently **Python 3.9**.
168169

169170
## Additional Resources

documentation/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ project check out the [documentation of Version 2](https://github.com/MiczFlor/R
4242
Version 3 has reached a mature state and will soon be the default version.
4343
However, some features may still be missing. Please check the [Feature Status](./developers/status.md), if YOUR feature is already implemented.
4444

45-
> [!NOTE]
45+
> [!NOTE]
4646
> If version 3 has all the features you need, we recommend using Version 3.
4747
4848
If there is a feature missing, please open an issue.

documentation/builders/audio.md

+3
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ to setup the configuration for the Jukebox Core App.
2424

2525
Run the following steps in a console:
2626

27+
<!-- markdownlint-disable MD010 -->
2728
```bash
2829
# Check available PulseAudio sinks
2930
$ pactl list sinks short
@@ -45,6 +46,7 @@ $ paplay /usr/share/sounds/alsa/Front_Center.wav
4546
# This must also work when using an ALSA device
4647
$ aplay /usr/share/sounds/alsa/Front_Center.wav
4748
```
49+
<!-- markdownlint-restore -->
4850

4951
You can also try different PulseAudio sinks without setting the default sink. In this case the volume is the last used
5052
volume level for this sink:
@@ -86,6 +88,7 @@ Pairing successful
8688
....
8789
[PowerLocus Buddy]# exit
8890
```
91+
8992
If `bluetoothctl` has trouble to execute due to permission issue, try `sudo bluetoothctl`.
9093

9194
Wait for a few seconds and then with `$ pactl list sinks short`, check wether the Bluetooth device shows up as an output.

documentation/builders/autohotspot.md

+9-6
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@ The Auto-Hotspot function enables the Jukebox to switch its connection between a
77
88
## How to connect
99

10-
When the Jukebox cannot connect to a known WiFi, it will automatically create a hotspot.
10+
When the Jukebox cannot connect to a known WiFi, it will automatically create a hotspot.
1111
You can connect to this hotspot using the password set during installation.
1212
Afterwards, you can access the Web App or connect via SSH as before, using the IP from the configuration.
1313

1414
The default configuration is
15+
1516
``` text
1617
* SSID : Phoniebox_Hotspot_<hostname>
1718
* Password : PlayItLoud!
@@ -23,8 +24,7 @@ The default configuration is
2324

2425
Auto-Hotspot can be enabled or disabled using the Web App or RPC Commands.
2526

26-
> [!NOTE]
27-
> Disabling the Auto-Hotspot will run the WiFi check again and maintain the last connection state until reboot.
27+
Disabling the Auto-Hotspot will run the WiFi check again and maintain the last connection state until reboot.
2828

2929
> [!IMPORTANT]
3030
> If you disable this feature, you will lose access to the Jukebox if you are not near a known WiFi after reboot!
@@ -34,11 +34,13 @@ Auto-Hotspot can be enabled or disabled using the Web App or RPC Commands.
3434
### AutoHotspot functionality is not working
3535

3636
Check the `autohotspot.service` status
37+
3738
``` bash
3839
sudo systemctl status autohotspot.service
3940
```
4041

4142
and logs
43+
4244
``` bash
4345
sudo journalctl -u autohotspot.service -n 50
4446
```
@@ -52,12 +54,13 @@ Check your WiFi configuration.
5254
### You need to add a new WiFi network to the Raspberry Pi
5355

5456
#### Using the command line
57+
5558
Connect to the hotspot and open a terminal. Use the [raspi-config](https://www.raspberrypi.com/documentation/computers/configuration.html#wireless-lan) tool to add the new WiFi.
5659

5760
## Resources
5861

5962
* [Raspberry Connect - Auto WiFi Hotspot Switch](https://www.raspberryconnect.com/projects/65-raspberrypi-hotspot-accesspoints/158-raspberry-pi-auto-wifi-hotspot-switch-direct-connection)
6063
* [Raspberry Pi - Configuring networking](https://www.raspberrypi.com/documentation/computers/configuration.html#using-the-command-line)
61-
* [dhcpcd / wpa_supplicant]()
62-
* [hostapd](http://w1.fi/hostapd/)
63-
* [dnsmasq](https://thekelleys.org.uk/dnsmasq/doc.html)
64+
* dhcpcd / wpa_supplicant
65+
* [hostapd](http://w1.fi/hostapd/)
66+
* [dnsmasq](https://thekelleys.org.uk/dnsmasq/doc.html)

documentation/builders/components/power/onoff-shim.md

+3-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ To install the software, open a terminal and type the following command to run t
99
> [!NOTE]
1010
> The installation will ask you a few questions. You can safely answer with the default response.
1111
12-
```
12+
```bash
1313
curl https://get.pimoroni.com/onoffshim | bash
1414
```
1515

@@ -28,9 +28,8 @@ The OnOff SHIM comes with a 12-PIN header which needs soldering. If you want to
2828
| GPLCLK0 | 7 | 7 | GPIO4 |
2929
| GPIO17 | 11 | 11 | GPIO17 |
3030

31-
* More information can be found here: https://pinout.xyz/pinout/onoff_shim
31+
* More information can be found here: <https://pinout.xyz/pinout/onoff_shim>
3232

3333
## Assembly options
3434

35-
![](https://cdn.review-images.pimoroni.com/upload-b6276a310ccfbeae93a2d13ec19ab83b-1617096824.jpg?width=640)
36-
35+
![OnOffShim soldered on a Raspberry Pi](https://cdn.review-images.pimoroni.com/upload-b6276a310ccfbeae93a2d13ec19ab83b-1617096824.jpg?width=640)

documentation/builders/components/soundcards/hifiberry.md

-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ If you know you HifiBerry Board identifier, you can run the script as a 1-liner
1919

2020
If you like to disable your HiFiberry Sound card and enable onboard sound, run the following command
2121

22-
2322
```bash
2423
./setup_hifiberry.sh disable
2524
```

documentation/builders/configuration.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,10 @@ $ ./run_jukebox.sh
2727
# Restart the service
2828
$ systemctl --user start jukebox-daemon
2929
```
30-
To try different configurations, you can start the Jukebox with a custom config file.
30+
31+
To try different configurations, you can start the Jukebox with a custom config file.
3132
This could be useful if you want your Jukebox to only allow a lower volume when started
32-
at nighttime, signaling it's time to go to bed. :-)
33+
at nighttime, signaling it's time to go to bed. :-)
3334
The path to the custom config file must be either absolute or relative to the folder `src/jukebox/`.
3435

3536
```bash

documentation/builders/event-devices.md

+8-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Event devices
22

33
## Background
4+
45
Event devices are generic input devices that are exposed in `/dev/input`.
56
This includes USB peripherals (Keyboards, Controllers, Joysticks or Mouse) as well as potentially bluetooth devices.
67

@@ -23,6 +24,7 @@ modules:
2324
```
2425
2526
And add the following section with the plugin specific configuration:
27+
2628
``` yaml
2729
evdev:
2830
enabled: true
@@ -49,6 +51,7 @@ devices: # list of devices to listen for
4951
on_press: # Currently only the on_press action is supported
5052
{rpc_command_definition} # eg `alias: toggle`
5153
```
54+
5255
The `{device nickname}` is only for your own orientation and can be choosen freely.
5356
For each device you need to figure out the `{device_name}` and the `{event_id}` corresponding to key strokes, as indicated in the sections below.
5457

@@ -65,7 +68,7 @@ for device in devices:
6568

6669
The output could be in the style of:
6770

68-
```
71+
```text
6972
/dev/input/event1 Dell Dell USB Keyboard usb-0000:00:12.1-2/input0
7073
/dev/input/event0 Dell USB Optical Mouse usb-0000:00:12.0-2/input0
7174
```
@@ -96,8 +99,10 @@ for event in dev.read_loop():
9699
if event.type == ecodes.EV_KEY:
97100
print(categorize(event))
98101
```
102+
99103
The output could be of the form:
100-
```
104+
105+
```text
101106
device /dev/input/event1, name "DragonRise Inc. Generic USB Joystick ", phys "usb-3f980000.usb-1.2/input0"
102107
key event at 1672569673.124168, 297 (BTN_BASE4), down
103108
key event at 1672569673.385170, 297 (BTN_BASE4), up
@@ -114,7 +119,6 @@ Look for entries like `No callback registered for button ...`.
114119

115120
The RPC command follows the regular RPC command rules as defined in the [following documentation](./rpc-commands.md).
116121

117-
118122
## Full example config
119123

120-
A complete configuration example for a USB Joystick controller can be found in the [examples](../../resources/default-settings/evdev.example.yaml).
124+
A complete configuration example for a USB Joystick controller can be found in the [examples](../../resources/default-settings/evdev.example.yaml).

0 commit comments

Comments
 (0)