linux-test-project / lcov

LCOV
GNU General Public License v2.0
867 stars 235 forks source link

lcov: ERROR: Can't call method "count_totals" without a package or object reference #247

Closed hrishikesh-kadam closed 7 months ago

hrishikesh-kadam commented 8 months ago
Input coverage/lcov.info ``` SF:lib/src/dio/response.dart DA:7,1 DA:8,1 LF:2 LH:2 end_of_record SF:lib/src/dio/response.mocks.dart DA:27,0 DA:30,0 DA:37,0 DA:40,0 DA:47,0 DA:50,0 DA:60,0 DA:61,0 DA:62,0 DA:69,0 DA:70,0 DA:71,0 DA:72,0 DA:74,0 DA:76,0 DA:78,0 DA:82,0 DA:83,0 DA:84,0 DA:91,0 DA:92,0 DA:93,0 DA:100,0 DA:101,0 DA:102,0 DA:109,0 DA:110,0 DA:111,0 DA:112,0 DA:114,0 DA:116,0 DA:118,0 DA:122,0 DA:123,0 DA:124,0 DA:131,0 DA:132,0 DA:133,0 DA:138,0 DA:139,0 DA:140,0 DA:147,0 DA:148,0 DA:149,0 DA:150,0 DA:151,0 DA:154,0 DA:155,0 DA:156,0 DA:163,0 DA:164,0 DA:165,0 DA:166,0 DA:167,0 DA:170,0 DA:171,0 DA:172,0 DA:179,0 DA:180,0 DA:181,0 DA:182,0 DA:184,0 DA:186,0 DA:188,0 LF:64 LH:0 end_of_record SF:lib/src/services/ssd_cneos/sbdb_cad_api/data/sbdb_cad_body/sbdb_cad_body.dart DA:6,2 DA:8,2 DA:10,2 DA:12,1 DA:14,1 DA:16,1 DA:18,1 DA:20,1 DA:22,1 DA:24,1 DA:28,2 DA:29,4 DA:32,2 DA:33,2 DA:34,2 DA:35,2 LF:16 LH:16 end_of_record SF:lib/src/services/ssd_cneos/sbdb_cad_api/sbdb_cad_api.dart DA:16,1 DA:18,1 DA:20,1 DA:24,1 DA:25,2 DA:28,1 DA:32,1 DA:33,3 DA:34,1 DA:35,1 DA:36,1 DA:37,1 DA:38,4 DA:42,1 DA:43,1 DA:44,4 DA:45,5 DA:49,1 DA:52,1 DA:53,3 DA:54,1 DA:55,1 DA:56,1 DA:57,1 DA:58,1 DA:62,1 DA:67,2 DA:68,1 DA:69,4 DA:70,4 DA:71,1 DA:73,1 LF:32 LH:32 end_of_record SF:lib/src/services/ssd_cneos/sbdb_cad_api/sbdb_cad_api.mocks.dart DA:26,1 DA:29,1 DA:39,1 DA:46,1 DA:47,1 DA:49,1 DA:50,1 DA:57,1 DA:58,1 DA:60,1 DA:62,1 DA:63,1 DA:72,1 DA:73,1 DA:75,1 DA:77,1 DA:78,1 LF:17 LH:17 end_of_record ```
Output coverage/lcov.info.tmp ``` TN: SF:lib/src/dio/response.dart FNF:0 FNH:0 DA:7,1 DA:8,1 LF:2 LH:2 end_of_record TN: SF:lib/src/services/ssd_cneos/sbdb_cad_api/data/sbdb_cad_body/sbdb_cad_body.dart FNF:0 FNH:0 DA:6,2 DA:8,2 DA:10,2 DA:12,1 DA:14,1 DA:16,1 DA:18,1 DA:20,1 DA:22,1 DA:24,1 DA:28,2 DA:29,4 DA:32,2 DA:33,2 DA:34,2 DA:35,2 LF:16 LH:16 end_of_record TN: SF:lib/src/services/ssd_cneos/sbdb_cad_api/sbdb_cad_api.dart FNF:0 FNH:0 DA:16,1 DA:18,1 DA:20,1 DA:24,1 DA:25,2 DA:28,1 DA:32,1 DA:33,3 DA:34,1 DA:35,1 DA:36,1 DA:37,1 DA:38,4 DA:42,1 DA:43,1 DA:44,4 DA:45,5 DA:49,1 DA:52,1 DA:53,3 DA:54,1 DA:55,1 DA:56,1 DA:57,1 DA:58,1 DA:62,1 DA:67,2 DA:68,1 DA:69,4 DA:70,4 DA:71,1 DA:73,1 LF:32 LH:32 end_of_record ```

Getting expected output but fails as follows.
Thought of reporting.

$ lcov --remove coverage/lcov.info "*.mocks.dart" --output-file coverage/lcov.info.tmp
Excluding lib/src/dio/response.mocks.dart
Excluding lib/src/services/ssd_cneos/sbdb_cad_api/sbdb_cad_api.mocks.dart
Removed 2 files
Writing data to coverage/lcov.info.tmp
lcov: ERROR: Can't call method "count_totals" without a package or object reference

$ echo $?
25

$ lcov --version
lcov: LCOV version 2.0-95.gbf135ca

$ brew install lcov --HEAD
Warning: lcov HEAD-bf135ca is already installed and up-to-date.
To reinstall HEAD, run:
  brew reinstall lcov
henry2cox commented 7 months ago

Damn. sorry about that. Missing return value from remove_file_patterns. Will push a fix for this and a couple of other issues shortly. Henry

henry2cox commented 7 months ago

should be fixed in b602c0e1f583f

hrishikesh-kadam commented 7 months ago

Thanks, Henry for the quick fix! 😄

henry2cox commented 7 months ago

Glad it worked. Depending on exactly what you are trying to do, your coverage flow might be simpler if you use the --exclude option (say, to lcov or genhtml) - as opposed to an explicit --remove step. Remove will require you to manage a possibly temporary file (either the input or the output isn't a longer term artifact) - whereas 'exclude' will keep that data internally (no filesystem). OTOH: adding a lot of options to your command line can make it unwieldy/hard to read...so everything is a tradeoff.