-
-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"kondo ." does not work inside $HOME #55
Comments
That doesn't sound good! Which OS are you on? Also, does it find the project when you supply a path of a project as an argument? |
If you'd like to have a crack at debugging it, you can put this statement in between these two lines then run from root of kondo println!("{}", entry.path().to_string_lossy()); https://github.com/tbillington/kondo/blob/master/kondo-lib/src/lib.rs#L221-L222 |
I can also see that the I'm on majaro linux. When I use "kondo ." from a different directory, or "kondo some/directory/" from withing my home directory root, it works fine. |
It does not work in NixOS as well. However, I am actually not inside home but a subdirectory: |
Hmm, are you supplying the path, or relying on kondo detecting the current dir? If you don't supply the path it will fall back to Line 32 in 72f9b5c
|
@tbillington I used |
Hmmm, potentially some combo with current env.. If it's not an absolute path according to std it will join it with what std detects as the current env... Line 358 in 72f9b5c
If you have the rust toolchain could you please modify fn prepare_directories(dirs: Vec<PathBuf>) -> Result<Vec<PathBuf>, Box<dyn Error>> {
let cd = dbg!(current_dir()?);
if dirs.is_empty() {
return Ok(vec![cd]);
}
dirs.into_iter()
.map(|d| dbg!(path_canonicalise(&cd, d)))
.collect()
} |
Hmm, I can see that in both case,
|
Mmh, it seems that in both cases,
|
Oooh!
So I guess what happens is, kondo searches for a directory, and checks if it is some kind of project directory IF IT IS NOT it recurses into it and walks it recursively BUT IF IT IS, it is marked for cache-scrubbing or something. I assume in my case, I have something in my $HOME root that makes kondo think "this is a node project!" so it tries to delete whatever node uses as target-dir equivalent (compared to rust), fails and then gives up, because it only had that one "project" to check? The solution might be still recurse into project directories and look for further project dirs, even after we deleted whatever cache there was in..? |
So I have not tried this, but you can probably also confuse kondo by adding something like a |
Thank you for digging into this @matthiaskrgr . I think you've stumbled onto this issue: #29 and #32. As you've discovered, kondo bails when it detects a directory as a project, and won't recurse further. In a much earlier version the behaviour was the opposite. However, certain types of projects, like There is a middle ground where you recurse directories that aren't marked as artifact directories, however I just haven't spent the time to sit down and refactor the walking logic to support that yet. Do you have any thoughts on how you'd prefer it act in this situation? |
I guess we could treat directories that we get passed explicitly such as
|
@matthiaskrgr I think that would be too opinionated. I commonly run kondo while in a project directory I want to clean/check, or pass the project dir to kondo like |
When cwd is the root of my home directory (
~
) and I runkondo
orkondo .
, it just displaysTotal bytes deleted: 0.0B
and does not even start searching through any directories it looks like.kondo 0.4.0
edit: same with kondo @ 71d7539
The text was updated successfully, but these errors were encountered: