{"id":29507250,"url":"https://github.com/antonmeep/covered","last_synced_at":"2025-08-25T15:06:37.001Z","repository":{"id":304772612,"uuid":"98886188","full_name":"AntonMeep/covered","owner":"AntonMeep","description":":cookie: Processes output of code coverage analysis performed by the D language compiler","archived":false,"fork":false,"pushed_at":"2018-07-08T10:30:27.000Z","size":36,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-07-15T09:43:28.180Z","etag":null,"topics":["cli","coverage","dlang"],"latest_commit_sha":null,"homepage":null,"language":"D","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AntonMeep.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2017-07-31T12:24:30.000Z","updated_at":"2023-06-09T19:51:22.000Z","dependencies_parsed_at":"2025-07-15T09:43:32.541Z","dependency_job_id":"e63cdceb-df50-41e2-83ac-00eec0e3672f","html_url":"https://github.com/AntonMeep/covered","commit_stats":null,"previous_names":["antonmeep/covered"],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/AntonMeep/covered","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AntonMeep%2Fcovered","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AntonMeep%2Fcovered/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AntonMeep%2Fcovered/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AntonMeep%2Fcovered/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AntonMeep","download_url":"https://codeload.github.com/AntonMeep/covered/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AntonMeep%2Fcovered/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272084826,"owners_count":24870584,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-25T02:00:12.092Z","response_time":1107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","coverage","dlang"],"created_at":"2025-07-16T03:30:39.776Z","updated_at":"2025-08-25T15:06:36.950Z","avatar_url":"https://github.com/AntonMeep.png","language":"D","funding_links":[],"categories":[],"sub_categories":[],"readme":"Covered [![Page on DUB](https://img.shields.io/dub/v/covered.svg?style=flat-square)](http://code.dlang.org/packages/covered)[![License](https://img.shields.io/dub/l/covered.svg?style=flat-square)](https://github.com/ohdatboi/covered/blob/master/LICENSE)[![Build Status TravisCI](https://img.shields.io/travis/ohdatboi/covered/master.svg?style=flat-square)](https://travis-ci.org/ohdatboi/covered)[![Build status AppVeyor](https://img.shields.io/appveyor/ci/ohdatboi/covered/master.svg?style=flat-square)](https://ci.appveyor.com/project/ohdatboi/covered)\n=============\n\n**Covered** processes output of code coverage analysis performed by the D programming language compiler (DMD/LDC/GDC).\n\n## Usage:\n\n```\nUsage:\tcovered \u003coptions\u003e files dirs\n\nCovered processes output of code coverage analysis performed by the D programming language compiler (DMD/LDC/GDC)\n\nEvery option below works with any number of files/directories specified in command line.\nIf nothing is specified, it looks for '*.lst' files in current working directory\n\nOptions:\n-c  --coverage Reports code coverage (default)\n-s    --source Shows source code, number of executions of each line, and it's code coverage\n-b     --blame Shows list of files ordered by code coverage\n-a   --average Reports average code coverage across all passed files\n-j      --json Makes a dump in JSON format\n-v   --verbose Verbose output\n-n    --hidden When directory is passed, looks for hidden files as well (default: false)\n-r --recursive When directory is passed, looks for *.lst files recursively (default: false)\n-h      --help This help information.\n```\n\n## Installation:\n\n```\n$ dub fetch covered # Downloads covered\n$ dub run covered # Runs covered\n```\n\n## Available options and examples\n### `--coverage` - Prints code coverage for each passed file (default option)\n\n```\n$ ./covered sample/hello.lst\nhello.d is 100.00% covered\n```\n\n### `--source` - Shows source code, number of executions of each line and it's code coverage\n\n```\n$ ./covered --source sample/hello.lst\n+-------------------\n| File: sample/hello.lst\n| Source file: hello.d\n| Coverage: 100.00%\n+-------------------\nimport std.stdio;\n\nvoid main() {\n        writeln(\"Hello world!\");\n}\n```\n\n### `--blame` - Shows list of files ordered by coverage\n```\n$ ./covered --blame sample/hello.lst\n                                           hello.d | 100.00%\n```\n\n### `--average` - Shows average total coverage of all passed files\n```\n$ ./covered --average sample/hello.lst\nAverage: 100.00%\n```\n\n## Performing code coverage analysis with DUB:\n\n```\n$ dub -b unittest-cov\n```\n\nThis command will build and run your DUB project. Your program will create many `*.lst` files in your working dir. Covered uses those files:\n\n```\n$ dub run covered\n```\n\nYou can pass aditional options to covered after `--`:\n```\n$ dub run covered -- --help\n```\n\n## Performing code coverage analysis like a pro:\n\nRunning `dub -b unittest-cov` leads to some problems:\n\n1. It pollutes your working directory with tons of `*.lst` files.\n2. Built-in `unittest`s are not that useful. Failed `unittest` exits program, so it is impossible to say, how many of them have been failed.\n3. Built-in `assert`s, which are used in `unittest` blocks, are not that useful. `assert` just throws if value is not `true`, so it is very hard to say, why assertion failed.\n\nThose problems doesn't make development impossible, but harder and slower.\n\n### Moving `*.lst` files into separate directory:\n\nAdd this code to your app:\n\n```D\nversion(D_Coverage) shared static this() {\n\timport core.runtime : dmd_coverDestPath;\n\timport std.file : exists, mkdir;\n\n\tenum COVPATH = \"coverage\";\n\n\tif(!COVPATH.exists) // Compiler won't create this directory\n\t\tCOVPATH.mkdir; // That's why it should be done manually\n\tdmd_coverDestPath(COVPATH); // Now all *.lst files are written into ./coverage/ directory\n}\n```\n\nDo not forget to add `./coverage` directory into your `.gitignore`:\n```\ncoverage/\n```\n\nTa-Da! Your working directory is no longer polluted\n\n### Use cool unit-testing library\n\nThere are lots of them, but I will describe use of [unit-threaded](https://github.com/atilaneves/unit-threaded).\n\n#### 1. Add entry to `dub.json`\n\n```JSON\n\"configurations\": [\n\t{ \"name\": \"executable\" },\n\t{\n\t\t\"name\": \"unittest\",\n\t\t\"targetType\": \"executable\",\n\t\t\"preBuildCommands\": [\n\t\t\t\"dub run unit-threaded -c gen_ut_main -- -f .dub/ut.d\"\n\t\t],\n\t\t\"mainSourceFile\": \".dub/ut.d\",\n\t\t\"dependencies\": {\n\t\t\t\"unit-threaded\": \"~\u003e0.7.28\",\n\t\t\t\"fluent-asserts\": \"~\u003e0.6.1\"\n\t\t},\n\t\t\"targetPath\": \".dub/\",\n\t\t\"targetName\": \"unittester\"\n\t}\n],\n```\n\nIf you want to use it *and* move `*.lst` into separate directory, copy it's code into some file (`cov.d`, for example), and add to your dub.json:\n\n```JSON\n\"configurations\": [\n\t{ \"name\": \"executable\" },\n\t{\n\t\t\"name\": \"unittest\",\n\t\t....\n\t\t\"sourceFiles\": [\"cov.d\"]\n\t}\n],\n```\n\n#### 2. Use it!\n\n```\n$ dub test\n```\n\nWill run unittests with help of unit_threaded. Go to it's documentation for more information.\n\n### Use fluent-asserts instead of built-in assertions.\n\nJust use [fluent-asserts](https://github.com/gedaiu/fluent-asserts/). And again, go to it's documentation for more.\n\n### Put it all together!\n\n```\n$ dub -b unittest-cov -c unittest\n```\n\nWill build and run your application with all `*.lst` files moved into `./coverage` directory, unittests runned in parallel, and nice messages if something goes wrong.\n\n```\n$ dub run covered -- ./coverage\n```\n\nThat's it! Now you're performing code coverage analysis like a pro! Take a cookie: :cookie:\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantonmeep%2Fcovered","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fantonmeep%2Fcovered","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantonmeep%2Fcovered/lists"}