Skip to content

A community-supported supercharged document management system: scan, index and archive all your documents

Corrections to pass pre-commit hooks

Schnufflec2c8a27545f2
diff --git a/.env b/.env
index f196b0b5b..46f557886 100644
--- a/.env
+++ b/.env
@@ -1,2 +1,2 @@
COMPOSE_PROJECT_NAME=paperless
-export PROMPT="(pipenv-projectname)$P$G"
\ No newline at end of file
+export PROMPT="(pipenv-projectname)$P$G"
diff --git a/Dockerfile b/Dockerfile
index afde7dcc8..4520072f1 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -11,7 +11,15 @@ FROM ubuntu:20.04 AS jbig2enc
WORKDIR /usr/src/jbig2enc
-RUN apt-get update && apt-get install -y --no-install-recommends build-essential automake libtool libleptonica-dev zlib1g-dev git ca-certificates
+RUN apt-get update \
+ && apt-get install -y --no-install-recommends build-essential \
+ automake \
+ libtool \
+ libleptonica-dev \
+ zlib1g-dev \
+ git \
+ ca-certificates \
+&& rm -rf /var/lib/apt/lists/*
RUN git clone https://github.com/agl/jbig2enc .
RUN ./autogen.sh
diff --git a/docker/docker-entrypoint.sh b/docker/docker-entrypoint.sh
index 7a7bd6781..2b00e12c8 100755
--- a/docker/docker-entrypoint.sh
+++ b/docker/docker-entrypoint.sh
@@ -56,12 +56,12 @@ install_languages() {
# continue
#fi
- if dpkg -s $pkg &>/dev/null; then
+ if dpkg -s "$pkg" &>/dev/null; then
echo "Package $pkg already installed!"
continue
fi
- if ! apt-cache show $pkg &>/dev/null; then
+ if ! apt-cache show "$pkg" &>/dev/null; then
echo "Package $pkg not found! :("
continue
fi
@@ -77,7 +77,7 @@ install_languages() {
echo "Paperless-ngx docker container starting..."
# Install additional languages if specified
-if [[ ! -z "$PAPERLESS_OCR_LANGUAGES" ]]; then
+if [[ -n "$PAPERLESS_OCR_LANGUAGES" ]]; then
install_languages "$PAPERLESS_OCR_LANGUAGES"
fi
diff --git a/docker/docker-prepare.sh b/docker/docker-prepare.sh
index 28ddda55a..9e2819d47 100755
--- a/docker/docker-prepare.sh
+++ b/docker/docker-prepare.sh
@@ -6,14 +6,11 @@ wait_for_postgres() {
echo "Waiting for PostgreSQL to start..."
- host="${PAPERLESS_DBHOST}"
- port="${PAPERLESS_DBPORT}"
+ host="${PAPERLESS_DBHOST:=localhost}"
+ port="${PAPERLESS_DBPORT:=5342}"
- if [[ -z $port ]]; then
- port="5432"
- fi
- while ! </dev/tcp/$host/$port; do
+ while [ ! "$(pg_isready -h "$host" -p "$port")" ]; do
if [ $attempt_num -eq $max_attempts ]; then
echo "Unable to connect to database."
@@ -23,7 +20,7 @@ wait_for_postgres() {
fi
- attempt_num=$(expr "$attempt_num" + 1)
+ attempt_num=$(("$attempt_num" + 1))
sleep 5
done
}
diff --git a/docker/install_management_commands.sh b/docker/install_management_commands.sh
index 468711d3c..9da795b50 100755
--- a/docker/install_management_commands.sh
+++ b/docker/install_management_commands.sh
@@ -1,3 +1,5 @@
+#!/usr/bin/env bash
+
for command in document_archiver document_exporter document_importer mail_fetcher document_create_classifier document_index document_renamer document_retagger document_thumbnails document_sanity_checker manage_superuser;
do
echo "installing $command..."
diff --git a/docker/management_script.sh b/docker/management_script.sh
index a0d38f2bc..e3aba1259 100755
--- a/docker/management_script.sh
+++ b/docker/management_script.sh
@@ -6,10 +6,10 @@ cd /usr/src/paperless/src/
if [[ $(id -u) == 0 ]] ;
then
- gosu paperless python3 manage.py management_command "$@"
+ gosu paperless python3 manage.py management_command "$@"
elif [[ $(id -un) == "paperless" ]] ;
then
- python3 manage.py management_command "$@"
+ python3 manage.py management_command "$@"
else
- echo "Unknown user."
+ echo "Unknown user."
fi
diff --git a/docs/Dockerfile b/docs/Dockerfile
index ee63aebb4..9fb8bd0cc 100644
--- a/docs/Dockerfile
+++ b/docs/Dockerfile
@@ -1,5 +1,4 @@
FROM python:3.5.1
-MAINTAINER Pit Kleyersburg <[email protected]>
# Install Sphinx and Pygments
RUN pip install Sphinx Pygments
diff --git a/docs/changelog.rst b/docs/changelog.rst
index cbabbaa42..b95da9992 100644
--- a/docs/changelog.rst
+++ b/docs/changelog.rst
@@ -1685,4 +1685,4 @@ bulk of the work on this big change.
.. _a new home on Docker Hub: https://hub.docker.com/r/danielquinn/paperless/
.. _optipng: http://optipng.sourceforge.net/
.. _DjangoQL: https://github.com/ivelum/djangoql
-.. _ansible repo: https://github.com/paperless-ngx/paperless-ngx-ansible
\ No newline at end of file
+.. _ansible repo: https://github.com/paperless-ngx/paperless-ngx-ansible
diff --git a/docs/faq.rst b/docs/faq.rst
index a784e0da3..35122f4d8 100644
--- a/docs/faq.rst
+++ b/docs/faq.rst
@@ -5,11 +5,11 @@ Frequently asked questions
**Q:** *What's the general plan for Paperless-ngx?*
-**A:** While Paperless-ngx is already considered largely "feature-complete" it is a community-driven
+**A:** While Paperless-ngx is already considered largely "feature-complete" it is a community-driven
project and development will be guided in this way. New features can be submitted via
GitHub discussions and "up-voted" by the community but this is not a garauntee the feature
will be implemented. This project will always be open to collaboration in the form of PRs,
-ideas etc.
+ideas etc.
**Q:** *I'm using docker. Where are my documents?*
@@ -83,7 +83,7 @@ a long time.
**Q:** *How do I run this on Unraid?*
-**A:** Paperless-ngx is available as `community app <https://unraid.net/community/apps?q=paperless-ngx>`_
+**A:** Paperless-ngx is available as `community app <https://unraid.net/community/apps?q=paperless-ngx>`_
in Unraid. `Uli Fahrer <https://github.com/Tooa>`_ created a container template for that.
**Q:** *How do I run this on my toaster?*
diff --git a/docs/screenshots.rst b/docs/screenshots.rst
index 49494af5b..8889afe94 100644
--- a/docs/screenshots.rst
+++ b/docs/screenshots.rst
@@ -42,4 +42,3 @@ Mobile support in the future? This kinda works, however some layouts are still
too wide.
.. image:: _static/screenshots/mobile.png
-
diff --git a/docs/setup.rst b/docs/setup.rst
index 3e80a72e0..8d1852494 100644
--- a/docs/setup.rst
+++ b/docs/setup.rst
@@ -477,7 +477,7 @@ Migrating from Paperless-ng
===========================
Paperless-ngx is meant to be a drop-in replacement for Paperless-ng and thus upgrading should be
-trivial for most users, especially when using docker. However, as with any major change, it is
+trivial for most users, especially when using docker. However, as with any major change, it is
recommended to take a full backup first. Once you are ready, simply change the docker image to
point to the new source. E.g. if using Docker Compose, edit ``docker-compose.yml`` and change:
@@ -490,12 +490,12 @@ to
.. code::
image: ghcr.io/paperless-ngx/paperless-ngx:latest
-
+
and then run ``docker-compose up -d`` which will pull the new image recreate the container.
That's it!
-Users who installed with the bare-metal route should also update their Git clone to point to
-``https://github.com/paperless-ngx/paperless-ngx``, e.g. using the command
+Users who installed with the bare-metal route should also update their Git clone to point to
+``https://github.com/paperless-ngx/paperless-ngx``, e.g. using the command
``git remote set-url origin https://github.com/paperless-ngx/paperless-ngx`` and then pull the
lastest version.
diff --git a/install-paperless-ngx.sh b/install-paperless-ngx.sh
index ee938943c..d9bea400a 100755
--- a/install-paperless-ngx.sh
+++ b/install-paperless-ngx.sh
@@ -3,16 +3,16 @@
ask() {
while true ; do
if [[ -z $3 ]] ; then
- read -p "$1 [$2]: " result
+ read -r -p "$1 [$2]: " result
else
- read -p "$1 ($3) [$2]: " result
+ read -r -p "$1 ($3) [$2]: " result
fi
if [[ -z $result ]]; then
ask_result=$2
return
fi
array=$3
- if [[ -z $3 || " ${array[@]} " =~ " ${result} " ]]; then
+ if [[ -z $3 || " ${array[*]} " =~ ${result} ]]; then
ask_result=$result
return
else
@@ -24,7 +24,7 @@ ask() {
ask_docker_folder() {
while true ; do
- read -p "$1 [$2]: " result
+ read -r -p "$1 [$2]: " result
if [[ -z $result ]]; then
ask_result=$2
@@ -64,8 +64,7 @@ fi
# Check if user has permissions to run Docker by trying to get the status of Docker (docker status).
# If this fails, the user probably does not have permissions for Docker.
-docker stats --no-stream 2>/dev/null 1>&2
-if [ $? -ne 0 ] ; then
+if [ ! "$(docker stats --no-stream 2>/dev/null 1>&2)" ] ; then
echo ""
echo "WARN: It look like the current user does not have Docker permissions."
echo "WARN: Use 'sudo usermod -aG docker $USER' to assign Docker permissions to the user."
@@ -228,7 +227,7 @@ ask "Paperless username" "$(whoami)"
USERNAME=$ask_result
while true; do
- read -sp "Paperless password: " PASSWORD
+ read -r -sp "Paperless password: " PASSWORD
echo ""
if [[ -z $PASSWORD ]] ; then
@@ -236,7 +235,7 @@ while true; do
continue
fi
- read -sp "Paperless password (again): " PASSWORD_REPEAT
+ read -r -sp "Paperless password (again): " PASSWORD_REPEAT
echo ""
if [[ ! "$PASSWORD" == "$PASSWORD_REPEAT" ]] ; then
@@ -285,7 +284,7 @@ echo "Paperless username: $USERNAME"
echo "Paperless email: $EMAIL"
echo ""
-read -p "Press any key to install."
+read -r -p "Press any key to install."
echo ""
echo "Installing paperless..."
@@ -304,7 +303,7 @@ fi
wget "https://raw.githubusercontent.com/paperless-ngx/paperless-ngx/main/docker/compose/docker-compose.$DOCKER_COMPOSE_VERSION.yml" -O docker-compose.yml
wget "https://raw.githubusercontent.com/paperless-ngx/paperless-ngx/main/docker/compose/.env" -O .env
-SECRET_KEY=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 64 | head -n 1)
+SECRET_KEY=$(tr -dc 'a-zA-Z0-9' < /dev/urandom | fold -w 64 | head -n 1)
DEFAULT_LANGUAGES="deu eng fra ita spa"
@@ -318,7 +317,7 @@ DEFAULT_LANGUAGES="deu eng fra ita spa"
echo "PAPERLESS_TIME_ZONE=$TIME_ZONE"
echo "PAPERLESS_OCR_LANGUAGE=$OCR_LANGUAGE"
echo "PAPERLESS_SECRET_KEY=$SECRET_KEY"
- if [[ ! " ${DEFAULT_LANGUAGES[@]} " =~ " ${OCR_LANGUAGE} " ]] ; then
+ if [[ ! " ${DEFAULT_LANGUAGES[*]} " =~ ${OCR_LANGUAGE} ]] ; then
echo "PAPERLESS_OCR_LANGUAGES=$OCR_LANGUAGE"
fi
} > docker-compose.env
@@ -334,12 +333,12 @@ fi
if [[ -n $DATA_FOLDER ]] ; then
sed -i "s#- data:/usr/src/paperless/data#- $DATA_FOLDER:/usr/src/paperless/data#g" docker-compose.yml
- sed -i "/^\s*data:/d" docker-compose.yml
+ sed -i "/^\s*data:/d" docker-compose.yml
fi
if [[ -n $POSTGRES_FOLDER ]] ; then
sed -i "s#- pgdata:/var/lib/postgresql/data#- $POSTGRES_FOLDER:/var/lib/postgresql/data#g" docker-compose.yml
- sed -i "/^\s*pgdata:/d" docker-compose.yml
+ sed -i "/^\s*pgdata:/d" docker-compose.yml
fi
# remove trailing blank lines from end of file
@@ -348,7 +347,7 @@ sed -i -e :a -e '/^\n*$/{$d;N;};/\n$/ba' docker-compose.yml
l1=$(grep -n '^volumes:' docker-compose.yml | cut -d : -f 1) # get line number containing volume: at begin of line
l2=$(wc -l < docker-compose.yml) # get total number of lines
if [ "$l1" -eq "$l2" ] ; then
- sed -i "/^volumes:/d" docker-compose.yml
+ sed -i "/^volumes:/d" docker-compose.yml
fi
diff --git a/scripts/start_services.sh b/scripts/start_services.sh
index ecc842715..24e3233cd 100755
--- a/scripts/start_services.sh
+++ b/scripts/start_services.sh
@@ -1,3 +1,5 @@
+#!/usr/bin/env bash
+
docker run -p 5432:5432 -e POSTGRES_PASSWORD=password -v paperless_pgdata:/var/lib/postgresql/data -d postgres:13
docker run -d -p 6379:6379 redis:latest
docker run -p 3000:3000 -d gotenberg/gotenberg:7
diff --git a/src-ui/src/app/components/common/filterable-dropdown/filterable-dropdown.component.scss b/src-ui/src/app/components/common/filterable-dropdown/filterable-dropdown.component.scss
index 0dd0704f5..9b1b9a24a 100644
--- a/src-ui/src/app/components/common/filterable-dropdown/filterable-dropdown.component.scss
+++ b/src-ui/src/app/components/common/filterable-dropdown/filterable-dropdown.component.scss
@@ -60,4 +60,4 @@ small > svg {
.show .btn-outline-primary {
color: #fff;
-}
\ No newline at end of file
+}
diff --git a/src-ui/src/theme_dark.scss b/src-ui/src/theme_dark.scss
index 39cb65e45..d75047d15 100644
--- a/src-ui/src/theme_dark.scss
+++ b/src-ui/src/theme_dark.scss
@@ -36,11 +36,11 @@ $border-color-dark-mode: #47494f;
--bs-primary: hsl(var(--pngx-primary),var(--pngx-primary-lightness));
--bs-primary-rgb: var(--bs-primary);
}
-
+
.navbar-brand {
color: var(--bs-body-color);
}
-
+
.border {
border-color: var(--bs-border-color) !important;
}
@@ -156,7 +156,7 @@ $border-color-dark-mode: #47494f;
.toast {
background-color: hsla(var(--pngx-primary), calc(var(--pngx-primary-lightness) - 18%), 0.9);
}
-
+
.toast-header {
background-color: hsla(var(--pngx-primary), calc(var(--pngx-primary-lightness) - 10%), 0.9);
}