diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 006b70d..1167185 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,20 +1,30 @@ # See https://pre-commit.com for more information # See https://pre-commit.com/hooks.html for more hooks repos: -- repo: https://gitlab.com/pycqa/flake8 - rev: master + - repo: local hooks: - id: flake8 -- repo: https://github.com/Yelp/detect-secrets - rev: v0.13.1 - hooks: + name: flake8 + entry: flake8 + language: system + types: [python] + require_serial: true - id: detect-secrets + name: Detect secrets + entry: detect-secrets-hook + language: system args: ['--baseline', '.secrets.baseline'] exclude: .*/tests/.* -- repo: https://github.com/pre-commit/pre-commit-hooks - rev: v2.4.0 - hooks: - id: check-added-large-files + name: Check for added large files + entry: check-added-large-files + language: system args: ['--maxkb=5120'] - id: end-of-file-fixer + name: Fix End of Files + entry: end-of-file-fixer + language: system - id: trailing-whitespace + name: Trim Trailing Whitespace + entry: trailing-whitespace-fixer + language: system diff --git a/.secrets.baseline b/.secrets.baseline index d531019..0a1306e 100644 --- a/.secrets.baseline +++ b/.secrets.baseline @@ -1,8 +1,4 @@ { - "exclude": { - "files": null, - "lines": null - }, "generated_at": "2020-10-18T09:20:33Z", "plugins_used": [ { @@ -12,8 +8,8 @@ "name": "ArtifactoryDetector" }, { - "base64_limit": 4.5, - "name": "Base64HighEntropyString" + "name": "Base64HighEntropyString", + "limit": 4.5 }, { "name": "BasicAuthDetector" @@ -22,8 +18,8 @@ "name": "CloudantDetector" }, { - "hex_limit": 3, - "name": "HexHighEntropyString" + "name": "HexHighEntropyString", + "limit": 3 }, { "name": "IbmCloudIamDetector" @@ -60,38 +56,74 @@ "results": { "tests/test_main.py": [ { + "type": "Hex High Entropy String", + "filename": "tests/test_main.py", "hashed_secret": "65b5658c038dcc7b3f9ee80669c0f26ac1441d05", - "is_secret": true, "is_verified": false, "line_number": 58, - "type": "Hex High Entropy String" + "is_secret": true }, { + "type": "Hex High Entropy String", + "filename": "tests/test_main.py", "hashed_secret": "5e18621e95bc4b9b75d7d5b097929ecfc9494078", - "is_secret": true, "is_verified": false, "line_number": 59, - "type": "Hex High Entropy String" + "is_secret": true }, { + "type": "Hex High Entropy String", + "filename": "tests/test_main.py", "hashed_secret": "2b2718d1211a6b3c6ae4ef13c63469cb1eafa6c7", - "is_secret": true, "is_verified": false, "line_number": 60, - "type": "Hex High Entropy String" + "is_secret": true }, { + "type": "Hex High Entropy String", + "filename": "tests/test_main.py", "hashed_secret": "186df42ce44b6dc5a79c097baf114cf67eb9a13b", - "is_secret": true, "is_verified": false, "line_number": 61, - "type": "Hex High Entropy String" + "is_secret": true } ] }, - "version": "0.13.1", - "word_list": { - "file": null, - "hash": null - } + "version": "1.2.0", + "filters_used": [ + { + "path": "detect_secrets.filters.allowlist.is_line_allowlisted" + }, + { + "path": "detect_secrets.filters.heuristic.is_sequential_string" + }, + { + "path": "detect_secrets.filters.heuristic.is_potential_uuid" + }, + { + "path": "detect_secrets.filters.heuristic.is_likely_id_string" + }, + { + "path": "detect_secrets.filters.heuristic.is_templated_secret" + }, + { + "path": "detect_secrets.filters.heuristic.is_prefixed_with_dollar_sign" + }, + { + "path": "detect_secrets.filters.heuristic.is_indirect_reference" + }, + { + "path": "detect_secrets.filters.common.is_ignored_due_to_verification_policies", + "min_level": 2 + }, + { + "path": "detect_secrets.filters.heuristic.is_lock_file" + }, + { + "path": "detect_secrets.filters.heuristic.is_not_alphanumeric_string" + }, + { + "path": "detect_secrets.filters.heuristic.is_swagger_file" + } + ] } diff --git a/.travis.yml b/.travis.yml index 5faaeb6..8aee150 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,24 +2,12 @@ language: python jobs: include: - - os: linux - python: "3.6" - - os: linux - python: "3.7" - os: linux python: "3.8" - os: linux - python: "3.9-dev" + python: "3.9" - os: linux python: "nightly" - - name: "Python 3.7.7 on macOS 10.14" - os: osx - osx_image: xcode11.2 - language: shell - - name: "Python 3.8.5 on macOS 10.14" - os: osx - osx_image: xcode12.2 - language: shell install: - source .envrc diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2b6bb89..a57b066 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -21,7 +21,7 @@ To contribute to this code, please make sure your system meets the following req - Unix-like operating system (macOS, Linux, …); - Load environment variables from [`.envrc`](/.envrc); -- Python 3.6 or above; and +- Python 3.8 or above; and - Python packages [installed](#installing-python-packages) from the [`requirements.txt`](./requirements.txt) file. We recommend installing [`direnv`](https://direnv.net/), and its shell hooks to load environment variables from @@ -98,9 +98,6 @@ By default, Travis CI will only deploy commits with Git tags. We work on the ass Git tags are only applied for releases, and vice versa. Tags/releases are named according to [semantic versioning][semver]. -Travis CI builds the application on Linux Python 3.6+, but only macOS Python 3.7-3.8 due to difficulties installing -different Python versions on macOS Travis CI builds. See the [`.travis.yml`](./.travis.yml) for further details. - [application]: https://shields-io-visitor-counter.herokuapp.com [detect-secrets]: https://github.com/Yelp/detect-secrets [envfile]: https://plugins.jetbrains.com/plugin/7861-envfile diff --git a/README.md b/README.md index cad1b11..af2922b 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![GPL-3.0](https://img.shields.io/github/license/ESKYoung/shields-io-visitor-counter?logo=GNU&logoColor=FFFFFF&style=flat-square)](https://github.com/ESKYoung/shields-io-visitor-counter/blob/main/LICENSE) [![GitHub release](https://img.shields.io/github/v/release/ESKYoung/shields-io-visitor-counter?logo=GitHub&logoColor=FFFFFF&style=flat-square)](https://github.com/ESKYoung/shields-io-visitor-counter) -[![Python 3.6+](https://img.shields.io/badge/python-3.6+-3776AB?logo=Python&logoColor=FFFFFF&style=flat-square)](https://www.python.org/) +[![Python 3.8+](https://img.shields.io/badge/python-3.8+-3776AB?logo=Python&logoColor=FFFFFF&style=flat-square)](https://www.python.org/) [![Travis CI](https://img.shields.io/travis/com/ESKYoung/shields-io-visitor-counter/main?logo=Travis%20CI&logoColor=FFFFFF&style=flat-square)](https://travis-ci.com/github/ESKYoung/shields-io-visitor-counter) [![Codecov](https://img.shields.io/codecov/c/github/ESKYoung/shields-io-visitor-counter/main?logo=Codecov&logoColor=FFFFFF&style=flat-square)](https://codecov.io/gh/ESKYoung/shields-io-visitor-counter) [![Visitor count](https://shields-io-visitor-counter.herokuapp.com/badge?page=ESKYoung.shields-io-visitor-counter&color=1D70B8&logo=GitHub&logoColor=FFFFFF&style=flat-square)](https://github.com/ESKYoung/shields-io-visitor-counter) diff --git a/pytest.ini b/pytest.ini index 23ec8fa..5973f05 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,5 +1,3 @@ [pytest] addopts = -vv --doctest-modules doctest_optionflags = NORMALIZE_WHITESPACE -env = - HASH_KEY=pytest diff --git a/requirements.txt b/requirements.txt index f638e15..8b0a047 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,13 +1,48 @@ -coverage -detect-secrets -flake8 -flask -gunicorn -hypothesis -pre-commit -pytest -pytest-env -pytest-mock -pytest-xdist -requests -werkzeug +attrs==21.4.0 +certifi==2022.6.15 +cfgv==3.3.1 +charset-normalizer==2.0.12 +click==8.1.3 +coverage==6.4.1 +detect-secrets==1.2.0 +distlib==0.3.4 +execnet==1.9.0 +filelock==3.7.1 +flake8==4.0.1 +Flask==2.1.2 +gunicorn==20.1.0 +hypothesis==5.49.0 +identify==2.5.1 +idna==3.3 +importlib-metadata==4.11.4 +iniconfig==1.1.1 +itsdangerous==2.1.2 +Jinja2==3.1.2 +MarkupSafe==2.1.1 +mccabe==0.6.1 +nodeenv==1.6.0 +packaging==21.3 +platformdirs==2.5.2 +pluggy==1.0.0 +pre-commit==2.19.0 +pre-commit-hooks==4.3.0 +py==1.11.0 +pycodestyle==2.8.0 +pyflakes==2.4.0 +pyparsing==3.0.9 +pytest==7.1.2 +pytest-forked==1.4.0 +pytest-mock==3.7.0 +pytest-xdist==2.5.0 +PyYAML==6.0 +requests==2.28.0 +ruamel.yaml==0.17.21 +ruamel.yaml.clib==0.2.6 +six==1.16.0 +sortedcontainers==2.4.0 +toml==0.10.2 +tomli==2.0.1 +urllib3==1.26.9 +virtualenv==20.14.1 +Werkzeug==2.1.2 +zipp==3.8.0 diff --git a/tests/conftest.py b/tests/conftest.py index 29060ba..20bcc86 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,6 +1,12 @@ +import os import pytest +def pytest_sessionstart(session): + """Set environment variables on start of the pytest session.""" + os.environ["HASH_KEY"] = "pytest" + + @pytest.fixture def patch_flask_redirect(mocker): """Patch the flask.redirect function that has been imported in main.py."""