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

Class-level TCC and LCC metrics output 0 or -1 if variables and fields metrics are disabled #100

Open
escapar opened this issue Jun 1, 2022 · 2 comments

Comments

@escapar
Copy link

escapar commented Jun 1, 2022

This issue is easy to reproduce using the codebase of the current snapshot, so I don't attach any code or screenshot.
I believe it is a bug, since the toggle for variables and field metrics should not affect the results for class-level metrics.
Will make PRs if I can fix it.

@mauricioaniche
Copy link
Owner

Thanks for reporting it! If you can submit a failing test, that'd be awesome!

@escapar
Copy link
Author

escapar commented Jun 5, 2022

I wrote a test but surprisingly TCC and LCC were always 0,-1,or NaN, even if I simulate user's input (programmatically calling directly Runner.main). This is not correct but still slightly different from the case in the description. To clarify I run tests on the hibernate-orm project.

However, if I add breakpoints and debug from IDE and execute from Runner using customized arguments, things went different.
For example, in setResult method of TightClassCohesion.java, if variablesAndFields is set as True, the directConnections and indirectConnections sets are correctly populated. If variablesAndFields is false, the 2 sets are empty, and thus the result of the TCC is 0.

I will try to reproduce it using more test cases. Please let me know if I got something wrong.

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