Skip to content

Commit c47186b

Browse files
Merge branch 'master' into updateCiGha
2 parents 5a47c68 + 50119d6 commit c47186b

File tree

9 files changed

+27
-18
lines changed

9 files changed

+27
-18
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
strategy:
1919
matrix:
2020
os: [ubuntu-latest, macos-latest, windows-latest]
21-
python: ['3.9', '3.10', '3.11', '3.12']
21+
python: ['3.9', '3.10', '3.11', '3.12', '3.13']
2222
steps:
2323
- uses: actions/checkout@v4
2424
- uses: actions/setup-python@v5

.github/workflows/pypi.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,12 @@ on:
99
- v*
1010

1111
jobs:
12-
1312
tox:
1413
runs-on: ${{ matrix.os }}
1514
strategy:
1615
matrix:
1716
os: [ubuntu-latest, macos-latest]
18-
python: ['3.9', '3.10', '3.11', '3.12']
17+
python: ['3.9', '3.10', '3.11', '3.12', '3.13']
1918
steps:
2019
- uses: actions/checkout@v4
2120
- uses: actions/setup-python@v5
@@ -40,7 +39,7 @@ jobs:
4039
- name: Set up Python
4140
uses: actions/setup-python@v5
4241
with:
43-
python-version: 3.8
42+
python-version: 3.13
4443
cache: 'pip'
4544
cache-dependency-path: |
4645
'../**/requirements*.txt'
@@ -50,6 +49,6 @@ jobs:
5049
- name: Build package
5150
run: python setup.py sdist bdist_wheel
5251
- name: Publish package
53-
uses: pypa/gh-action-pypi-publish@v1.5.0
52+
uses: pypa/gh-action-pypi-publish@release/v1
5453
with:
5554
password: ${{ secrets.pypi_password }}

.pre-commit-config.yaml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v2.3.0
3+
rev: v5.0.0
44
hooks:
55
- id: check-builtin-literals
66
args: ['--no-allow-dict-kwargs']
@@ -11,10 +11,13 @@ repos:
1111
- id: double-quote-string-fixer
1212
- id: end-of-file-fixer
1313
- id: name-tests-test
14+
- id: trailing-whitespace
15+
- repo: https://github.com/PyCQA/flake8
16+
rev: 7.1.1
17+
hooks:
1418
- id: flake8
1519
args: ['--max-line-length', '100']
1620
exclude: ^test_data/|bumpity.py$
17-
- id: trailing-whitespace
1821
- repo: https://github.com/asottile/reorder_python_imports
1922
rev: v1.6.1
2023
hooks:
@@ -25,8 +28,8 @@ repos:
2528
rev: v1.4.1
2629
hooks:
2730
- id: add-trailing-comma
28-
- repo: https://github.com/pre-commit/mirrors-autopep8
29-
rev: v1.4.4
31+
- repo: https://github.com/hhatto/autopep8
32+
rev: v2.3.1
3033
hooks:
3134
- id: autopep8
3235
- repo: local

detect_secrets/core/secrets_collection.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,10 @@ def __sub__(self, other: Any) -> 'SecretsCollection':
308308

309309
return output
310310

311+
def __len__(self) -> int:
312+
"""Returns the total number of secrets in the collection."""
313+
return sum(len(secrets) for secrets in self.data.values())
314+
311315

312316
def _scan_file_and_serialize(filename: str) -> List[PotentialSecret]:
313317
"""Used for multiprocessing, since lambdas can't be serialized."""

detect_secrets/pre_commit_hook.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,9 @@ def pretty_print_diagnostics(secrets: SecretsCollection, width: int = 80) -> Non
138138
for _, secret in secrets:
139139
print(secret)
140140

141+
# Display the number of detected secrets
142+
print(f'\nTotal secrets detected: {len(secrets)}')
143+
141144
# Display mitigation suggestions
142145
print('Possible mitigations:')
143146
wrapper = textwrap.TextWrapper(

requirements-dev-minimal.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
coverage
2-
flake8==7.0.0
2+
flake8==7.1.1
33
gibberish-detector>=0.1.1
44
monotonic
55
mypy

requirements-dev.txt

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ cfgv==3.4.0
55
charset-normalizer==3.3.2
66
coverage==7.5.3
77
distlib==0.3.8
8-
filelock==3.14.0
9-
flake8==7.0.0
8+
filelock==3.16.1
9+
flake8==7.1.1
1010
gibberish-detector==0.1.1
1111
identify==2.5.36
1212
idna==3.7
@@ -17,12 +17,12 @@ mypy==0.971
1717
mypy-extensions==1.0.0
1818
nodeenv==1.9.1
1919
packaging==24.1
20-
platformdirs==4.2.2
20+
platformdirs==4.3.6
2121
pluggy==1.5.0
2222
pre-commit==4.0.1
2323
py==1.11.0
2424
pyahocorasick==2.1.0
25-
pycodestyle==2.11.1
25+
pycodestyle==2.12.1
2626
pyflakes==3.2.0
2727
pyparsing==3.1.2
2828
pytest==7.4.3
@@ -31,13 +31,12 @@ requests==2.32.3
3131
responses==0.25.3
3232
six==1.16.0
3333
toml==0.10.2
34-
tox==4.15.0
34+
tox==4.23.2
3535
tox-pip-extensions==1.6.0
36-
typed-ast==1.5.5
3736
types-PyYAML==6.0.12.12
3837
types-requests==2.31.0.20240106
3938
typing-extensions==4.12.2
4039
unidiff==0.7.5
4140
urllib3==2.2.2
42-
virtualenv==20.26.3
41+
virtualenv==20.26.6
4342
zipp==3.19.2

tests/pre_commit_hook_test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ def test_console_output():
9898
# Assert formatting
9999
output = capturedOutput.getvalue()
100100
assert output.startswith('ERROR: Potential secrets about to be committed to git repo!')
101+
assert 'Total secrets detected: 1' in output
101102

102103

103104
def test_console_output_json_formatting():

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[tox]
22
project = detect_secrets
33
# These should match the ci python env list
4-
envlist = py{39,310,311,312},mypy
4+
envlist = py{39,310,311,312,313},mypy
55
skip_missing_interpreters = true
66

77
[testenv]

0 commit comments

Comments
 (0)