WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Conversation

@zhoufenqin
Copy link
Contributor

@zhoufenqin zhoufenqin commented Apr 22, 2025

The kantra dir setting is not correctly, when user configure the kantra path to PATH environment, it should support running the kantra from the configuration path. E.g. PATH=$PATH:/home/user1/kantra-0.6.2. then in any folder, "kantra analyze xxx" should be work.

But currently, it only support running from a folder or fall back to $home/.kantra. not a normal way to process CLI command
image

@zhoufenqin zhoufenqin force-pushed the fenzho/fix-kantra-path branch from 02e2bf2 to 3ce7bce Compare April 22, 2025 13:53
@github-actions
Copy link

github-actions bot commented Nov 4, 2025

This pull request has been automatically marked as stale because it has not had any activity for 60 days.
It will remain open for visibility and reporting purposes.
Please comment if this PR is still relevant.

@github-actions github-actions bot added the stale label Nov 4, 2025
@tsanders-rh
Copy link
Contributor

This PR is still valid and addresses a real bug! ✅

Issue Still Exists in Main

The current setKantraDir() implementation uses os.Getwd() which checks the current working directory instead of the executable's location. This breaks the common CLI pattern of installing to PATH.

Example scenario:

# User installs kantra to /usr/local/bin/kantra
# User runs from any directory:
cd ~/myproject
kantra analyze --input .
# ❌ Looks for rulesets/ in ~/myproject (not found)
# ❌ Falls back to ~/.kantra
# ❌ Never checks /usr/local/bin/ where kantra is actually installed

Your fix using os.Executable() is the correct approach - it's how standard CLI tools work.

Needs DCO Sign-off

The only blocker is the missing DCO sign-off. To fix:

# Add sign-off to your commit
git commit --amend --signoff --no-edit
git push --force

Or if you prefer to keep the commit as-is, add a comment:

I, zhoufenqin, agree to license my contributions under the DCO.

Signed-off-by: Your Name <[email protected]>

This is a valuable fix - would love to see it merged! Let me know if you need any help with the DCO or rebasing on latest main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants