Use pre-commit instead of Coala. Linting.

This commit is contained in:
Jonathan Lestrelin 2021-03-02 08:10:55 +01:00
parent f0b065bbd7
commit 07306747c5
3 changed files with 31 additions and 13 deletions

View File

@ -1,4 +0,0 @@
[python]
bears = PyUnusedCodeBear,PySafetyBear,PyFlakesBear,PEP8Bear,BanditBear,PyCommentedCodeBear,VultureBear,InvalidLinkBear,PyImportSortBear
files = *.py
use_spaces = true

23
.pre-commit-config.yaml Normal file
View File

@ -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

View File

@ -14,27 +14,26 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with gnome-pass-search-provider. If not, see # along with gnome-pass-search-provider. If not, see
# <http://www.gnu.org/licenses/>. # <http://www.gnu.org/licenses/>.
# Copyright (C) 2017 Jonathan Lestrelin # Copyright (C) 2017 Jonathan Lestrelin
# Author: Jonathan Lestrelin <jonathan.lestrelin@gmail.com> # Author: Jonathan Lestrelin <jonathan.lestrelin@gmail.com>
# This project was based on gnome-shell-search-github-repositories # This project was based on gnome-shell-search-github-repositories
# Copyright (C) 2012 Red Hat, Inc. # Copyright (C) 2012 Red Hat, Inc.
# Author: Ralph Bean <rbean@redhat.com> # Author: Ralph Bean <rbean@redhat.com>
# which itself was based on fedmsg-notify # which itself was based on fedmsg-notify
# Copyright (C) 2012 Red Hat, Inc. # Copyright (C) 2012 Red Hat, Inc.
# Author: Luke Macken <lmacken@redhat.com> # Author: Luke Macken <lmacken@redhat.com>
import dbus
import dbus.service
import re import re
import subprocess 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 dbus.mainloop.glib import DBusGMainLoop
from fuzzywuzzy import process, fuzz from fuzzywuzzy import fuzz
from fuzzywuzzy import process
from gi.repository import GLib 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. # Convenience shorthand for declaring dbus interface methods.
# s.b.n. -> search_bus_name # 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): def send_password_to_native_clipboard(self, base_args, name, field=None):
if field is not None: if field is not None:
self.notify( self.notify(
f"Cannot copy field values.", "Cannot copy field values.",
body="This feature requires GPaste.", body="This feature requires GPaste.",
error=True, error=True,
) )