Skip to content

Commit ad1ccb7

Browse files
authored
Add extra pre commit hooks (black and flake8) for code formatting and PEP8 compliance (#125)
1 parent 97f9e69 commit ad1ccb7

File tree

12 files changed

+348
-268
lines changed

12 files changed

+348
-268
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,4 @@ coverage.xml
2323
tests/junit.xml
2424

2525
pytest_flask/_version.py
26+
.vscode

.pre-commit-config.yaml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,27 @@
11
repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v2.2.3
3+
rev: v3.2.0
44
hooks:
5+
- id: check-byte-order-marker
56
- id: trailing-whitespace
67
- id: end-of-file-fixer
78
- id: fix-encoding-pragma
89
args: [--remove]
910
- id: check-yaml
1011
- repo: https://github.com/asottile/reorder_python_imports
11-
rev: v1.4.0
12+
rev: v2.3.5
1213
hooks:
1314
- id: reorder-python-imports
1415
args: ['--application-directories=.:src', --py3-plus]
16+
- repo: https://github.com/python/black
17+
rev: 20.8b1
18+
hooks:
19+
- id: black
20+
- repo: https://gitlab.com/pycqa/flake8
21+
rev: 3.8.3
22+
hooks:
23+
- id: flake8
24+
additional_dependencies: [flake8-bugbear]
1525
- repo: local
1626
hooks:
1727
- id: rst

docs/conf.py

Lines changed: 80 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -17,226 +17,229 @@
1717
# If extensions (or modules to document with autodoc) are in another directory,
1818
# add these directories to sys.path here. If the directory is relative to the
1919
# documentation root, use os.path.abspath to make it absolute, like shown here.
20-
#sys.path.insert(0, os.path.abspath('.'))
20+
# sys.path.insert(0, os.path.abspath('.'))
2121

2222
# -- General configuration ------------------------------------------------
2323

2424
# If your documentation needs a minimal Sphinx version, state it here.
25-
#needs_sphinx = '1.0'
25+
# needs_sphinx = '1.0'
2626

2727
# Add any Sphinx extension module names here, as strings. They can be
2828
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
2929
# ones.
3030
extensions = []
3131

3232
# Add any paths that contain templates here, relative to this directory.
33-
templates_path = ['_templates']
33+
templates_path = ["_templates"]
3434

3535
# The suffix of source filenames.
36-
source_suffix = '.rst'
36+
source_suffix = ".rst"
3737

3838
# The encoding of source files.
39-
#source_encoding = 'utf-8-sig'
39+
# source_encoding = 'utf-8-sig'
4040

4141
# The master toctree document.
42-
master_doc = 'index'
42+
master_doc = "index"
4343

4444
# General information about the project.
45-
project = u'pytest-flask'
46-
copyright = u'%d, Vital Kudzelka and contributors' % datetime.date.today().year
45+
project = u"pytest-flask"
46+
copyright = u"%d, Vital Kudzelka and contributors" % datetime.date.today().year
4747

4848
# The version info for the project you're documenting, acts as replacement for
4949
# |version| and |release|, also used in various other places throughout the
5050
# built documents.
5151
#
5252
# The short X.Y version.
53-
version = __import__('pytest_flask').__version__
53+
version = __import__("pytest_flask").__version__
5454
# The full version, including alpha/beta/rc tags.
55-
release = __import__('pytest_flask').__version__
55+
release = __import__("pytest_flask").__version__
5656

5757
# The language for content autogenerated by Sphinx. Refer to documentation
5858
# for a list of supported languages.
59-
#language = None
59+
# language = None
6060

6161
# There are two options for replacing |today|: either, you set today to some
6262
# non-false value, then it is used:
63-
#today = ''
63+
# today = ''
6464
# Else, today_fmt is used as the format for a strftime call.
65-
#today_fmt = '%B %d, %Y'
65+
# today_fmt = '%B %d, %Y'
6666

6767
# List of patterns, relative to source directory, that match files and
6868
# directories to ignore when looking for source files.
69-
exclude_patterns = ['_build']
69+
exclude_patterns = ["_build"]
7070

7171
# The reST default role (used for this markup: `text`) to use for all
7272
# documents.
73-
#default_role = None
73+
# default_role = None
7474

7575
# If true, '()' will be appended to :func: etc. cross-reference text.
76-
#add_function_parentheses = True
76+
# add_function_parentheses = True
7777

7878
# If true, the current module name will be prepended to all description
7979
# unit titles (such as .. function::).
80-
#add_module_names = True
80+
# add_module_names = True
8181

8282
# If true, sectionauthor and moduleauthor directives will be shown in the
8383
# output. They are ignored by default.
84-
#show_authors = False
84+
# show_authors = False
8585

8686
# The name of the Pygments (syntax highlighting) style to use.
87-
pygments_style = 'sphinx'
87+
pygments_style = "sphinx"
8888

8989
# A list of ignored prefixes for module index sorting.
90-
#modindex_common_prefix = []
90+
# modindex_common_prefix = []
9191

9292
# If true, keep warnings as "system message" paragraphs in the built documents.
93-
#keep_warnings = False
93+
# keep_warnings = False
9494

9595

9696
# -- Options for HTML output ----------------------------------------------
9797

9898
# Only import and set the theme if we're building docs locally
99-
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
99+
on_rtd = os.environ.get("READTHEDOCS", None) == "True"
100100

101101
if not on_rtd:
102102
import sphinx_rtd_theme
103-
html_theme = 'sphinx_rtd_theme'
103+
104+
html_theme = "sphinx_rtd_theme"
104105
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
105106
else:
106-
html_theme = 'default'
107+
html_theme = "default"
107108

108109
# Theme options are theme-specific and customize the look and feel of a theme
109110
# further. For a list of options available for each theme, see the
110111
# documentation.
111-
#html_theme_options = {}
112+
# html_theme_options = {}
112113

113114
# Add any paths that contain custom themes here, relative to this directory.
114-
#html_theme_path = []
115+
# html_theme_path = []
115116

116117
# The name for this set of Sphinx documents. If None, it defaults to
117118
# "<project> v<release> documentation".
118-
#html_title = None
119+
# html_title = None
119120

120121
# A shorter title for the navigation bar. Default is the same as html_title.
121-
#html_short_title = None
122+
# html_short_title = None
122123

123124
# The name of an image file (relative to this directory) to place at the top
124125
# of the sidebar.
125-
#html_logo = None
126+
# html_logo = None
126127

127128
# The name of an image file (within the static path) to use as favicon of the
128129
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
129130
# pixels large.
130-
#html_favicon = None
131+
# html_favicon = None
131132

132133
# Add any paths that contain custom static files (such as style sheets) here,
133134
# relative to this directory. They are copied after the builtin static files,
134135
# so a file named "default.css" will overwrite the builtin "default.css".
135-
#html_static_path = ['_static']
136+
# html_static_path = ['_static']
136137

137138
# Add any extra paths that contain custom files (such as robots.txt or
138139
# .htaccess) here, relative to this directory. These files are copied
139140
# directly to the root of the documentation.
140-
#html_extra_path = []
141+
# html_extra_path = []
141142

142143
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
143144
# using the given strftime format.
144-
#html_last_updated_fmt = '%b %d, %Y'
145+
# html_last_updated_fmt = '%b %d, %Y'
145146

146147
# If true, SmartyPants will be used to convert quotes and dashes to
147148
# typographically correct entities.
148-
#html_use_smartypants = True
149+
# html_use_smartypants = True
149150

150151
# Custom sidebar templates, maps document names to template names.
151-
#html_sidebars = {}
152+
# html_sidebars = {}
152153

153154
# Additional templates that should be rendered to pages, maps page names to
154155
# template names.
155-
#html_additional_pages = {}
156+
# html_additional_pages = {}
156157

157158
# If false, no module index is generated.
158-
#html_domain_indices = True
159+
# html_domain_indices = True
159160

160161
# If false, no index is generated.
161-
#html_use_index = True
162+
# html_use_index = True
162163

163164
# If true, the index is split into individual pages for each letter.
164-
#html_split_index = False
165+
# html_split_index = False
165166

166167
# If true, links to the reST sources are added to the pages.
167-
#html_show_sourcelink = True
168+
# html_show_sourcelink = True
168169

169170
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
170-
#html_show_sphinx = True
171+
# html_show_sphinx = True
171172

172173
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
173-
#html_show_copyright = True
174+
# html_show_copyright = True
174175

175176
# If true, an OpenSearch description file will be output, and all pages will
176177
# contain a <link> tag referring to it. The value of this option must be the
177178
# base URL from which the finished HTML is served.
178-
#html_use_opensearch = ''
179+
# html_use_opensearch = ''
179180

180181
# This is the file name suffix for HTML files (e.g. ".xhtml").
181-
#html_file_suffix = None
182+
# html_file_suffix = None
182183

183184
# Output file base name for HTML help builder.
184-
htmlhelp_basename = 'pytest-flaskdoc'
185+
htmlhelp_basename = "pytest-flaskdoc"
185186

186187

187188
# -- Options for LaTeX output ---------------------------------------------
188189

189190
latex_elements = {
190-
# The paper size ('letterpaper' or 'a4paper').
191-
#'papersize': 'letterpaper',
192-
193-
# The font size ('10pt', '11pt' or '12pt').
194-
#'pointsize': '10pt',
195-
196-
# Additional stuff for the LaTeX preamble.
197-
#'preamble': '',
191+
# The paper size ('letterpaper' or 'a4paper').
192+
# 'papersize': 'letterpaper',
193+
# The font size ('10pt', '11pt' or '12pt').
194+
# 'pointsize': '10pt',
195+
# Additional stuff for the LaTeX preamble.
196+
# 'preamble': '',
198197
}
199198

200199
# Grouping the document tree into LaTeX files. List of tuples
201200
# (source start file, target name, title,
202201
# author, documentclass [howto, manual, or own class]).
203202
latex_documents = [
204-
('index', 'pytest-flask.tex', u'pytest-flask Documentation',
205-
u'Vital Kudzelka', 'manual'),
203+
(
204+
"index",
205+
"pytest-flask.tex",
206+
u"pytest-flask Documentation",
207+
u"Vital Kudzelka",
208+
"manual",
209+
),
206210
]
207211

208212
# The name of an image file (relative to this directory) to place at the top of
209213
# the title page.
210-
#latex_logo = None
214+
# latex_logo = None
211215

212216
# For "manual" documents, if this is true, then toplevel headings are parts,
213217
# not chapters.
214-
#latex_use_parts = False
218+
# latex_use_parts = False
215219

216220
# If true, show page references after internal links.
217-
#latex_show_pagerefs = False
221+
# latex_show_pagerefs = False
218222

219223
# If true, show URL addresses after external links.
220-
#latex_show_urls = False
224+
# latex_show_urls = False
221225

222226
# Documents to append as an appendix to all manuals.
223-
#latex_appendices = []
227+
# latex_appendices = []
224228

225229
# If false, no module index is generated.
226-
#latex_domain_indices = True
230+
# latex_domain_indices = True
227231

228232

229233
# -- Options for manual page output ---------------------------------------
230234

231235
# One entry per manual page. List of tuples
232236
# (source start file, name, description, authors, manual section).
233237
man_pages = [
234-
('index', 'pytest-flask', u'pytest-flask Documentation',
235-
[u'Vital Kudzelka'], 1)
238+
("index", "pytest-flask", u"pytest-flask Documentation", [u"Vital Kudzelka"], 1)
236239
]
237240

238241
# If true, show URL addresses after external links.
239-
#man_show_urls = False
242+
# man_show_urls = False
240243

241244

242245
# -- Options for Texinfo output -------------------------------------------
@@ -245,19 +248,25 @@
245248
# (source start file, target name, title, author,
246249
# dir menu entry, description, category)
247250
texinfo_documents = [
248-
('index', 'pytest-flask', u'pytest-flask Documentation',
249-
u'Vital Kudzelka', 'pytest-flask', 'One line description of project.',
250-
'Miscellaneous'),
251+
(
252+
"index",
253+
"pytest-flask",
254+
u"pytest-flask Documentation",
255+
u"Vital Kudzelka",
256+
"pytest-flask",
257+
"One line description of project.",
258+
"Miscellaneous",
259+
),
251260
]
252261

253262
# Documents to append as an appendix to all manuals.
254-
#texinfo_appendices = []
263+
# texinfo_appendices = []
255264

256265
# If false, no module index is generated.
257-
#texinfo_domain_indices = True
266+
# texinfo_domain_indices = True
258267

259268
# How to display URL addresses: 'footnote', 'no', or 'inline'.
260-
#texinfo_show_urls = 'footnote'
269+
# texinfo_show_urls = 'footnote'
261270

262271
# If true, do not generate a @detailmenu in the "Top" node's menu.
263-
#texinfo_no_detailmenu = False
272+
# texinfo_no_detailmenu = False

0 commit comments

Comments
 (0)