Merge pull request #1883 from pi-hole/editorconfig

Add editorconfig
This commit is contained in:
Adam Warner
2025-08-11 22:55:37 +01:00
committed by GitHub
16 changed files with 73 additions and 38 deletions

20
.editorconfig Normal file
View File

@@ -0,0 +1,20 @@
# EditorConfig is awesome: https://editorconfig.org/
# top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = tab
tab_width = 4
charset = utf-8
trim_trailing_whitespace = true
[*.yml]
tab_width = 2
[*.md]
tab_width = 2

View File

@@ -12,31 +12,31 @@ assignees: ''
<!-- IMPORTANT Complete the entire template please, the info gathered here is usually needed to debug issues anyway so it saves time in the long run. Incomplete/stock template issues may be closed --> <!-- IMPORTANT Complete the entire template please, the info gathered here is usually needed to debug issues anyway so it saves time in the long run. Incomplete/stock template issues may be closed -->
<!-- pick ONE: Bug, <!-- pick ONE: Bug,
Feature Request, Feature Request,
Run Issue (running Pi-hole container failing), Run Issue (running Pi-hole container failing),
Build Issue (Building image failing) Build Issue (Building image failing)
Enter in line below: --> Enter in line below: -->
This is a: **FILL ME IN** This is a: **FILL ME IN**
## Details ## Details
<!-- Provide a more detailed introduction to the issue or feature, try not to duplicate info from lower sections by reviewing the entire template first --> <!-- Provide a more detailed introduction to the issue or feature, try not to duplicate info from lower sections by reviewing the entire template first -->
## Related Issues ## Related Issues
- [ ] I have searched this repository/Pi-hole forums for existing issues and pull requests that look similar - [ ] I have searched this repository/Pi-hole forums for existing issues and pull requests that look similar
<!-- Add links below! --> <!-- Add links below! -->
<!------- FEATURE REQUESTS CAN STOP FILLING IN TEMPLATE HERE --------> <!------- FEATURE REQUESTS CAN STOP FILLING IN TEMPLATE HERE -------->
<!------- ISSUES SHOULD FILL OUT REMAINDER OF TEMPLATE --------> <!------- ISSUES SHOULD FILL OUT REMAINDER OF TEMPLATE -------->
## How to reproduce the issue ## How to reproduce the issue
1. Environment data 1. Environment data
* Operating System: **ENTER HERE** <!-- Debian, Ubuntu, Rasbian, etc --> * Operating System: **ENTER HERE** <!-- Debian, Ubuntu, Rasbian, etc -->
* Hardware: <!-- PC, RasPi B/2B/3B/4B, Mac, Synology, QNAP, etc --> * Hardware: <!-- PC, RasPi B/2B/3B/4B, Mac, Synology, QNAP, etc -->
* Kernel Architecture: <!-- x86/amd64, ArmV7, ArmV8 32bit, ArmV8 64bit, etc --> * Kernel Architecture: <!-- x86/amd64, ArmV7, ArmV8 32bit, ArmV8 64bit, etc -->
* Docker Install Info and version: * Docker Install Info and version:
- Software source: <!-- official docker-ce, OS provided package, Hypriot --> - Software source: <!-- official docker-ce, OS provided package, Hypriot -->
- Supplimentary Software: <!-- synology, portainer, etc --> - Supplimentary Software: <!-- synology, portainer, etc -->
* Hardware architecture: <!-- ARMv7, x86 --> * Hardware architecture: <!-- ARMv7, x86 -->

View File

@@ -9,4 +9,4 @@ contact_links:
- name: Documentation - name: Documentation
url: https://docs.pi-hole.net url: https://docs.pi-hole.net
about: Documentation and guides. about: Documentation and guides.

View File

@@ -2,7 +2,7 @@ version: 2
updates: updates:
# Maintain dependencies for GitHub Actions # Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions" - package-ecosystem: "github-actions"
directories: directories:
- "/" - "/"
schedule: schedule:
interval: "weekly" interval: "weekly"

