Skip to content

Commit 93b1469

Browse files
authored
Merge pull request #125 from emarondan/adding-pre-commit
Adding pre commit
2 parents e00c152 + 0f50a65 commit 93b1469

File tree

13 files changed

+701
-567
lines changed

13 files changed

+701
-567
lines changed

.bandit.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
skips:
22
- B101 # assert_used, needed for mypy
3+
- B311
4+
- B320
5+
- B410
36
exclude_dirs: ['tests']

.flake8

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[flake8]
2+
max-line-length = 88

.git-blame-ignore-revs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# applying pre-commit hooks to the project
2+
05665a6fb1717ef513d7a8ac87b8eb499a64cdc9

.github/workflows/main.yml

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,6 @@ jobs:
1717
- python-version: "2.7"
1818
env:
1919
TOXENV: py
20-
- python-version: "3.4"
21-
env:
22-
TOXENV: py34
23-
# 3.5 cannot be tested in CI
24-
# https://github.com/MatteoH2O1999/setup-python/issues/49#issuecomment-2209940822
25-
- python-version: "3.6"
26-
env:
27-
TOXENV: py
28-
- python-version: "3.7"
29-
env:
30-
TOXENV: py
31-
- python-version: "3.8"
32-
env:
33-
TOXENV: py
3420
- python-version: "3.9"
3521
env:
3622
TOXENV: py
@@ -76,3 +62,8 @@ jobs:
7662
run: tox
7763
- name: Upload coverage.xml to codecov
7864
uses: codecov/codecov-action@v1
65+
pre-commit:
66+
runs-on: ubuntu-latest
67+
steps:
68+
- uses: actions/checkout@v4
69+
- uses: pre-commit/[email protected]

.isort.cfg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[settings]
2+
profile = black

.pre-commit-config.yaml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11
repos:
22
- repo: https://github.com/PyCQA/bandit
3-
rev: 1.7.10
3+
rev: 1.7.9
44
hooks:
55
- id: bandit
66
args: [-r, -c, .bandit.yml]
7+
- repo: https://github.com/psf/black.git
8+
rev: 24.8.0
9+
hooks:
10+
- id: black
11+
- repo: https://github.com/PyCQA/flake8
12+
rev: 7.1.1
13+
hooks:
14+
- id: flake8
15+
- repo: https://github.com/pycqa/isort
16+
rev: 5.13.2
17+
hooks:
18+
- id: isort

docs/conf.py

Lines changed: 37 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,13 @@
1212
# All configuration values have a default; values that are commented out
1313
# serve to show the default.
1414

15+
import sys
16+
1517
# If extensions (or modules to document with autodoc) are in another directory,
1618
# add these directories to sys.path here. If the directory is relative to the
1719
# documentation root, use os.path.abspath to make it absolute, like shown here.
1820
#
1921
from os import path
20-
import sys
2122

2223
sys.path.insert(0, path.dirname(path.dirname(__file__)))
2324

@@ -34,25 +35,25 @@
3435
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
3536
# ones.
3637
extensions = [
37-
'sphinx.ext.autosectionlabel',
38+
"sphinx.ext.autosectionlabel",
3839
]
3940

4041
# Add any paths that contain templates here, relative to this directory.
41-
templates_path = ['_templates']
42+
templates_path = ["_templates"]
4243

4344
# The suffix(es) of source filenames.
4445
# You can specify multiple suffix as a list of string:
4546
#
4647
# source_suffix = ['.rst', '.md']
47-
source_suffix = {'.rst': 'restructuredtext'}
48+
source_suffix = {".rst": "restructuredtext"}
4849

4950
# The master toctree document.
50-
master_doc = 'index'
51+
master_doc = "index"
5152

5253
# General information about the project.
53-
project = u'scrapy-zyte-smartproxy'
54-
copyright = u'2011-2021, Zyte Group Ltd'
55-
author = u'Zyte'
54+
project = "scrapy-zyte-smartproxy"
55+
copyright = "2011-2021, Zyte Group Ltd"
56+
author = "Zyte"
5657

5758
# The version info for the project you're documenting, acts as replacement for
5859
# |version| and |release|, also used in various other places throughout the
@@ -61,19 +62,20 @@
6162

