Skip to content

Commit

Permalink
fix(pre-com): Fix pre-commit errors #50 (#51)
Browse files Browse the repository at this point in the history
* fix(pre-com): Comment out safety-dep-chk #50

The pre-commit.ci action is still failing. I have commented the check
below out to see if the new failure stops.

 - repo: https://github.com/Lucas-C/pre-commit-hooks-safety
       rev: v1.2.1
       hooks:
           - id: python-safety-dependencies-check

WIP #50

* chore(pre-commit): Auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix(pre-com): Fix unknown escape character #50

Add an escape character to fix yaml check failure.

WIP #50

* fix(pre-com): Fix pre-commit errors #50

Some code that did not pass pre-commit checks existed.
All pre-commit tests passed locally.

closes #50

* fix(pre-com): Comment out safety-dep-chk #50

The pre-commit.ci action is still failing. I have commented the check
below out to see if the new failure stops.
 - repo: https://github.com/Lucas-C/pre-commit-hooks-safety
       rev: v1.2.1
       hooks:
           - id: python-safety-dependencies-check

WIP #50

* fix(codacy): Docstrings comply with PEP257 #50

Several docstrings failed Codacy production tests as not complying
with PEP257.

WIP #50

* fix(codacy): More docstrings comply PEP257 #50

Several additional  docstrings failed Codacy production tests as not
complying with PEP257.

WIP #50

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
imAsparky and pre-commit-ci[bot] committed Sep 6, 2021
1 parent 41d893e commit 9360c7f
Show file tree
Hide file tree
Showing 8 changed files with 157 additions and 68 deletions.
12 changes: 7 additions & 5 deletions .pre-commit-config.yaml
@@ -1,6 +1,8 @@
default_stages: [commit]
fail_fast: true
exclude: "conf.py"
exclude: ".conf.py|^tests/|^{{cookiecutter.project_slug}}/"
# {{cookiecutter.project_slug}} has been excluded until I start adapting
# that area.

ci:
autofix_commit_msg: |
Expand All @@ -20,10 +22,10 @@ repos:
# - id: forbid-crlf
# - id: remove-crlf

- repo: https://github.com/Lucas-C/pre-commit-hooks-safety
rev: v1.2.1
hooks:
- id: python-safety-dependencies-check
# - repo: https://github.com/Lucas-C/pre-commit-hooks-safety
# rev: v1.2.1
# hooks:
# - id: python-safety-dependencies-check

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
Expand Down
58 changes: 29 additions & 29 deletions appveyor.yml
Expand Up @@ -2,50 +2,50 @@
# http://www.appveyor.com/docs/installed-software#python

environment:
matrix:
- PYTHON: "C:\\Python35"
TOX_ENV: "py35"
matrix:
- PYTHON: "C:\\Python35"
TOX_ENV: "py35"

- PYTHON: "C:\\Python35-x64"
TOX_ENV: "py35"
- PYTHON: "C:\\Python35-x64"
TOX_ENV: "py35"

- PYTHON: "C:\\Python36"
TOX_ENV: "py36"
- PYTHON: "C:\\Python36"
TOX_ENV: "py36"

- PYTHON: "C:\\Python36-x64"
TOX_ENV: "py36"
- PYTHON: "C:\\Python36-x64"
TOX_ENV: "py36"

- PYTHON: "C:\\Python37"
TOX_ENV: "py37"
- PYTHON: "C:\\Python37"
TOX_ENV: "py37"

- PYTHON: "C:\\Python37-x64"
TOX_ENV: "py37"
- PYTHON: "C:\\Python37-x64"
TOX_ENV: "py37"

- PYTHON: "C:\\Python38"
TOX_ENV: "py38"
- PYTHON: "C:\\Python38"
TOX_ENV: "py38"

- PYTHON: "C:\\Python38-x64"
TOX_ENV: "py38"
- PYTHON: "C:\\Python38-x64"
TOX_ENV: "py38"

