Skip to content
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

Goes to infinite loop #868

Open
Akiyamka opened this issue Dec 15, 2023 · 2 comments
Open

Goes to infinite loop #868

Akiyamka opened this issue Dec 15, 2023 · 2 comments
Labels

Comments

@Akiyamka
Copy link

Akiyamka commented Dec 15, 2023

Bug Description

After run command npx depcheck . in project with about 900 files it just hung.
It continues to create a load on the CPU, but after 50 minutes of waiting I concluded that this is not expected behavior
I didn't find any verbose flags or anything like that.

& time npx depcheck .
^C
> npx depcheck .  4112.94s user 1209.58s system 162% cpu 54:35.66 total

Steps

  1. clone https://github.com/konturio/disaster-ninja-fe
  2. npx depcheck .
  3. it never completes, or it completes after an inordinate amount of time.

Actually I noticed that even to show the version or --help it takes the utility as much as 3.77s

time npx depcheck --version
1.4.7
npx depcheck --version  3.77s user 3.25s system 203% cpu 3.438 total

Versions

  • node -v: v20.8.0
  • npm -v: 10.1.0
  • depcheck --version: 1.4.7

Extra info

The problem is definitely not in the hardware.

CPU: AMD Ryzen 7 5800H with Radeon Graphics (16) @ 4.463GHz
16GB RAM
SSD drive
@Akiyamka Akiyamka added the bug label Dec 15, 2023
@znarf
Copy link
Collaborator

znarf commented Dec 23, 2023

I tried to reproduce and it executed in 2 seconds.

Run with DEBUG=depcheck:* npx depcheck . and see if there is anything odd.

@Akiyamka
Copy link
Author

Akiyamka commented Feb 12, 2024

@znarf thank you for the tip.

As it turned out, the reason for this behavior is that the crawler left the project directory following symlinks and went to index half of my operating system XD.

Context:

We use devbox that create .devbox dir in project, and provide virtual environment for project (node, java, go, docker etc.).
I ran depcheck with the . --ignore-path=.gitignore parameter, assuming that this folder would be ignored, but I forgot that this folder is ignored by git because it has .gitignore inside it. (another way to ignore dirs).

In fact, there are tons of ways to ignore folders,
and it may be difficult to list them all manually to pass them to a --ignore-path parameter.

Possible solution:

I think a good solution would be to ask the git directly which files to ignore. Something like depcheck --ignore-gitignored, and when it enabled depcheck uses command git ls-files --others to determine what doesn't need to be checked

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants