diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
new file mode 100644
index 00000000..0eb196de
--- /dev/null
+++ b/.pre-commit-config.yaml
@@ -0,0 +1,24 @@
+repos:
+- repo: https://github.com/ambv/black
+ rev: 20.8b1
+ hooks:
+ - id: black
+- repo: https://github.com/timothycrosley/isort
+ rev: 5.5.1
+ hooks:
+ - id: isort
+- repo: https://github.com/pre-commit/pre-commit-hooks
+ rev: v3.2.0
+ hooks:
+ - id: check-ast
+ - id: check-case-conflict
+ - id: trailing-whitespace
+ - id: mixed-line-ending
+ - id: end-of-file-fixer
+ - id: check-yaml
+ - id: debug-statements
+- repo: https://github.com/myint/autoflake
+ rev: v1.4
+ hooks:
+ - id: autoflake
+ args: ['--in-place', '--remove-all-unused-imports', '--remove-unused-variable']
diff --git a/ablog/commands.py b/ablog/commands.py
index 038dce3e..3bd1c3a7 100644
--- a/ablog/commands.py
+++ b/ablog/commands.py
@@ -360,12 +360,13 @@ def ablog_post(filename, title=None, **kwargs):
print("Blog post created: %s" % filename)
-@arg("--github-url",
- dest = "github_url",
- type = str,
- default = "git@github.com",
- help = "Custom GitHub URL. Useful when multiple accounts are configured "
- "on the same machine. Default is: git@github.com"
+@arg(
+ "--github-url",
+ dest="github_url",
+ type=str,
+ default="git@github.com",
+ help="Custom GitHub URL. Useful when multiple accounts are configured "
+ "on the same machine. Default is: git@github.com",
)
@arg(
"--github-token",
diff --git a/ablog/locale/de/LC_MESSAGES/sphinx.po b/ablog/locale/de/LC_MESSAGES/sphinx.po
index 4cc3124a..e763b7c1 100644
--- a/ablog/locale/de/LC_MESSAGES/sphinx.po
+++ b/ablog/locale/de/LC_MESSAGES/sphinx.po
@@ -113,4 +113,3 @@ msgstr "Nächste"
#: ablog/templates/recentposts.html:2
msgid "Recent Posts"
msgstr "Neue Einträge"
-
diff --git a/ablog/locale/es/LC_MESSAGES/sphinx.po b/ablog/locale/es/LC_MESSAGES/sphinx.po
index 8d5199f5..850e5620 100644
--- a/ablog/locale/es/LC_MESSAGES/sphinx.po
+++ b/ablog/locale/es/LC_MESSAGES/sphinx.po
@@ -114,4 +114,3 @@ msgstr "Siguiente"
#: ablog/templates/recentposts.html:2
msgid "Recent Posts"
msgstr "Entradas recientes"
-
diff --git a/ablog/locale/et/LC_MESSAGES/sphinx.po b/ablog/locale/et/LC_MESSAGES/sphinx.po
index b394fec6..daa43898 100644
--- a/ablog/locale/et/LC_MESSAGES/sphinx.po
+++ b/ablog/locale/et/LC_MESSAGES/sphinx.po
@@ -113,4 +113,3 @@ msgstr "Järgmine"
#: ablog/templates/recentposts.html:2
msgid "Recent Posts"
msgstr "Viimased postitused"
-
diff --git a/ablog/locale/fr/LC_MESSAGES/sphinx.po b/ablog/locale/fr/LC_MESSAGES/sphinx.po
index 5c2a9381..09a7e22c 100644
--- a/ablog/locale/fr/LC_MESSAGES/sphinx.po
+++ b/ablog/locale/fr/LC_MESSAGES/sphinx.po
@@ -118,4 +118,3 @@ msgstr "Suivant"
#: ablog/templates/recentposts.html:2
msgid "Recent Posts"
msgstr "Billets récents"
-
diff --git a/ablog/locale/tr/LC_MESSAGES/sphinx.po b/ablog/locale/tr/LC_MESSAGES/sphinx.po
index c563a02e..bd79826f 100644
--- a/ablog/locale/tr/LC_MESSAGES/sphinx.po
+++ b/ablog/locale/tr/LC_MESSAGES/sphinx.po
@@ -113,4 +113,3 @@ msgstr "Sonraki"
#: ablog/templates/recentposts.html:2
msgid "Recent Posts"
msgstr "Yeni Yazılar"
-
diff --git a/ablog/locale/zh_CN/LC_MESSAGES/sphinx.po b/ablog/locale/zh_CN/LC_MESSAGES/sphinx.po
index e2f21930..bd93a180 100644
--- a/ablog/locale/zh_CN/LC_MESSAGES/sphinx.po
+++ b/ablog/locale/zh_CN/LC_MESSAGES/sphinx.po
@@ -118,4 +118,3 @@ msgstr "下一篇"
#: ablog/templates/recentposts.html:2
msgid "Recent Posts"
msgstr "最近文章"
-
diff --git a/ablog/templates/postcard.html b/ablog/templates/postcard.html
index 66aaaea8..740f3907 100644
--- a/ablog/templates/postcard.html
+++ b/ablog/templates/postcard.html
@@ -16,5 +16,3 @@
{% include "postcard2.html" %}
{% endif %}
-
-
diff --git a/docs/Makefile b/docs/Makefile
index 298ea9e2..51285967 100644
--- a/docs/Makefile
+++ b/docs/Makefile
@@ -16,4 +16,4 @@ help:
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
- @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
\ No newline at end of file
+ @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
diff --git a/docs/conf.py b/docs/conf.py
index 1e1e8630..cd3dc635 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -4,7 +4,6 @@
from pkg_resources import get_distribution
from sphinx import addnodes
-import ablog
ablog_builder = "dirhtml"
ablog_website = "_website"
@@ -26,17 +25,17 @@
# language = 'tr'
# PROJECT
-versionmod = get_distribution('ablog')
+versionmod = get_distribution("ablog")
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
# The short X.Y version.
-version = '.'.join(versionmod.version.split('.')[:3])
+version = ".".join(versionmod.version.split(".")[:3])
# The full version, including alpha/beta/rc tags.
-release = versionmod.version.split('+')[0]
+release = versionmod.version.split("+")[0]
# Is this version a development release
-is_development = '.dev' in release
+is_development = ".dev" in release
project = "ABlog"
copyright = "2014-2019, ABlog Team"
diff --git a/docs/manual/forever-draft.rst b/docs/manual/forever-draft.rst
index a43f5e80..43144708 100644
--- a/docs/manual/forever-draft.rst
+++ b/docs/manual/forever-draft.rst
@@ -40,4 +40,3 @@ to be discussed as well, but you don't want a draft to be discussed before
it is published. By adding :rst:dir:`post` directive without published date
and keeping configuration variable :confval:`disqus_drafts` as ``False``,
you can achieve that.
-
diff --git a/docs/manual/post-excerpts-and-images.rst b/docs/manual/post-excerpts-and-images.rst
index 61ca7abc..85f523ac 100644
--- a/docs/manual/post-excerpts-and-images.rst
+++ b/docs/manual/post-excerpts-and-images.rst
@@ -49,4 +49,4 @@ Let's first include a local and a non-local image in this post.
To link the second one of these, we add ``:image: 2`` option in :rst:dir:`post`
-directive.
\ No newline at end of file
+directive.
diff --git a/docs/manual/watch-yourself-blogging.rst b/docs/manual/watch-yourself-blogging.rst
index 27f13679..14cce176 100644
--- a/docs/manual/watch-yourself-blogging.rst
+++ b/docs/manual/watch-yourself-blogging.rst
@@ -20,4 +20,4 @@ or add a new one. This won't refresh your browser page though. Unless you
want to hit refresh once in a while, you can easily find an auto refresher
extension for you browser.
-.. _Watchdog: https://github.com/gorakhargosh/watchdog
\ No newline at end of file
+.. _Watchdog: https://github.com/gorakhargosh/watchdog
diff --git a/docs/release/ablog-v0.1-released.rst b/docs/release/ablog-v0.1-released.rst
index 75dd7f98..8b8d3429 100644
--- a/docs/release/ablog-v0.1-released.rst
+++ b/docs/release/ablog-v0.1-released.rst
@@ -17,4 +17,4 @@ most other posts in this blogumentation.
The idea is to enable making any page in a Sphinx_ project a post so that
users of a software package can subscribe to feeds and follow new releases
-as well as code examples added to the documentation.
\ No newline at end of file
+as well as code examples added to the documentation.
diff --git a/docs/release/ablog-v0.5-released.rst b/docs/release/ablog-v0.5-released.rst
index 93ccf329..dbbb5e82 100644
--- a/docs/release/ablog-v0.5-released.rst
+++ b/docs/release/ablog-v0.5-released.rst
@@ -18,4 +18,4 @@ ABlog v0.5.1 released
:category: Release
:location: SF
-Added ``:excerpts:`` option to :rst:dir:`postlist` directive.
\ No newline at end of file
+Added ``:excerpts:`` option to :rst:dir:`postlist` directive.
diff --git a/docs/release/ablog-v0.9-released.rst b/docs/release/ablog-v0.9-released.rst
index e5004424..a6fdd435 100644
--- a/docs/release/ablog-v0.9-released.rst
+++ b/docs/release/ablog-v0.9-released.rst
@@ -60,4 +60,4 @@ ABlog v0.9.3 released
:location: World
Added example on how to use writing blog posts in Jupyter notebooks.
-Several fixes provived by `anzawatta`, sorry I was late to release these!
\ No newline at end of file
+Several fixes provived by `anzawatta`, sorry I was late to release these!
diff --git a/setup.py b/setup.py
index d42d1b60..f107ec63 100644
--- a/setup.py
+++ b/setup.py
@@ -17,9 +17,13 @@
# Concatenate all the values together for 'all'
extras["all"] = list(chain.from_iterable(ex_extras.values()))
-setup(extras_require=extras, use_scm_version=True, message_extractors={
- 'ablog': [
- ('**.py', 'python', None),
- ('templates/**.html', 'jinja2', None),
- ],
-})
+setup(
+ extras_require=extras,
+ use_scm_version=True,
+ message_extractors={
+ "ablog": [
+ ("**.py", "python", None),
+ ("templates/**.html", "jinja2", None),
+ ],
+ },
+)