6263
try:
6364
import scrapy_zyte_smartproxy
64-
version = '.'.join(scrapy_zyte_smartproxy.__version__.split('.')[:2])
65+
66+
version = ".".join(scrapy_zyte_smartproxy.__version__.split(".")[:2])
6567
release = scrapy_zyte_smartproxy.__version__
6668
except ImportError:
67-
version = ''
68-
release = ''
69+
version = ""
70+
release = ""
6971

7072
# List of patterns, relative to source directory, that match files and
7173
# directories to ignore when looking for source files.
7274
# This patterns also effect to html_static_path and html_extra_path
73-
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
75+
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
7476

7577
# The name of the Pygments (syntax highlighting) style to use.
76-
pygments_style = 'sphinx'
78+
pygments_style = "sphinx"
7779

7880
# If true, `todo` and `todoList` produce output, else they produce nothing.
7981
todo_include_todos = False
@@ -94,13 +96,13 @@
9496
# Add any paths that contain custom static files (such as style sheets) here,
9597
# relative to this directory. They are copied after the builtin static files,
9698
# so a file named "default.css" will overwrite the builtin "default.css".
97-
#html_static_path = ['_static']
99+
# html_static_path = ['_static']
98100

99101

100102
# -- Options for HTMLHelp output ------------------------------------------
101103

102104
# Output file base name for HTML help builder.
103-
htmlhelp_basename = 'scrapy-zyte-smartproxydoc'
105+
htmlhelp_basename = "scrapy-zyte-smartproxydoc"
104106

105107

106108
# -- Options for LaTeX output ---------------------------------------------
@@ -109,15 +111,12 @@
109111
# The paper size ('letterpaper' or 'a4paper').
110112
#
111113
# 'papersize': 'letterpaper',
112-
113114
# The font size ('10pt', '11pt' or '12pt').
114115
#
115116
# 'pointsize': '10pt',
116-
117117
# Additional stuff for the LaTeX preamble.
118118
#
119119
# 'preamble': '',
120-
121120
# Latex figure (float) alignment
122121
#
123122
# 'figure_align': 'htbp',
@@ -129,10 +128,10 @@
129128
latex_documents = [
130129
(
131130
master_doc,
132-
'scrapy-zyte-smartproxy.tex',
133-
u'scrapy-zyte-smartproxy Documentation',
134-
u'Zyte',
135-
'manual',
131+
"scrapy-zyte-smartproxy.tex",
132+
"scrapy-zyte-smartproxy Documentation",
133+
"Zyte",
134+
"manual",
136135
),
137136
]
138137

@@ -142,8 +141,13 @@
142141
# One entry per manual page. List of tuples
143142
# (source start file, name, description, authors, manual section).
144143
man_pages = [
145-
(master_doc, 'scrapy-zyte-smartproxy', u'scrapy-zyte-smartproxy Documentation',
146-
[author], 1)
144+
(
145+
master_doc,
146+
"scrapy-zyte-smartproxy",
147+
"scrapy-zyte-smartproxy Documentation",
148+
[author],
149+
1,
150+
)
147151
]
148152

149153

@@ -153,10 +157,13 @@
153157
# (source start file, target name, title, author,
154158
# dir menu entry, description, category)
155159
texinfo_documents = [
156-
(master_doc, 'scrapy-zyte-smartproxy', u'scrapy-zyte-smartproxy Documentation',
157-
author, 'scrapy-zyte-smartproxy', 'One line description of project.',
158-
'Miscellaneous'),
160+
(
161+
master_doc,
162+
"scrapy-zyte-smartproxy",
163+
"scrapy-zyte-smartproxy Documentation",
164+
author,
165+
"scrapy-zyte-smartproxy",
166+
"One line description of project.",
167+
"Miscellaneous",
168+
),
159169
]
160-
161-
162-

scrapy_zyte_smartproxy/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
from .middleware import ZyteSmartProxyMiddleware
22

3-
4-
__version__ = '2.3.5'
3+
__version__ = "2.3.5"
4+
__all__ = ["ZyteSmartProxyMiddleware"]

0 commit comments

Comments
 (0)