init:
- set PATH=%PYTHON%;%PYTHON%\Scripts;C:\MinGW\msys\1.0\bin;%PATH%
- "git config --system http.sslcainfo \"C:\\Program Files\\Git\\mingw64\\ssl\\certs\\ca-bundle.crt\""
- "%PYTHON%/python -V"
- "%PYTHON%/python -c \"import struct;print(8 * struct.calcsize(\'P\'))\""
- set PATH=%PYTHON%;%PYTHON%\Scripts;C:\MinGW\msys\1.0\bin;%PATH%
- "git config --system http.sslcainfo \"C:\\Program Files\\Git\\mingw64\\ssl\\certs\\ca-bundle.crt\""
- "%PYTHON%/python -V"
- \"%PYTHON%/python -c \"import struct;print(8 * struct.calcsize(\'P\'))\""

install:
- "%PYTHON%/Scripts/easy_install -U pip"
- "%PYTHON%/Scripts/pip install -U tox virtualenv"
- "%PYTHON%/Scripts/pip install wheel"
- "%PYTHON%/Scripts/easy_install -U pip"
- "%PYTHON%/Scripts/pip install -U tox virtualenv"
- "%PYTHON%/Scripts/pip install wheel"

build: false # Not a C# project, build stuff at the test step instead.
build: false # Not a C# project, build stuff at the test step instead.

test_script:
- "%PYTHON%/Scripts/tox -e %TOX_ENV%"
- "%PYTHON%/Scripts/tox -e %TOX_ENV%"

after_test:
- "%PYTHON%/python setup.py --command-packages wheel bdist_wheel"
- ps: "ls dist"
- "%PYTHON%/python setup.py --command-packages wheel bdist_wheel"
- ps: "ls dist"

artifacts:
- path: dist\*
- path: dist\*
18 changes: 10 additions & 8 deletions hooks/post_gen_project.py
@@ -1,22 +1,24 @@
#!/usr/bin/env python
"""cookiecutter-p3-package post package generation jobs."""
import os

PROJECT_DIRECTORY = os.path.realpath(os.path.curdir)


def remove_file(filepath):
"""Remove files not required for this generated python package."""
os.remove(os.path.join(PROJECT_DIRECTORY, filepath))


if __name__ == '__main__':
if __name__ == "__main__":

if '{{ cookiecutter.create_author_file }}' != 'y':
remove_file('AUTHORS.rst')
remove_file('docs/authors.rst')
if "{{ cookiecutter.create_author_file }}" != "y":
remove_file("AUTHORS.rst")
remove_file("docs/authors.rst")

if 'no' in '{{ cookiecutter.command_line_interface|lower }}':
cli_file = os.path.join('{{ cookiecutter.project_slug }}', 'cli.py')
if "no" in "{{ cookiecutter.command_line_interface|lower }}":
cli_file = os.path.join("{{ cookiecutter.project_slug }}", "cli.py")
remove_file(cli_file)

if 'Not open source' == '{{ cookiecutter.open_source_license }}':
remove_file('LICENSE')
if "Not open source" == "{{ cookiecutter.open_source_license }}":
remove_file("LICENSE")
19 changes: 12 additions & 7 deletions hooks/pre_gen_project.py
@@ -1,13 +1,18 @@
"""cookiecutter-p3-package pre package generation jobs."""

import re
import sys

MODULE_REGEX = r"^[_a-zA-Z][_a-zA-Z0-9]+$"

MODULE_REGEX = r'^[_a-zA-Z][_a-zA-Z0-9]+$'

module_name = '{{ cookiecutter.project_slug}}'
MODULE_NAME = "{{ cookiecutter.project_slug}}"

if not re.match(MODULE_REGEX, module_name):
print('ERROR: The project slug (%s) is not a valid Python module name. Please do not use a - and use _ instead' % module_name)
if not re.match(MODULE_REGEX, MODULE_NAME):
print(
"ERROR: The project slug (%s) is not a valid Python module name.\
Please do not use a - and use _ instead"
% MODULE_NAME
)

#Exit to cancel project
sys.exit(1)
# Exit to cancel project
sys.exit(1)
2 changes: 1 addition & 1 deletion requirements_dev.txt
@@ -1,5 +1,5 @@
alabaster==0.7.12
cookiecutter>=1.4.0
cookiecutter==1.4.0
furo==2021.8.11b42
myst-parser==0.15.2
Sphinx==4.1.2
Expand Down

0 comments on commit 9360c7f

Please sign in to comment.