Add pre-commit config and apply all fixes

This commit is contained in:
Paul Hooijenga 2022-10-25 16:46:38 +02:00 committed by David Yang
parent 96ef772f87
commit 86bb9b55c1
22 changed files with 94 additions and 51 deletions

View File

@ -15,5 +15,4 @@ For how to run the latest Guake in your computer, please refer to [Install from
Please use [FeatHub](https://feathub.com/Guake/guake) to fill-up a feature request.
This allow us to spot directly which are the most requested features.
This allows us to spot directly which are the most requested features.

View File

@ -41,14 +41,14 @@ Please follow these steps before submitting a new Pull Request to Guake:
- Semantic commit is supported (and recommended). Add one of the following
line in your commit messages:
```
# For a bug fix, uses:
sem-ver: bugfix
# For a new feature, uses:
sem-ver: feature
# Please do not use the 'breaking change' syntax (`sem-ver: api-break`),
# Please do not use the 'breaking change' syntax (`sem-ver: api-break`),
# it is reserved for really big reworks
```

View File

@ -60,7 +60,7 @@ jobs:
make test-actions
# prepare for deployment
make generate-paths
- uses: Thog/action-equals@v1
id: isLatest
with:

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

@ -0,0 +1,25 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks.git
rev: v4.3.0
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
args:
- "--markdown-linebreak-ext=md"
exclude: COPYING
- repo: https://github.com/PyCQA/flake8.git
rev: 3.9.2
hooks:
- id: flake8
- repo: https://github.com/PyCQA/pylint.git
rev: v2.13.6
hooks:
- id: pylint
- repo: https://github.com/psf/black.git
rev: 22.10.0
hooks:
- id: black
- repo: https://github.com/hackedd/fiximports.git
rev: 19bd841
hooks:
- id: fiximports

View File

@ -1,5 +1,4 @@
prune .github
prune git-hooks
prune releasenotes
include guake *
prune guake/tests

View File

@ -181,7 +181,8 @@ compile-glib-schemas-dev: clean-schemas
clean-schemas:
rm -f $(DEV_DATA_DIR)/gschemas.compiled
style: black
style:
PIPENV_IGNORE_VIRTUALENVS=1 pipenv run pre-commit run --all-files
black:
PIPENV_IGNORE_VIRTUALENVS=1 pipenv run black $(MODULE)
@ -312,15 +313,12 @@ freeze:
PIPENV_IGNORE_VIRTUALENVS=1 pipenv run pip freeze
githook:
bash git-hooks/post-commit
setup-githook:
rm -f .git/hooks/post-commit
cp -fv git-hooks/* .git/hooks/
PIPENV_IGNORE_VIRTUALENVS=1 pipenv run pre-commit install
push: githook
push:
git push origin --tags

View File

@ -34,6 +34,7 @@ pew = "*"
black = "==21.8b0"
flakehell = "*"
toml = "*"
pre-commit = "==2.17.0"
[packages]
pbr = "*"

44
Pipfile.lock generated
View File

@ -1,7 +1,7 @@
{
"_meta": {
"hash": {
"sha256": "db17cdb4a1f7621cfed5e66c92df1ea73f1e94a8b587952fcebad77360157600"
"sha256": "fdecd7a6a22203e2660a1a3cd279302611cec90e5ccd0fe0e52fd975c13de430"
},
"pipfile-spec": 6,
"requires": {
@ -199,6 +199,14 @@
],
"version": "==1.15.0"
},
"cfgv": {
"hashes": [
"sha256:c6a0883f3917a037485059700b9e75da2464e6c27051014ad85ba6aaa5884426",
"sha256:f5a830efb9ce7a445376bb66ec94c638a9787422f96264c98edc6bdeed8ab736"
],
"markers": "python_full_version >= '3.6.1'",
"version": "==3.3.1"
},
"charset-normalizer": {
"hashes": [
"sha256:2857e29ff0d34db842cd7ca3230549d1a697f96ee6d3fb071cfa6c7393832597",
@ -419,6 +427,14 @@
"editable": true,
"path": "."
},
"identify": {
"hashes": [
"sha256:5b8fd1e843a6d4bf10685dd31f4520a7f1c7d0e14e9bc5d34b1d6f111cabc011",
"sha256:7a67b2a6208d390fd86fd04fb3def94a3a8b7f0bcbd1d1fcd6736f4defe26390"
],
"markers": "python_version >= '3.7'",
"version": "==2.5.7"
},
"idna": {
"hashes": [
"sha256:84d9dd047ffa80596e0f246e2eab0b391788b0503584e8945f2368256d2735ff",
@ -463,7 +479,7 @@
"sha256:6f62d78e2f89b4500b080fe3a81690850cd254227f27f75c3a0c491a1f351ba7",
"sha256:e8443a5e7a020e9d7f97f1d7d9cd17c88bcb3bc7e218bf9cf5095fe550be2951"
],
"markers": "python_version < '4' and python_full_version >= '3.6.1'",
"markers": "python_version < '4.0' and python_full_version >= '3.6.1'",
"version": "==5.10.1"
},
"jeepney": {
@ -623,6 +639,14 @@
"index": "pypi",
"version": "==4.0.3"
},
"more-itertools": {
"hashes": [
"sha256:250e83d7e81d0c87ca6bd942e6aeab8cc9daa6096d12c5308f3f92fa5e5c1f41",
"sha256:5a6257e40878ef0520b1803990e3e22303a41b5714006c32a3fd8304b26ea1ab"
],
"markers": "python_version >= '3.7'",
"version": "==9.0.0"
},
"mypy-extensions": {
"hashes": [
"sha256:090fedd75945a69ae91ce1303b5824f428daf5a028d2f6ab8a299250a846f15d",
@ -630,6 +654,14 @@
],
"version": "==0.4.3"
},
"nodeenv": {
"hashes": [
"sha256:27083a7b96a25f2f5e1d8cb4b6317ee8aeda3bdd121394e5ac54e498028a042e",
"sha256:e0e7f7dfb85fc5394c6fe1e8fa98131a2473e04311a45afb6508f7cf1836fa2b"
],
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6'",
"version": "==1.7.0"
},
"packaging": {
"hashes": [
"sha256:dd47c42927d89ab911e606518907cc2d3a1f38bbd026385970643f9c5b8ecfeb",
@ -724,6 +756,14 @@
"markers": "python_version >= '3.6'",
"version": "==1.0.0"
},
"pre-commit": {
"hashes": [
"sha256:725fa7459782d7bec5ead072810e47351de01709be838c2ce1726b9591dad616",
"sha256:c1a8040ff15ad3d648c70cc3e55b93e4d2d5b687320955505587fd79bbaed06a"
],
"index": "pypi",
"version": "==2.17.0"
},
"py": {
"hashes": [
"sha256:51c75c4126074b472f746a24399ad32f6053d1b34b68d2fa41e558e6f4a98719",

View File

@ -84,8 +84,8 @@ You can reinstall easily in your environment (only validated for Debian/Ubuntu)
Git hook
========
Please install this git hook if you want to beautify your patch before submission:
This project uses `pre-commit <https://pre-commit.com/>` to automatically execute some codestyle tools. It should be automatically installed by the ``make dev`` command, you can use ``make style`` if you want to run it manually. If you want to pass more options, you can use:
.. code-block:: bash
$ make setup-githook
$ pipenv run pre-commit run --all-files

View File

@ -45,7 +45,7 @@ Useful links
- Source Code available on `GitHub <https://github.com/Guake/guake/>`_.
- Official Homepage: http://guake-project.org
- Online Documentation is hosted on `ReadTheDocs <http://guake.readthedocs.io/>`_.
- If you are not a developer, you can still contribute to Guake by
- If you are not a developer, you can still contribute to Guake by
`improving its translations in your language <https://hosted.weblate.org/projects/guake/guake/>`_.
Guake users are welcome `to support Weblate <https://weblate.org/donate/>`_ in providing this
service for free for OpenSource Projects.

View File

@ -1,18 +0,0 @@
#!/bin/bash
[ -z "$REVRANGE" ] && REVRANGE="master..HEAD^1"
# get a list of changed files, used below; this uses a tempfile to work around
# shell behavior when piping to 'while'
tempfile=$(mktemp -t tmp.XXXXXX)
trap "rm -f ${tempfile}; exit 1" 1 2 3 15
git diff --name-only $REVRANGE | grep '\.py$' > ${tempfile}
py_files=()
while read line; do
if [[ -f "${line}" ]]; then
echo "fast-styling ${line}"
pipenv run fiximports ${line};
fi
done < ${tempfile}

View File

@ -5,11 +5,11 @@ from gi.repository import Gdk
from gi.repository import Gtk
from guake.about import AboutDialog
from guake.dialogs import SaveTerminalDialog
from guake.globals import ENGINES
from guake.prefs import PrefsDialog
from guake.utils import FullscreenManager
from guake.utils import HidePrevention
from guake.utils import get_server_time
from guake.globals import ENGINES
from urllib.parse import quote_plus

View File

@ -9,12 +9,12 @@
<description>
<p>
Guake is a top-down terminal for Gnome, and is highly inspired by the famous terminal used in Quake.
You can instantaneously show and hide your terminal with a single key stroke, execute a command, and then go back to your previous task without breaking your workflow.
You can instantaneously show and hide your terminal with a single key stroke, execute a command, and then go back to your previous task without breaking your workflow.
</p>
<p>
Imagine you are working in your favorite text editor and want to execute some commands, like execute the unit test of your code, check a man page, or edit some configuration file.
You can do it at lightning speed without leaving your keyboard.
Just press your predefined "Show Guake" hotkey, execute your command, and press it again to hide the terminal and go back to your work.
Just press your predefined "Show Guake" hotkey, execute your command, and press it again to hide the terminal and go back to your work.
</p>
</description>
@ -33,4 +33,3 @@
<url type="bugtracker">https://github.com/Guake/guake/issues</url>
<url type="translate">https://hosted.weblate.org/projects/guake/guake/</url>
</component>

View File

@ -24,8 +24,8 @@ from collections import defaultdict
import gi
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk
from gi.repository import Gdk
from gi.repository import Gtk
from guake import notifier
from guake.common import pixmapfile

View File

@ -45,10 +45,10 @@ from guake.globals import ALIGN_LEFT
from guake.globals import ALIGN_RIGHT
from guake.globals import ALIGN_TOP
from guake.globals import ALWAYS_ON_PRIMARY
from guake.globals import ENGINES
from guake.globals import MAX_TRANSPARENCY
from guake.globals import NAME
from guake.globals import QUICK_OPEN_MATCHERS
from guake.globals import ENGINES
from guake.palettes import PALETTES
from guake.paths import AUTOSTART_FOLDER
from guake.paths import LOCALE_DIR

View File

@ -4,4 +4,3 @@ release_summary: >
features:
- |
- Add new accelerator to open a link or URL under the terminal cursor #2060

View File

@ -4,4 +4,3 @@ release_summary: >
fixes:
- |
fixed issue #1747. Now font size is not reset after a terminal split

View File

@ -1,6 +1,6 @@
release_summary: >
-e command reinstated and now only runs in new tabs
security:
- |
guake with the -e flag now always opens a new tab to run commands in

View File

@ -1,6 +1,6 @@
release_summary: >
Make file link matcher not match leading words.
fixes:
- |
- Spec files not recognized as links #1032
- Spec files not recognized as links #1032

View File

@ -3,4 +3,4 @@ release_summary: >
fixes:
- |
- A closed subterminal returns back after restarting Guake #1686
- A closed subterminal returns back after restarting Guake #1686

View File

@ -1,5 +1,7 @@
from __future__ import print_function
import site, os
import os
import site
prefix = os.getenv("PREFIX")
for d in site.getsitepackages(None if not prefix else [prefix]):

View File

@ -8,7 +8,7 @@ def func4():
def func2():
func3()
func3() # noqa: F821
def func1():