Skip to content

Commit

Permalink
Merge pull request #125 from emarondan/adding-pre-commit
Browse files Browse the repository at this point in the history
Adding pre commit
  • Loading branch information
Gallaecio authored Nov 7, 2024
2 parents e00c152 + 0f50a65 commit 93b1469
Show file tree
Hide file tree
Showing 13 changed files with 701 additions and 567 deletions.
3 changes: 3 additions & 0 deletions .bandit.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
skips:
- B101 # assert_used, needed for mypy
- B311
- B320
- B410
exclude_dirs: ['tests']
2 changes: 2 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[flake8]
max-line-length = 88
2 changes: 2 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# applying pre-commit hooks to the project
05665a6fb1717ef513d7a8ac87b8eb499a64cdc9
19 changes: 5 additions & 14 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,6 @@ jobs:
- python-version: "2.7"
env:
TOXENV: py
- python-version: "3.4"
env:
TOXENV: py34
# 3.5 cannot be tested in CI
# https://github.com/MatteoH2O1999/setup-python/issues/49#issuecomment-2209940822
- python-version: "3.6"
env:
TOXENV: py
- python-version: "3.7"
env:
TOXENV: py
- python-version: "3.8"
env:
TOXENV: py
- python-version: "3.9"
env:
TOXENV: py
Expand Down Expand Up @@ -76,3 +62,8 @@ jobs:
run: tox
- name: Upload coverage.xml to codecov
uses: codecov/codecov-action@v1
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pre-commit/[email protected]
2 changes: 2 additions & 0 deletions .isort.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[settings]
profile = black
14 changes: 13 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
repos:
- repo: https://github.com/PyCQA/bandit
rev: 1.7.10
rev: 1.7.9
hooks:
- id: bandit
args: [-r, -c, .bandit.yml]
- repo: https://github.com/psf/black.git
rev: 24.8.0
hooks:
- id: black
- repo: https://github.com/PyCQA/flake8
rev: 7.1.1
hooks:
- id: flake8
- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: isort
67 changes: 37 additions & 30 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@
# All configuration values have a default; values that are commented out
# serve to show the default.

import sys

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
from os import path
import sys

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

Expand All @@ -34,25 +35,25 @@
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autosectionlabel',
"sphinx.ext.autosectionlabel",
]

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

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = {'.rst': 'restructuredtext'}
source_suffix = {".rst": "restructuredtext"}

# The master toctree document.
master_doc = 'index'
master_doc = "index"

# General information about the project.
project = u'scrapy-zyte-smartproxy'
copyright = u'2011-2021, Zyte Group Ltd'
author = u'Zyte'
project = "scrapy-zyte-smartproxy"
copyright = "2011-2021, Zyte Group Ltd"
author = "Zyte"

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

try:
import scrapy_zyte_smartproxy
version = '.'.join(scrapy_zyte_smartproxy.__version__.split('.')[:2])

version = ".".join(scrapy_zyte_smartproxy.__version__.split(".")[:2])
release = scrapy_zyte_smartproxy.__version__
except ImportError:
version = ''
release = ''
version = ""
release = ""

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

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
pygments_style = "sphinx"

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


# -- Options for HTMLHelp output ------------------------------------------

# Output file base name for HTML help builder.
htmlhelp_basename = 'scrapy-zyte-smartproxydoc'
htmlhelp_basename = "scrapy-zyte-smartproxydoc"


# -- Options for LaTeX output ---------------------------------------------
Expand All @@ -109,15 +111,12 @@
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',

# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',

# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',

# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
Expand All @@ -129,10 +128,10 @@
latex_documents = [
(
master_doc,
'scrapy-zyte-smartproxy.tex',
u'scrapy-zyte-smartproxy Documentation',
u'Zyte',
'manual',
"scrapy-zyte-smartproxy.tex",
"scrapy-zyte-smartproxy Documentation",
"Zyte",
"manual",
),
]

Expand All @@ -142,8 +141,13 @@
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'scrapy-zyte-smartproxy', u'scrapy-zyte-smartproxy Documentation',
[author], 1)
(
master_doc,
"scrapy-zyte-smartproxy",
"scrapy-zyte-smartproxy Documentation",
[author],
1,
)
]


Expand All @@ -153,10 +157,13 @@
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'scrapy-zyte-smartproxy', u'scrapy-zyte-smartproxy Documentation',
author, 'scrapy-zyte-smartproxy', 'One line description of project.',
'Miscellaneous'),
(
master_doc,
"scrapy-zyte-smartproxy",
"scrapy-zyte-smartproxy Documentation",
author,
"scrapy-zyte-smartproxy",
"One line description of project.",
"Miscellaneous",
),
]



4 changes: 2 additions & 2 deletions scrapy_zyte_smartproxy/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from .middleware import ZyteSmartProxyMiddleware


__version__ = '2.3.5'
__version__ = "2.3.5"
__all__ = ["ZyteSmartProxyMiddleware"]
Loading

0 comments on commit 93b1469

Please sign in to comment.