Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add markdown linting #2284

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
eefc0fb
fix docs
s-martin Mar 2, 2024
5fa1cd8
add markdown action
s-martin Mar 3, 2024
3a89137
use different action
s-martin Mar 3, 2024
26a8833
change linter
s-martin Mar 3, 2024
4ac2fef
add checkout
s-martin Mar 3, 2024
72061f5
change globs
s-martin Mar 3, 2024
6a6ba4b
change wildcard
s-martin Mar 3, 2024
40e0daf
Aktualisieren von markdown_v3.yml
s-martin Mar 6, 2024
cfba369
fix ignore
s-martin Mar 6, 2024
3c35885
comment ignore
s-martin Mar 6, 2024
b636beb
change version
s-martin Mar 6, 2024
d7cc895
use master
s-martin Mar 6, 2024
f8c2354
new action used for linting
s-martin Mar 6, 2024
c8a4091
Fix config
s-martin Mar 8, 2024
c465379
Remove ignore
s-martin Mar 8, 2024
4c80ad0
Ignore docstring dir
s-martin Mar 8, 2024
619f61d
ignore GitHub
s-martin Mar 8, 2024
f86b9f3
Aktualisieren von markdown_v3.yml
s-martin Mar 8, 2024
9daecd0
use dot true
s-martin Mar 8, 2024
b2299f7
Aktualisieren von markdown_v3.yml
s-martin Mar 8, 2024
1d3526a
Use new action
s-martin Mar 16, 2024
2909970
Fix continue-on-error
s-martin Mar 16, 2024
5b12457
Remove unnecessary code
s-martin Mar 16, 2024
3db414e
Add markdownlint config
s-martin Mar 16, 2024
f350c5f
Rename . markdownlint-cli2.yaml to .markdownlint-cli2.yaml
s-martin Mar 16, 2024
d5863d0
Use config file
s-martin Mar 16, 2024
ca3cc67
Simplify globs
s-martin Mar 17, 2024
932aa0f
Use globs and ignore in config file
s-martin Mar 17, 2024
012867f
Ignore $ errors
s-martin Mar 17, 2024
4f07a15
Ignore src and .github
s-martin Mar 17, 2024
e7f9ee8
Use only config file
s-martin Mar 17, 2024
49376f1
Fix general glob
s-martin Mar 17, 2024
8d62a9b
Ignore inline html
s-martin Mar 17, 2024
501dc8c
Disable MD010
s-martin Mar 17, 2024
de411e9
Fix language
s-martin Mar 17, 2024
86a0cb4
dont warn trailing punctuation
s-martin Mar 17, 2024
1b9c8dc
fix warnings
s-martin Mar 17, 2024
87c34e8
fix a warning
s-martin Mar 17, 2024
839b04e
reduce ignore
s-martin Mar 17, 2024
2af901f
fix warnings
s-martin Mar 17, 2024
5b2f0be
fail check, if markdownlint fails
s-martin Mar 17, 2024
e1c7796
add runner script and hook
s-martin Mar 17, 2024
403d9c9
Update documentation/builders/components/power/onoff-shim.md
s-martin Mar 18, 2024
fe13663
Update playlists-livestreams-podcasts.md
s-martin Mar 18, 2024
e86a7da
add documentation for documentation with md
s-martin Mar 19, 2024
93c98dc
get rid of docker
s-martin Mar 19, 2024
afd4865
fix comments
s-martin Mar 19, 2024
d5fd295
incorporate comments
s-martin Mar 20, 2024
cc73108
Update documentation/developers/documentation.md
s-martin Mar 20, 2024
c23b4b6
check, if cmd does not exisr
s-martin Mar 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
# Note: This only checks the modified files
# - docs build of if any python file is staged
# Note: This builds the entire documentation if a changed file goes into the documentation
# - Markdownlint if any markdown file is staged
# Note: This checks all markdown files as configured in .markdownlint-cli2.yaml

#
# If there are problem with this script, commit may still be done with
# git commit --no-verify
Expand Down Expand Up @@ -40,6 +43,20 @@ fi

code=$(( flake8_code + doc_code ))

# Pass all staged markdown files through markdownlint-cli2
MD_FILES="$(git diff --diff-filter=d --staged --name-only -- **/*.md)"
markdownlint_code=0
if [[ -n $MD_FILES ]]; then
echo -e "\n**************************************************************"
echo "Modified Markdown files. Running markdownlint-cli2 ... "
echo -e "**************************************************************\n"
./run_markdownlint.sh
markdownlint_code=$?
echo "Markdownlint-cli2 return code: $markdownlint_code"
fi