View File

@@ -33,7 +33,7 @@ jobs:
runner: ubuntu-24.04-arm runner: ubuntu-24.04-arm
- platform: linux/riscv64 - platform: linux/riscv64
runner: ubuntu-24.04-arm runner: ubuntu-24.04-arm
steps: steps:
- name: Prepare name for digest up/download - name: Prepare name for digest up/download
run: | run: |
@@ -57,7 +57,7 @@ jobs:
github-token: ${{ secrets.GITHUB_TOKEN }} github-token: ${{ secrets.GITHUB_TOKEN }}
images: | images: |
${{ env.dockerhub }} ${{ env.dockerhub }}
${{ env.ghcr }} ${{ env.ghcr }}
flavor: | flavor: |
latest=${{ startsWith(github.ref, 'refs/tags/') }} latest=${{ startsWith(github.ref, 'refs/tags/') }}
tags: | tags: |
@@ -95,10 +95,10 @@ jobs:
context: ./src/ context: ./src/
platforms: ${{ matrix.platform }} platforms: ${{ matrix.platform }}
build-args: | build-args: |
PIHOLE_DOCKER_TAG=${{ steps.meta.outputs.version }} PIHOLE_DOCKER_TAG=${{ steps.meta.outputs.version }}
FTL_BRANCH=${{ env.components_branch }} FTL_BRANCH=${{ env.components_branch }}
CORE_BRANCH=${{ env.components_branch }} CORE_BRANCH=${{ env.components_branch }}
WEB_BRANCH=${{ env.components_branch }} WEB_BRANCH=${{ env.components_branch }}
PADD_BRANCH=${{ env.components_branch }} PADD_BRANCH=${{ env.components_branch }}
labels: ${{ steps.meta.outputs.labels }} labels: ${{ steps.meta.outputs.labels }}
outputs: | outputs: |
@@ -142,7 +142,7 @@ jobs:
path: /tmp/digests path: /tmp/digests
pattern: digests-* pattern: digests-*
merge-multiple: true merge-multiple: true
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3 uses: docker/setup-buildx-action@v3
@@ -187,4 +187,4 @@ jobs:
- name: Inspect images - name: Inspect images
run: | run: |
docker buildx imagetools inspect ${{ env.dockerhub }}:${{ steps.meta.outputs.version }} docker buildx imagetools inspect ${{ env.dockerhub }}:${{ steps.meta.outputs.version }}
docker buildx imagetools inspect ${{ env.ghcr }}:${{ steps.meta.outputs.version }} docker buildx imagetools inspect ${{ env.ghcr }}:${{ steps.meta.outputs.version }}

View File

@@ -34,7 +34,7 @@ jobs:
uses: actions/setup-python@v5.6.0 uses: actions/setup-python@v5.6.0
with: with:
python-version: "3.13" python-version: "3.13"
- name: Run black formatter - name: Run black formatter
run: | run: |
pip install black pip install black

18
.github/workflows/editorconfig.yml vendored Normal file
View File

@@ -0,0 +1,18 @@
name: Editorconfig-Checker
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
jobs:
editorconfig-checker:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Get editorconfig-checker
uses: editorconfig-checker/action-editorconfig-checker@main # tag v1.0.0 is really out of date
- name: Run editorconfig-checker
run: editorconfig-checker

View File

@@ -17,4 +17,4 @@ jobs:
repository: ${{ github.repository }} repository: ${{ github.repository }}
untagged_only: true untagged_only: true
owner_type: org # or user owner_type: org # or user
except_untagged_multiplatform: true except_untagged_multiplatform: true

4
.gitignore vendored
View File

