Skip to content

Commit 9d80cc6

Browse files
committed
fix: move None guard above yaml.dump to avoid writing null to debug file
## What Moved the `if dependabot_file is None` check above the `yaml.dump()` call in `main()` so that None results skip immediately without writing `null` to `dependabot-output.yaml`. ## Why The previous ordering called `yaml.dump(None, yaml_file)` before checking for None, writing a `null` YAML literal to the debug artifact. This was a pre-existing issue for the "no package managers" path, but the YAML error handling change made it newly reachable via the error path. ## Notes - The YAML object and stream setup also moved below the guard since they're only needed when dependabot_file is not None. Signed-off-by: jmeridth <jmeridth@gmail.com>
1 parent 421659e commit 9d80cc6

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

evergreen.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,10 @@ def main(): # pragma: no cover
187187
cooldown,
188188
)
189189

190+
if dependabot_file is None:
191+
print("\tNo (new) compatible package manager found")
192+
continue
193+
190194
yaml = ruamel.yaml.YAML()
191195
stream = io.StringIO()
192196
yaml.indent(mapping=2, sequence=4, offset=2)
@@ -195,10 +199,6 @@ def main(): # pragma: no cover
195199
with open("dependabot-output.yaml", "w", encoding="utf-8") as yaml_file:
196200
yaml.dump(dependabot_file, yaml_file)
197201

198-
if dependabot_file is None:
199-
print("\tNo (new) compatible package manager found")
200-
continue
201-
202202
dependabot_file = yaml.dump(dependabot_file, stream)
203203
dependabot_file = stream.getvalue()
204204

0 commit comments

Comments
 (0)