Git Product home page Git Product logo

Comments (5)

tbillington avatar tbillington commented on May 18, 2024

I run into that even on this project :) the kondo-ui subdirectory is not part of the workspace so it has it's own target directory, which is skipped because it's inside a project.

The code causing this is here

kondo/kondo-lib/src/lib.rs

Lines 224 to 225 in 7a549b6

if let Some(project_type) = p_type {
self.it.skip_current_dir();
Essentially, stop recursing if a project is found. This is helpful in nodejs projects because node_modules has projects within, and it's not useful to work with those. It also gave a massive speed boost because of how much work it could skip.

Perhaps this decision should be on a project type basis.

from kondo.

qm3ster avatar qm3ster commented on May 18, 2024

Or a project type basis. With node_modules you either want to delete the whole tree, including transient dependencies, or you want to keep all of it.
But with Rust target, the other targets are not under the top target. In fact both specifically examples and any other workspace/non-workspace nested projects are whole projects, precisely because they are source projects and not just published dependencies.
So, should it ask for each nested project, or just once for the topmost project and apply that ruling to all nested projects? 🤔

Also sometimes you have node_modules in Rust projects and Rust target in npm module projects...

from kondo.

tbillington avatar tbillington commented on May 18, 2024

That's a good point, I hadn't considered directories that are more than one type of project, eg cargo and node project. Hmm... I'll have to think on that, also how to recurse directories that are not artifacts of the current project, the implementation now might make that a little tricky.

from kondo.

qm3ster avatar qm3ster commented on May 18, 2024

Still, at least looking at just Rust and nodejs, it seems like differentiating between:

  • artifact directories (delete, never enter)
  • literally everything else (don't delete, recurse)

should be sufficient?

So:

  1. get directory listing (actually collect to memory), while looking for marker files that signify a project. You can actually collect into two Vecs by DirEntry::file_type() which unlike metadata() is said not to involve additional syscalls.
  2. look through directory listing, looking for marker files and immediately mark the corresponding artifacts for "deletion".
  3. recurse on directories that have not been marked.

from kondo.

tbillington avatar tbillington commented on May 18, 2024

That makes sense. I'll think through it. I think this might also be a good opportunity to add integration tests for the project, and model these situations.

from kondo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.