diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index 061905ce..9d6be72f 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -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. diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 322b95b3..940f2a4c 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -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 ``` diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3cfc9ace..52b28756 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -60,7 +60,7 @@ jobs: make test-actions # prepare for deployment make generate-paths - + - uses: Thog/action-equals@v1 id: isLatest with: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..4ef337c6 --- /dev/null +++ b/.pre-commit-config.yaml @@ -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 diff --git a/MANIFEST.in b/MANIFEST.in index f80422ea..e9854ec7 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,5 +1,4 @@ prune .github -prune git-hooks prune releasenotes include guake * prune guake/tests diff --git a/Makefile b/Makefile index 8ce68721..ccbf4333 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/Pipfile b/Pipfile index 7bd8fe98..7426f045 100644 --- a/Pipfile +++ b/Pipfile @@ -34,6 +34,7 @@ pew = "*" black = "==21.8b0" flakehell = "*" toml = "*" +pre-commit = "==2.17.0" [packages] pbr = "*" diff --git a/Pipfile.lock b/Pipfile.lock index 86a6cc6f..e304c317 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -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", diff --git a/docs/source/contributing/dev_env.rst b/docs/source/contributing/dev_env.rst index c10f5932..74cb4d64 100644 --- a/docs/source/contributing/dev_env.rst +++ b/docs/source/contributing/dev_env.rst @@ -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 ` 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 diff --git a/docs/source/index.rst b/docs/source/index.rst index 59a0ab4a..15cc2583 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -45,7 +45,7 @@ Useful links - Source Code available on `GitHub `_. - Official Homepage: http://guake-project.org - Online Documentation is hosted on `ReadTheDocs `_. -- 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 `_. Guake users are welcome `to support Weblate `_ in providing this service for free for OpenSource Projects. diff --git a/git-hooks/post-commit b/git-hooks/post-commit deleted file mode 100755 index 2ff66729..00000000 --- a/git-hooks/post-commit +++ /dev/null @@ -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} diff --git a/guake/callbacks.py b/guake/callbacks.py index f52213d2..7f8da555 100644 --- a/guake/callbacks.py +++ b/guake/callbacks.py @@ -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 diff --git a/guake/data/guake.desktop.metainfo.xml b/guake/data/guake.desktop.metainfo.xml index 14b43091..07f74972 100644 --- a/guake/data/guake.desktop.metainfo.xml +++ b/guake/data/guake.desktop.metainfo.xml @@ -9,12 +9,12 @@

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.

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.

@@ -33,4 +33,3 @@ https://github.com/Guake/guake/issues https://hosted.weblate.org/projects/guake/guake/ - diff --git a/guake/keybindings.py b/guake/keybindings.py index 33fc6bd5..3b2bc7e1 100644 --- a/guake/keybindings.py +++ b/guake/keybindings.py @@ -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 diff --git a/guake/prefs.py b/guake/prefs.py index 79815ce3..502ec854 100644 --- a/guake/prefs.py +++ b/guake/prefs.py @@ -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 diff --git a/releasenotes/notes/[Add_open_link_under_terminal_cursor_accelerator]-6bd83e590f8403d9.yaml b/releasenotes/notes/[Add_open_link_under_terminal_cursor_accelerator]-6bd83e590f8403d9.yaml index 96d14386..b2d7dd99 100644 --- a/releasenotes/notes/[Add_open_link_under_terminal_cursor_accelerator]-6bd83e590f8403d9.yaml +++ b/releasenotes/notes/[Add_open_link_under_terminal_cursor_accelerator]-6bd83e590f8403d9.yaml @@ -4,4 +4,3 @@ release_summary: > features: - | - Add new accelerator to open a link or URL under the terminal cursor #2060 - diff --git a/releasenotes/notes/bugfix-bfcece2fed005b98.yaml b/releasenotes/notes/bugfix-bfcece2fed005b98.yaml index 620846ec..14071558 100644 --- a/releasenotes/notes/bugfix-bfcece2fed005b98.yaml +++ b/releasenotes/notes/bugfix-bfcece2fed005b98.yaml @@ -4,4 +4,3 @@ release_summary: > fixes: - | fixed issue #1747. Now font size is not reset after a terminal split - diff --git a/releasenotes/notes/execute_in_new_tab-6161bba1822b644c.yaml b/releasenotes/notes/execute_in_new_tab-6161bba1822b644c.yaml index e698b8c2..551e65e0 100644 --- a/releasenotes/notes/execute_in_new_tab-6161bba1822b644c.yaml +++ b/releasenotes/notes/execute_in_new_tab-6161bba1822b644c.yaml @@ -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 diff --git a/releasenotes/notes/file_open_regex-1a6db403d54601e0.yaml b/releasenotes/notes/file_open_regex-1a6db403d54601e0.yaml index 3b918f4c..767c1059 100644 --- a/releasenotes/notes/file_open_regex-1a6db403d54601e0.yaml +++ b/releasenotes/notes/file_open_regex-1a6db403d54601e0.yaml @@ -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 diff --git a/releasenotes/notes/save_subterminals-4d086becd64ffcfb.yaml b/releasenotes/notes/save_subterminals-4d086becd64ffcfb.yaml index dd87f536..2927e1f0 100644 --- a/releasenotes/notes/save_subterminals-4d086becd64ffcfb.yaml +++ b/releasenotes/notes/save_subterminals-4d086becd64ffcfb.yaml @@ -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 diff --git a/scripts/all-sitedirs-in-prefix.py b/scripts/all-sitedirs-in-prefix.py index 0d73741c..705d6901 100644 --- a/scripts/all-sitedirs-in-prefix.py +++ b/scripts/all-sitedirs-in-prefix.py @@ -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]): diff --git a/scripts/test-exception.py b/scripts/test-exception.py index cb498fbb..c031d281 100755 --- a/scripts/test-exception.py +++ b/scripts/test-exception.py @@ -8,7 +8,7 @@ def func4(): def func2(): - func3() + func3() # noqa: F821 def func1():