code_metrics icon indicating copy to clipboard operation
code_metrics copied to clipboard

Add default test directory descriptions to Statistics::TEST_TYPES.

Open jimtreadway opened this issue 10 years ago • 5 comments

"Test LOC" is always 0 unless you have manually configured test your test directories via CodeMetrics::StatsDirectories#add_test_directory, CodeMetrics::StatsDirectories#add_test_directories, etc.

Modify CodeMetrics::Statistics#initialize so that the default test directories are also added to the CodeMetrics::Statistics::TEST_TYPES array. This allows CodeMetrics::Statistics#calculate_tests to work in the default configuration case (eg., when using "metric_fu" without and custom "code_metrics" configuration changes).

Also, add a dummy controller test and adjust the expected results in the test_code_metrics_sanity to look for the correct, updated values for "Test LOC" and "Code to Test Ratio".

jimtreadway avatar Aug 21 '15 05:08 jimtreadway

Well, ruby-2.0 works. The other versions are failing CI, but I don't think this is a new problem...

jimtreadway avatar Aug 21 '15 05:08 jimtreadway

Looks good, thanks!

bf4 avatar Aug 21 '15 05:08 bf4

Sorry about the test failures. I haven't worked on this in a while (because there's not much to do), so I guess the deps have changed in a non-pessimistic way. I'll take a look at what Rails might have changed.

bf4 avatar Aug 21 '15 05:08 bf4

No worries. I only noticed it because "metric_fu" uses "code_metrics" for graphing, and I just ran it again on a new project and figured I might as well investigate this time.

jimtreadway avatar Aug 21 '15 05:08 jimtreadway

@jimtreadway Would you like if I added you as a collaborator so you can help bring this completion? I've just very distracted with other things right now.

bf4 avatar Sep 04 '15 08:09 bf4