diff --git a/.coafile b/.coafile
deleted file mode 100644
index f4b2a1a..0000000
--- a/.coafile
+++ /dev/null
@@ -1,4 +0,0 @@
-[python]
-bears = PyUnusedCodeBear,PySafetyBear,PyFlakesBear,PEP8Bear,BanditBear,PyCommentedCodeBear,VultureBear,InvalidLinkBear,PyImportSortBear
-files = *.py
-use_spaces = true
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
new file mode 100644
index 0000000..ae39912
--- /dev/null
+++ b/.pre-commit-config.yaml
@@ -0,0 +1,23 @@
+---
+# See https://pre-commit.com for more information
+# See https://pre-commit.com/hooks.html for more hooks
+repos:
+ - repo: https://github.com/pre-commit/pre-commit-hooks
+ rev: v3.3.0
+ hooks:
+ - id: trailing-whitespace
+ - id: end-of-file-fixer
+ - id: check-added-large-files
+ - repo: https://github.com/psf/black
+ rev: 20.8b1
+ hooks:
+ - id: black
+ - repo: https://gitlab.com/pycqa/flake8
+ rev: 3.8.4
+ hooks:
+ - id: flake8
+ args: ['--ignore=E501,E203']
+ - repo: https://github.com/asottile/reorder_python_imports
+ rev: v2.3.6
+ hooks:
+ - id: reorder-python-imports
diff --git a/gnome-pass-search-provider.py b/gnome-pass-search-provider.py
index 5accd55..8524d9c 100755
--- a/gnome-pass-search-provider.py
+++ b/gnome-pass-search-provider.py
@@ -14,27 +14,26 @@
# You should have received a copy of the GNU General Public License
# along with gnome-pass-search-provider. If not, see
# .
-
# Copyright (C) 2017 Jonathan Lestrelin
# Author: Jonathan Lestrelin
-
# This project was based on gnome-shell-search-github-repositories
# Copyright (C) 2012 Red Hat, Inc.
# Author: Ralph Bean
# which itself was based on fedmsg-notify
# Copyright (C) 2012 Red Hat, Inc.
# Author: Luke Macken
-
-import dbus
-import dbus.service
import re
import subprocess
+from os import getenv
+from os import walk
+from os.path import expanduser
+from os.path import join as path_join
+import dbus.service
from dbus.mainloop.glib import DBusGMainLoop
-from fuzzywuzzy import process, fuzz
+from fuzzywuzzy import fuzz
+from fuzzywuzzy import process
from gi.repository import GLib
-from os import getenv, walk
-from os.path import expanduser, join as path_join
# Convenience shorthand for declaring dbus interface methods.
# s.b.n. -> search_bus_name
@@ -165,7 +164,7 @@ class SearchPassService(dbus.service.Object):
def send_password_to_native_clipboard(self, base_args, name, field=None):
if field is not None:
self.notify(
- f"Cannot copy field values.",
+ "Cannot copy field values.",
body="This feature requires GPaste.",
error=True,
)