code=$(( flake8_code + doc_code + markdownlint_code))

if [[ code -gt 0 ]]; then
echo -e "\n**************************************************************"
echo -e "ERROR(s) during pre-commit checks. Aborting commit!"
Expand Down
2 changes: 0 additions & 2 deletions .github/ISSUE_TEMPLATE/bug_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ Please post here the output of 'tail -n 500 /var/log/syslog' or 'journalctl -u m
i.e. `find logfiles at https://paste.ubuntu.com/p/cRS7qM8ZmP/`
-->


## Software

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


## Hardware

### RaspberryPi version
Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/markdown_v3.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Markdown Linting

on:
push:
branches:
- 'future3/**'
paths:
- '**.md'
pull_request:
branches:
- 'future3/**'
paths:
- '**.md'

jobs:
build:

runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Linting markdown
uses: DavidAnson/markdownlint-cli2-action@v15
with:
config: .markdownlint-cli2.yaml
#continue-on-error: true
52 changes: 52 additions & 0 deletions .markdownlint-cli2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#
# markdownlint-cli2 configuration, see https://github.com/DavidAnson/markdownlint-cli2?tab=readme-ov-file#configuration
#

# rules, see https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md
config:
line-length: false
# ignore dollar signs
commands-show-output: false
no-trailing-punctuation: false

# Include a custom rule package
#customRules:
# - markdownlint-rule-titlecase

# Fix no fixable errors
fix: false

# Define a custom front matter pattern
#frontMatter: "<head>[^]*<\/head>"

# Define glob expressions to use (only valid at root)
globs:
- "**.md"

# Define glob expressions to ignore
ignores:
- "documentation/developers/docstring/*"
- "src/**"

# Use a plugin to recognize math
#markdownItPlugins:
# -
# - "@iktakahiro/markdown-it-katex"

# Additional paths to resolve module locations from
#modulePaths:
# - "./modules"

# Enable inline config comments
noInlineConfig: false

# Disable progress on stdout (only valid at root)
noProgress: true

# Use a specific formatter (only valid at root)
#outputFormatters:
# -
# - markdownlint-cli2-formatter-default

# Show found files on stdout (only valid at root)
showFound: true
14 changes: 7 additions & 7 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Contributor Covenant Code of Conduct

Dear Phonieboxians,

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.

All the best, Micz
> [!NOTE]
> Dear Phonieboxians,
>
> 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.
>
> All the best, Micz

2018-08-21

# Contributor Covenant Code of Conduct

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

## Our Pledge
Expand Down
15 changes: 8 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,16 @@ as local, temporary scratch areas.

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

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

To report bug fixes and improvements, please follow the steps outlined below:

1. For bug fixes and minor improvements, simply open a new issue or pull request (PR).
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.
- In such cases, please create an issue outlining your plans and intentions.
- We will ensure that there are no ongoing efforts on the same topic.
* In such cases, please create an issue outlining your plans and intentions.
* We will ensure that there are no ongoing efforts on the same topic.

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

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

~~~bash
cp .githooks/pre-commit` .git/hooks/.
cp .githooks/pre-commit .git/hooks/.
~~~

### Python Code
Expand Down Expand Up @@ -152,7 +153,7 @@ to detect in advance.

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

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

## Guidelines

* Phoniebox runs on Raspberry Pi OS.
* Phoniebox runs on Raspberry Pi OS.
* Minimum python version is currently **Python 3.9**.

## Additional Resources
Expand Down
2 changes: 1 addition & 1 deletion documentation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ project check out the [documentation of Version 2](https://github.com/MiczFlor/R
Version 3 has reached a mature state and will soon be the default version.
However, some features may still be missing. Please check the [Feature Status](./developers/status.md), if YOUR feature is already implemented.

> [!NOTE]
> [!NOTE]
> If version 3 has all the features you need, we recommend using Version 3.

If there is a feature missing, please open an issue.
Expand Down
3 changes: 3 additions & 0 deletions documentation/builders/audio.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ to setup the configuration for the Jukebox Core App.

Run the following steps in a console:

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

You can also try different PulseAudio sinks without setting the default sink. In this case the volume is the last used
volume level for this sink:
Expand Down Expand Up @@ -86,6 +88,7 @@ Pairing successful
....
[PowerLocus Buddy]# exit
```

If `bluetoothctl` has trouble to execute due to permission issue, try `sudo bluetoothctl`.

