Skip to content

Commit 55f0074

Browse files
authored
↪️ Merge pull request #317 from KevinHock/fix_316_custom_plugins_bug
🐛 Fix missing tuple() conversion
2 parents f988877 + 0c80b79 commit 55f0074

File tree

4 files changed

+27
-22
lines changed

4 files changed

+27
-22
lines changed

Diff for: CHANGELOG.md

+9
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,15 @@ If you love `detect-secrets`, please star our project on GitHub to show your sup
2828
### Unreleased
2929
-->
3030

31+
### Unreleased
32+
33+
#### :bug: Bugfixes
34+
35+
- Add missing `tuple()` conversion that raised a `TypeError` when using `scan --update` ([#317], thanks [@shaikmanu797])
36+
37+
[#317]: https://github.com/Yelp/detect-secrets/pull/317
38+
[@shaikmanu797]: https://github.com/shaikmanu797
39+
3140
# v0.14.0
3241
##### July 9th, 2020
3342

Diff for: README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ $ detect-secrets scan > .secrets.baseline
5151
```
5252
$ cat .pre-commit-config.yaml
5353
- repo: [email protected]:Yelp/detect-secrets
54-
rev: v0.13.1
54+
rev: v0.14.0
5555
hooks:
5656
- id: detect-secrets
5757
args: ['--baseline', '.secrets.baseline']

Diff for: detect_secrets/core/secrets_collection.py

+13-17
Original file line numberDiff line numberDiff line change
@@ -115,23 +115,19 @@ def load_baseline_from_dict(cls, data):
115115
# The difference will show whenever the word list changes
116116
automaton, result.word_list_hash = build_automaton(result.word_list_file)
117117

118-
# In v0.13.2 the `--custom-plugins` option got added
119-
result.custom_plugin_paths = data.get('custom_plugin_paths', ())
120-
121-
plugins = []
122-
for plugin in data['plugins_used']:
123-
plugin_classname = plugin.pop('name')
124-
plugins.append(
125-
initialize.from_plugin_classname(
126-
plugin_classname,
127-
custom_plugin_paths=result.custom_plugin_paths,
128-
exclude_lines_regex=result.exclude_lines,
129-
automaton=automaton,
130-
should_verify_secrets=False,
131-
**plugin
132-
),
133-
)
134-
result.plugins = tuple(plugins)
118+
# In v0.14.0 the `--custom-plugins` option got added
119+
result.custom_plugin_paths = tuple(data.get('custom_plugin_paths', ()))
120+
121+
result.plugins = tuple(
122+
initialize.from_plugin_classname(
123+
plugin_classname=plugin.pop('name'),
124+
custom_plugin_paths=result.custom_plugin_paths,
125+
exclude_lines_regex=result.exclude_lines,
126+
automaton=automaton,
127+
should_verify_secrets=False,
128+
**plugin
129+
) for plugin in data['plugins_used']
130+
)
135131

136132
for filename in data['results']:
137133
result.data[filename] = {}

Diff for: tests/core/secrets_collection_test.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ def setup(self):
293293
def test_output(self, mock_gmtime):
294294
assert (
295295
self.logic.format_for_baseline_output()
296-
== self.get_point_thirteen_point_two_and_later_baseline_dict(mock_gmtime)
296+
== self.get_point_fourteen_point_zero_and_later_baseline_dict(mock_gmtime)
297297
)
298298

299299
def test_load_baseline_from_string_with_pre_point_twelve_string(self, mock_gmtime):
@@ -348,7 +348,7 @@ def test_load_baseline_from_string_with_point_twelve_point_seven_and_later_strin
348348
json.dumps(original),
349349
).format_for_baseline_output()
350350

351-
# v0.13.2+ assertions
351+
# v0.14.0+ assertions
352352
assert 'custom_plugin_paths' not in original
353353
assert secrets['custom_plugin_paths'] == ()
354354

@@ -387,8 +387,8 @@ def test_load_baseline_without_exclude(self, mock_log):
387387
)
388388
assert mock_log.error_messages == 'Incorrectly formatted baseline!\n'
389389

390-
def get_point_thirteen_point_two_and_later_baseline_dict(self, gmtime):
391-
# In v0.13.2 --custom-plugins got added
390+
def get_point_fourteen_point_zero_and_later_baseline_dict(self, gmtime):
391+
# In v0.14.0 --custom-plugins got added
392392
baseline = self.get_point_twelve_point_seven_and_later_baseline_dict(gmtime)
393393
baseline['custom_plugin_paths'] = ()
394394
return baseline

0 commit comments

Comments
 (0)