@@ -13,9 +13,11 @@ docker-compose.yml
etc-dnsmasq.d/ etc-dnsmasq.d/
etc-pihole/ etc-pihole/
var-log/ var-log/
.vscode/
.pytest_cache/
# WIP/test stuff # WIP/test stuff
doco.yml doco.yml
# Ignore FTL Binary if it exists # Ignore FTL Binary if it exists
src/pihole-FTL src/pihole-FTL

View File

@@ -1,5 +0,0 @@
{
"github-actions.workflows.pinned.workflows": [
".github/workflows/v6-alpine-play.yml"
]
}

View File

@@ -5,7 +5,7 @@ usage() {
echo "Usage: $0 [-l] [-f <ftl_branch>] [-c <core_branch>] [-w <web_branch>] [-t <tag>] [use_cache]" echo "Usage: $0 [-l] [-f <ftl_branch>] [-c <core_branch>] [-w <web_branch>] [-t <tag>] [use_cache]"
echo "Options:" echo "Options:"
echo " -f, --ftlbranch <branch> Specify FTL branch (cannot be used in conjunction with -l)" echo " -f, --ftlbranch <branch> Specify FTL branch (cannot be used in conjunction with -l)"
echo " -c, --corebranch <branch> Specify Core branch" echo " -c, --corebranch <branch> Specify Core branch"
echo " -w, --webbranch <branch> Specify Web branch" echo " -w, --webbranch <branch> Specify Web branch"
echo " -p, --paddbranch <branch> Specify PADD branch" echo " -p, --paddbranch <branch> Specify PADD branch"
echo " -t, --tag <tag> Specify Docker image tag (default: pihole:local)" echo " -t, --tag <tag> Specify Docker image tag (default: pihole:local)"
@@ -91,7 +91,7 @@ while [[ $# -gt 0 ]]; do
DOCKER_BUILD_CMD+=" --build-arg CORE_BRANCH=$CORE_BRANCH" DOCKER_BUILD_CMD+=" --build-arg CORE_BRANCH=$CORE_BRANCH"
shift shift
shift shift
;; ;;
-w | --webbranch) -w | --webbranch)
WEB_BRANCH="$2" WEB_BRANCH="$2"
check_branch_exists "web" "$WEB_BRANCH" "$WEB_FORK" check_branch_exists "web" "$WEB_BRANCH" "$WEB_FORK"

View File

@@ -34,13 +34,13 @@ services:
# Set the appropriate timezone for your location (https://en.wikipedia.org/wiki/List_of_tz_database_time_zones), e.g: # Set the appropriate timezone for your location (https://en.wikipedia.org/wiki/List_of_tz_database_time_zones), e.g:
TZ: 'Europe/London' TZ: 'Europe/London'
# Set a password to access the web interface. Not setting one will result in a random password being assigned # Set a password to access the web interface. Not setting one will result in a random password being assigned
FTLCONF_webserver_api_password: 'correct horse battery staple' FTLCONF_webserver_api_password: 'correct horse battery staple'
# Volumes store your data between container upgrades # Volumes store your data between container upgrades
volumes: volumes:
# For persisting Pi-hole's databases and common configuration file # For persisting Pi-hole's databases and common configuration file
- './etc-pihole:/etc/pihole' - './etc-pihole:/etc/pihole'
# Uncomment the below if you have custom dnsmasq config files that you want to persist. Not needed for most. # Uncomment the below if you have custom dnsmasq config files that you want to persist. Not needed for most.
#- './etc-dnsmasq.d:/etc/dnsmasq.d' #- './etc-dnsmasq.d:/etc/dnsmasq.d'
cap_add: cap_add:
# See https://github.com/pi-hole/docker-pi-hole#note-on-capabilities # See https://github.com/pi-hole/docker-pi-hole#note-on-capabilities
# Required if you are using Pi-hole as your DHCP server, else not needed # Required if you are using Pi-hole as your DHCP server, else not needed

View File

@@ -59,9 +59,9 @@ COPY crontab.txt /crontab.txt
# Add PADD to the container, too. # Add PADD to the container, too.
ADD --chmod=0755 https://raw.githubusercontent.com/${PADD_FORK}/PADD/${PADD_BRANCH}/padd.sh /usr/local/bin/padd ADD --chmod=0755 https://raw.githubusercontent.com/${PADD_FORK}/PADD/${PADD_BRANCH}/padd.sh /usr/local/bin/padd
# download a the main repos from github # download a the main repos from github
# if the branch is master we clone the latest tag as sometimes the master branch contains meta changes that have not been tagged # if the branch is master we clone the latest tag as sometimes the master branch contains meta changes that have not been tagged
# (we need to create a new "master" branch to avoid the "detached HEAD" state for the version check to work correctly) # (we need to create a new "master" branch to avoid the "detached HEAD" state for the version check to work correctly)
RUN clone_repo() { \ RUN clone_repo() { \
FORK="$1"; \ FORK="$1"; \

View File

@@ -79,12 +79,12 @@ start() {
while ! grep -q '########## FTL started' /var/log/pihole/FTL.log; do while ! grep -q '########## FTL started' /var/log/pihole/FTL.log; do
sleep 0.5 sleep 0.5
done done
pihole updatechecker pihole updatechecker
local versionsOutput local versionsOutput
versionsOutput=$(pihole -v) versionsOutput=$(pihole -v)
echo " [i] Version info:" echo " [i] Version info:"
printf "%b" "${versionsOutput}\\n" | sed 's/^/ /' printf "%b" "${versionsOutput}\\n" | sed 's/^/ /'
echo "" echo ""
if [ "${TAIL_FTL_LOG:-1}" -eq 1 ]; then if [ "${TAIL_FTL_LOG:-1}" -eq 1 ]; then
@@ -100,8 +100,8 @@ start() {
# Wait for the capsh process (which spawned FTL) to finish # Wait for the capsh process (which spawned FTL) to finish
wait $CAPSH_PID wait $CAPSH_PID
FTL_EXIT_CODE=$? FTL_EXIT_CODE=$?
# If we are here, then FTL has exited. # If we are here, then FTL has exited.
# If the trap was triggered, then stop will have already been called # If the trap was triggered, then stop will have already been called
if [ $TRAP_TRIGGERED -eq 0 ]; then if [ $TRAP_TRIGGERED -eq 0 ]; then

View File

@@ -2,5 +2,5 @@ pytest == 8.4.1
pytest-testinfra == 10.2.2 pytest-testinfra == 10.2.2
pytest-clarity == 1.0.1 pytest-clarity == 1.0.1
tox == 4.28.4 tox == 4.28.4
# Not adding pytest-xdist as using pytest with n > 1 cores # Not adding pytest-xdist as using pytest with n > 1 cores
# causes random issues with the emulated architectures # causes random issues with the emulated architectures

View File

@@ -7,10 +7,10 @@ deps = -rrequirements.txt
passenv = CIPLATFORM passenv = CIPLATFORM
setenv = setenv =
COLUMNS=120 COLUMNS=120
PY_COLORS=1 PY_COLORS=1
commands = # Build the Docker image for testing depending on the architecture, fall back to 'local' if not set commands = # Build the Docker image for testing depending on the architecture, fall back to 'local' if not set
# This allows us to run the tests on the host architecture if not on CI # This allows us to run the tests on the host architecture if not on CI
docker buildx build --load --platform={env:CIPLATFORM:local} --progress plain -f ../src/Dockerfile -t pihole:CI_container ../src/ docker buildx build --load --platform={env:CIPLATFORM:local} --progress plain -f ../src/Dockerfile -t pihole:CI_container ../src/
# run the tests # run the tests
# # Not using > 1 cores as it causes random issues with the emulated architectures # # Not using > 1 cores as it causes random issues with the emulated architectures
pytest {posargs:-vv} ./tests/ pytest {posargs:-vv} ./tests/