restechnica / semverbot

A CLI which automates semver versioning.
Mozilla Public License 2.0
136 stars 7 forks source link

Non semverbot config files are used when no semverbot config exists #74

Open uglybug opened 6 months ago

uglybug commented 6 months ago

Environment

Semverbot Version: 1.6.3 (darwin arm64) - Though this also happens in 1.6.2 and maybe earlier (not tested).

Summary

If there is no config file in the default search paths:

Then semverbot will try to find config in non semverbot files and throw errors

Recreation Steps

mkdir test
cd test
git init
echo "{}" > config.json
sbot get version

This causes the following error:

Error: While parsing config: toml: invalid character at start of key: {

Which is because it is trying to get config from ./config.json which is definitely not documented behaviour.

If we look at the debug logging, it is even more curious, as it seems to think that this config.json is actually .semverbot/config.toml:

11:25:55 DBG starting pre-run... command=root
11:25:55 DBG loading default config values...
11:25:55 DBG loading config file... path=.semverbot.toml
11:25:55 WRN config file .semverbot.toml not found
11:25:55 DBG loading config file... path=.sbot.toml
11:25:55 WRN config file .sbot.toml not found
11:25:55 DBG loading config file... path=.semverbot/config.toml
Error: While parsing config: toml: invalid character at start of key: {