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

Some reports are not generating #15

Open
venkatesh-nagineni opened this issue Jul 31, 2024 · 20 comments
Open

Some reports are not generating #15

venkatesh-nagineni opened this issue Jul 31, 2024 · 20 comments
Assignees

Comments

@venkatesh-nagineni
Copy link

venkatesh-nagineni commented Jul 31, 2024

I am testing this lib to get some metrics (great lib that generating different metrics) but some reports were not generated like code-duplication dashboard and code-coupling etc..

Screenshot 2024-07-31 at 10 35 49

is there any reason that do not get some other folders

@helabenkhalfallah
Copy link
Owner

Hello, thank you so much for your feedback. Can you give me more details about your project structure? thank you :)

@venkatesh-nagineni
Copy link
Author

venkatesh-nagineni commented Jul 31, 2024

actually i have a src folder which contains some.ts files and .spec.ts files where i want to execute .ts files and exclude .spec.ts so there is no exclude feature to do this with in the lib, what i am doing, i create a temp-src folder which having only .ts files and then i provide this folder to the code-health-meter cli

        // Resolve the paths to be relative before passing to the command
        const relativeTempDir = path.relative(process.cwd(), tempDir);
        const relativeOutputDir = path.relative(process.cwd(), outputDir);

        // Prepare the command
        const command = `npx code-health-meter --srcDir "${relativeTempDir}" --outputDir "${relativeOutputDir}" --format "html"`;

even providing only src folder without doing alterations, getting same output

@helabenkhalfallah
Copy link
Owner

@venkatesh-nagineni
Copy link
Author

venkatesh-nagineni commented Jul 31, 2024

Screenshot 2024-07-31 at 11 38 36

here it is reproducible example
https://codesandbox.io/p/devbox/purple-thunder-5wvdl4?workspaceId=15d255a3-27ac-4d18-b352-3f6457409c76
execute this command to see it output

npx code-health-meter --srcDir "./src/components/" --outputDir "./metrics/" --format "html"

.spec.ts and e2e.ts also very common extensions to exclude or better to give power with include or exclude flag for users

update: if i provide path second level like ./src/components/my-component then it is giving duplication-report

Screenshot 2024-07-31 at 11 55 06

@helabenkhalfallah
Copy link
Owner

Thank you for the different information, I'll come back to you soon :)

@helabenkhalfallah
Copy link
Owner

I did not have access to your sandbox "Devbox not found". Can you give me the public link ? thank you!

@venkatesh-nagineni
Copy link
Author

ohh, ok give me mint

@venkatesh-nagineni
Copy link
Author

what about this link

@helabenkhalfallah
Copy link
Owner

It's working, perfect!

@helabenkhalfallah
Copy link
Owner

Hello, I download your project locally and I have the different reports:
image

However you are right about e2e test, I'll add this case to excluded files list and enable custom exclude config.
image
image

Then, the duplication analysis is done but your code does not contains any duplication:
image

Finally for security report, your code does not contains a security issue until now:
image

But I'll enhance the empty message.

@venkatesh-nagineni
Copy link
Author

venkatesh-nagineni commented Aug 1, 2024

ok, cool but still not generating code duplication reports in the reproducible example, does any OS related issues, currently i have macos using for this generation and do not see this reports at all

example shows duplication audit where does not show it in my machine

but again this is great work and great lib that no other lib generating this much of metrics (tested couple of libs)

@helabenkhalfallah
Copy link
Owner

I also use macos. I'll give you a version with error console enabled, to be able to identify the issues. I'll come back soon to you. Thank you for your patience :)

@helabenkhalfallah
Copy link
Owner

Can you run the command and paste all logs here please? thank you

@venkatesh-nagineni
Copy link
Author

here is logs from my complex project
log.txt

@helabenkhalfallah
Copy link
Owner

Aha, I have some valuables logs:

[32minfo�[39m: [CodeCouplingAuditor - startAudit] error:  Graphviz could not be found. Ensure that "gvpr" is in your $PATH. Error: spawn gvpr ENOENT

This is needed to visualize graph, I should update the document. To install in macos:

brew install graphviz || port install graphviz

And this error:

[32minfo�[39m: [CodeDuplicationAuditor - inspectDirectory] execSync error:  spawnSync /bin/sh ENOBUFS

I should update the code as follow:
https://stackoverflow.com/a/63796634/1532771

https://github.com/helabenkhalfallah/code-health-meter/blob/main/src/kernel/duplication/CodeDuplicationAuditor.js#L68
https://github.com/helabenkhalfallah/code-health-meter/blob/main/src/kernel/duplication/CodeDuplicationAuditor.js#L76

I'll work on these update and come back to you soon :) :)

@venkatesh-nagineni
Copy link
Author

found another small issue, by providing --outputDir to the command, process get deleted existing files before creating new files which is not good, keep all files inside outputDir, just create new files

may be fs.ensureDir(outputDir) that make sure the output directory exists without removing any existing files

seems issue here
https://github.com/helabenkhalfallah/code-health-meter/blob/main/src/kernel/complexity/CodeComplexityUtils.js#L396
https://github.com/helabenkhalfallah/code-health-meter/blob/main/src/kernel/coupling/CodeCouplingUtils.js#L98

@helabenkhalfallah
Copy link
Owner

helabenkhalfallah commented Sep 13, 2024

Hello I published a new version 3.0.1 to fix this issue #15 (comment) and to add new metrics. :) :)

@venkatesh-nagineni
Copy link
Author

Thx for the fix, unfortunately this new version keep on hanging at middle and does not exit the process, need to look why whereas tested npx with 2.0.0 version and works like before

@helabenkhalfallah
Copy link
Owner

Thank you so much for your feedback, should I use the same project to reproduce? can you give me more information about your:

  • OS
  • Node version

Thank you :)

@venkatesh-nagineni
Copy link
Author

venkatesh-nagineni commented Oct 4, 2024

thx for the quick reply, i can not reproduce it here

My CI Pipeline broken first then checked in my local setup

seems more related to my project where it is

Mac Os
Node: v20.9.0

process hangs at this step but reports were generated until codeCoupling, seems hangs at code duplication audit process

Screenshot 2024-10-04 at 10 22 32

I will need to check more and give you logs soon

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

No branches or pull requests

2 participants