Wait for a few seconds and then with `$ pactl list sinks short`, check wether the Bluetooth device shows up as an output.
Expand Down
15 changes: 9 additions & 6 deletions documentation/builders/autohotspot.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ The Auto-Hotspot function enables the Jukebox to switch its connection between a

## How to connect

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

The default configuration is

``` text
* SSID : Phoniebox_Hotspot_<hostname>
* Password : PlayItLoud!
Expand All @@ -23,8 +24,7 @@ The default configuration is

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

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

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

Check the `autohotspot.service` status

``` bash
sudo systemctl status autohotspot.service
```

and logs

``` bash
sudo journalctl -u autohotspot.service -n 50
```
Expand All @@ -52,12 +54,13 @@ Check your WiFi configuration.
### You need to add a new WiFi network to the Raspberry Pi

#### Using the command line

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.

## Resources

* [Raspberry Connect - Auto WiFi Hotspot Switch](https://www.raspberryconnect.com/projects/65-raspberrypi-hotspot-accesspoints/158-raspberry-pi-auto-wifi-hotspot-switch-direct-connection)
* [Raspberry Pi - Configuring networking](https://www.raspberrypi.com/documentation/computers/configuration.html#using-the-command-line)
* [dhcpcd / wpa_supplicant]()
* [hostapd](http://w1.fi/hostapd/)
* [dnsmasq](https://thekelleys.org.uk/dnsmasq/doc.html)
* dhcpcd / wpa_supplicant
* [hostapd](http://w1.fi/hostapd/)
* [dnsmasq](https://thekelleys.org.uk/dnsmasq/doc.html)
7 changes: 3 additions & 4 deletions documentation/builders/components/power/onoff-shim.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ To install the software, open a terminal and type the following command to run t
> [!NOTE]
> The installation will ask you a few questions. You can safely answer with the default response.

```
```bash
curl https://get.pimoroni.com/onoffshim | bash
```

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

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

## Assembly options

![](https://cdn.review-images.pimoroni.com/upload-b6276a310ccfbeae93a2d13ec19ab83b-1617096824.jpg?width=640)

![OnOffShim soldered on a Raspberry Pi](https://cdn.review-images.pimoroni.com/upload-b6276a310ccfbeae93a2d13ec19ab83b-1617096824.jpg?width=640)
1 change: 0 additions & 1 deletion documentation/builders/components/soundcards/hifiberry.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ If you know you HifiBerry Board identifier, you can run the script as a 1-liner

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


```bash
./setup_hifiberry.sh disable
```
Expand Down
5 changes: 3 additions & 2 deletions documentation/builders/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@ $ ./run_jukebox.sh
# Restart the service
$ systemctl --user start jukebox-daemon
```
To try different configurations, you can start the Jukebox with a custom config file.

To try different configurations, you can start the Jukebox with a custom config file.
This could be useful if you want your Jukebox to only allow a lower volume when started
at nighttime, signaling it's time to go to bed. :-)
at nighttime, signaling it's time to go to bed. :-)
The path to the custom config file must be either absolute or relative to the folder `src/jukebox/`.

```bash
Expand Down
12 changes: 8 additions & 4 deletions documentation/builders/event-devices.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Event devices

## Background

Event devices are generic input devices that are exposed in `/dev/input`.
This includes USB peripherals (Keyboards, Controllers, Joysticks or Mouse) as well as potentially bluetooth devices.

Expand All @@ -23,6 +24,7 @@ modules:
```

And add the following section with the plugin specific configuration:

``` yaml
evdev:
enabled: true
Expand All @@ -49,6 +51,7 @@ devices: # list of devices to listen for
on_press: # Currently only the on_press action is supported
{rpc_command_definition} # eg `alias: toggle`
```

The `{device nickname}` is only for your own orientation and can be choosen freely.
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.

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

The output could be in the style of:

```
```text
/dev/input/event1 Dell Dell USB Keyboard usb-0000:00:12.1-2/input0
/dev/input/event0 Dell USB Optical Mouse usb-0000:00:12.0-2/input0
```
Expand Down Expand Up @@ -96,8 +99,10 @@ for event in dev.read_loop():
if event.type == ecodes.EV_KEY:
print(categorize(event))
```

The output could be of the form:
```

```text
device /dev/input/event1, name "DragonRise Inc. Generic USB Joystick ", phys "usb-3f980000.usb-1.2/input0"
key event at 1672569673.124168, 297 (BTN_BASE4), down
key event at 1672569673.385170, 297 (BTN_BASE4), up
Expand All @@ -114,7 +119,6 @@ Look for entries like `No callback registered for button ...`.

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


## Full example config

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