Skip to content

Commit

Permalink
fix: magic numbers
Browse files Browse the repository at this point in the history
Co-authored-by: jmeridth <[email protected]>
Signed-off-by: Zack Koppert <[email protected]>
  • Loading branch information
zkoppert and jmeridth committed May 30, 2024
1 parent 9bb6f10 commit b687188
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions dependabot_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,20 +59,21 @@ def build_dependabot_file(
"terraform": False,
"github-actions": False,
}
DEFAULT_INDENT = 2

if existing_config:
dependabot_file = existing_config.decoded.decode("utf-8")
directory_line = next(
line for line in dependabot_file.splitlines() if "directory:" in line
)
indent = " " * (len(directory_line) - len(directory_line.lstrip()))
if len(indent) < 2:
if len(indent) < DEFAULT_INDENT:
print(
"Invalid dependabot.yml file. No indentation found. Skipping {repo.full_name}"
)
return None
else:
indent = " " * 2
indent = " " * DEFAULT_INDENT
dependabot_file = """---
version: 2
updates:
Expand Down

0 comments on commit b687188

Please sign in to comment.