xaizek / uncov (License: AGPLv3+) (since 2018-12-07)
Uncov(er) is a tool that collects and processes code coverage reports.
Commit c187171ca6ddcc21f029d2da47bbd6b4348c0b45

Add script to import TODO and use it
Author: xaizek
Author date (UTC): 2017-01-08 22:27
Committer name: xaizek
Committer date (UTC): 2017-01-08 22:27
Parent(s): 5f5657c7f768ffec401b7ed4f61b6fbdccfe13a6
Signing key: 99DC5E4DB05F6BE2
Tree: ebcb11a76d5691b2e8a97f55c842cce8e0eed75e
File Lines added Lines deleted
README.md 2 2
TODO.md 273 0
scripts/dit-import 76 0
File README.md changed (mode: 100644) (index 3db8098..b0f451c)
1 1 **uncov**, _2016 – 2017_ **uncov**, _2016 – 2017_
2 2
3 _This file last updated on 08 January, 2017_
3 _This file last updated on 09 January, 2017_
4 4
5 5 ### Brief Description ### ### Brief Description ###
6 6
 
... ... they aren't finalized and changes for the sake of improvement are possible.
49 49 Databases will be migrated if schema changes, so previously collected data won't Databases will be migrated if schema changes, so previously collected data won't
50 50 be lost. be lost.
51 51
52 #### What's missing ####
52 #### Main things missing ####
53 53
54 54 * Configuration. Currently values that could be configurable are hard-coded. * Configuration. Currently values that could be configurable are hard-coded.
55 55 * Tuning behaviour with command-line parameters. * Tuning behaviour with command-line parameters.
File TODO.md added (mode: 100644) (index 0000000..0085f2f)
1 # Core #
2
3 ## Determine build predecessor by commits and branches. ##
4
5 | ID | Status | Type |
6 |------|-----------|---------------|
7 | ARY | planned | improvement |
8
9 Currently it's just a mapping of `N` to `N - 1`.
10
11 The implementation could be as follows:
12
13 1. Collect commit ids from all previous builds (with `id < N`). (This is cheap.)
14 These must be ordered by branch matching branch of current build and then by
15 build ids.
16 2. Do breadth first search from commit of current build. Pseudo-code:
17
18 knownIdsToBuildIdsMap;
19 if (knownIdsToBuildIdsMap.empty()) {
20 return {};
21 }
22
23 ids = { <current build's commit> };
24 while (!ids.empty()) {
25 newIds = {};
26 for (id : ids) {
27 for (parent : id.parents()) {
28 if (parent in knownIdsToBuildIdsMap) {
29 return knownIdsToBuildIdsMap[parent];
30 }
31
32 newIds.insert(parent);
33 }
34 }
35 ids = newIds;
36 }
37 return {};
38
39
40 We might want to actually find *the closest* build instead of the first one,
41 this should give better results. This can be even slower, so a persistent cache
42 could be needed.
43
44 This can be somewhat slow, so some caching could be useful.
45 For that we could use memoization in a function like `getCommitParents()` that
46 would remember its results.
47
48 Functions to use:
49 - `git_commit_parent_id()`
50 - `git_commit_parentcount()`
51
52 ## @branch notation to lookup the latest build on that branch. ##
53
54 | ID | Status | Type |
55 |------|-------------|------------|
56 | ERY | undecided | addition |
57
58 At least one use case when it's handy is when you're at `feature` branch
59 and want to see how things changed relative to `master` branch:
60
61 uncov changed @master @@
62
63 ## Maybe display commit information in `build`. ##
64
65 | ID | Status | Type |
66 |------|-------------|------------|
67 | GSY | undecided | addition |
68
69 ## Maybe indicate when build matches repo reference. ##
70
71 | ID | Status | Type |
72 |------|-------------|--------|
73 | JRY | undecided | idea |
74
75 That is when `HEAD` of non-bare repositories matches commit of builds or
76 maybe even when branch ref matches build commit.
77
78 Maybe should also indicate "temporary" commits somehow.
79
80 ## Source-highlight hangs if passed in std::istream is at EOF? ##
81
82 | ID | Status | Type |
83 |------|-------------|---------|
84 | MRY | undecided | issue |
85
86 Need to check on their trunk and see if happens there (should do nothing
87 instead).
88
89 ## Maybe make use of information about file contents change. ##
90
91 | ID | Status | Type |
92 |------|-------------|--------|
93 | NRY | undecided | idea |
94
95 Could:
96 * Mark somehow files that are changed between builds (changed by contents).
97 * Could list them separately or just indicate as changed.
98
99 Coveralls has four listings:
100 * All
101 * Changed
102 * Source Changed
103 * Coverage Changed
104 Not all seem to be awfully useful though.
105
106 ## Introduce DBException and RepositoryException classes? ##
107
108 | ID | Status | Type |
109 |------|-------------|---------------|
110 | PRY | undecided | improvement |
111
112 This can help make some error messages better, but is it really that useful
113 (not sure handling of exceptions will actually differ, so maybe only to
114 provide more details about the error).
115
116 ## Maybe something to exclude files. ##
117
118 | ID | Status | Type |
119 |------|-------------|------------|
120 | VRY | undecided | addition |
121
122 Or should this be handled by coverage providers?
123
124 ## Named pipes can be employed to pass multiple files to pager. ##
125
126 | ID | Status | Type |
127 |------|-------------|--------|
128 | WRY | undecided | idea |
129
130 ## A way to disable file highlighting. ##
131
132 | ID | Status | Type |
133 |------|-----------|---------------|
134 | YRY | planned | improvement |
135
136 It's slow for huge diffs/files (quite understandable).
137
138 ## More code documentation comments. ##
139
140 | ID | Status | Type |
141 |------|---------------|--------|
142 | ZRY | in progress | task |
143
144 ## Language detection for file highlight relies on file name only. ##
145
146 | ID | Status | Type |
147 |------|-------------|---------|
148 | aRY | undecided | issue |
149
150 Could examine for shebang or even employ `libmagic`.
151
152 ## Add configuration. ##
153
154 | ID | Status | Type |
155 |------|-----------|------------|
156 | gRY | planned | addition |
157
158 Could use git config file in repos (or shouldn't?).
159
160 Another suitable place is separate table in the database.
161
162 And might need a global one at some point too.
163
164 ## Maybe introduce range syntax to specify two builds. ##
165
166 | ID | Status | Type |
167 |------|-------------|--------|
168 | kRY | undecided | idea |
169
170 E.g. `@10..@@`.
171
172 ## Maybe differentiate between ##### and ===== in gcov output. ##
173
174 | ID | Status | Type |
175 |------|-------------|---------------|
176 | nRY | undecided | improvement |
177
178 `#####` means not reached on normal path.
179
180 `=====` is the same, but for exceptional paths (inside `catch` branches).
181
182 ## Consider displaying line numbers in "diff". ##
183
184 | ID | Status | Type |
185 |------|-------------|----------|
186 | qRY | undecided | change |
187
188 They are sometimes useful, but not always (and take up space).
189
190 So maybe add, but make it configurable.
191
192 ## "branch" subcommand to show builds of only one branch. ##
193
194 | ID | Status | Type |
195 |------|-------------|------------|
196 | tRY | undecided | addition |
197
198 Or extend `builds` accordingly.
199
200 ## Consider basic history editing. ##
201
202 | ID | Status | Type |
203 |------|-------------|--------|
204 | uRY | undecided | idea |
205
206 Maybe add an option to `new` or separate command (e.g. `amend`) or a way to
207 edit build history. This can make it easier to see new coverage while
208 developing and then discarding that temporary data or to drop accidental/broken
209 builds.
210
211 Maybe just allow at most one build from working tree.
212
213 Maybe store uncommitted files in the database directly. Stray commit is
214 created now by `uncov-gcov`.
215
216 Removed/deleted builds could just be marked as such to do not affect numbering.
217
218 ## More flexible way to specify database location. ##
219
220 | ID | Status | Type |
221 |------|-------------|---------------|
222 | uSY | undecided | improvement |
223
224 For more complicated (but rarer) case when coverage repository differs from
225 the working one.
226
227 Symlinks work fine at the moment.
228
229 ## More control over not relevant files. ##
230
231 | ID | Status | Type |
232 |------|-------------|---------------|
233 | vSY | undecided | improvement |
234
235 E.g., an option to don't show files with no relevant lines in output of, say,
236 `files`. Or maybe just a subcommand, like `relevant`?
237
238 Maybe a way to sort files which will group such files on one part of the table.
239
240 ## Maybe print distance between builds (in commits). ##
241
242 | ID | Status | Type |
243 |------|-------------|------------|
244 | xRY | undecided | addition |
245
246 Related to `ARY`, we need to analyze commit graph to do this.
247
248 # Vim Plugin #
249
250 ## Don't depend on fugitive in the plugin. ##
251
252 | ID | Status | Type |
253 |------|-----------|---------------|
254 | cRY | planned | improvement |
255
256 We need too little from it.
257
258 Outline of possible implementation:
259
260 function! s:GetGitRelPath()
261 " find .git file/directory by searching up directory tree
262 " print meaningful error if not in git repository
263 " make absolute path of location of .git directory
264 " make absolute path of current buffer
265 " remove path to .git from path of the buffer
266 " return the result
267 endfunction
268
269 ## Don't rely on autochdir in the plugin. ##
270
271 | ID | Status | Type |
272 |------|-----------|---------------|
273 | eRY | planned | improvement |
File scripts/dit-import added (mode: 100755) (index 0000000..7724bcf)
1 #!/bin/bash
2
3 # This script updates reduced in-tree dump of TODO.md file by importing its
4 # contents from dit and applying necessary formatting.
5
6 function process_item()
7 {
8 if [ "$first" == 0 ]; then
9 echo
10 fi
11
12 echo "## ${data[title]} ##"
13
14 echo
15 column -x -t -o ' | ' -s '|' <<-EOF | sed -e 's/^/| /' -e 's/|[^|]\+$/|/' \
16 -e '1{h;s/[^|]/-/g;x;G}'
17 ID | Status | Type | dummy
18 ${data[_id]} | ${data[status]} | ${data[type]} | dummy
19 EOF
20
21 if [ "${data[status]}" = partial ]; then
22 echo '(partially done)'
23 fi
24
25 if [ -n "${data[comment]}" ]; then
26 echo
27 echo "${data[comment]}"
28 fi
29
30 first=0
31 }
32
33 function process_items()
34 {
35 declare -A data
36 first=1
37 while read -rd $'\0' line; do
38 if [ -z "$line" ]; then
39 process_item
40 unset data
41 declare -A data
42 continue
43 fi
44
45 key="${line%%=*}"
46 value="${line#*=}"
47
48 data[$key]="$value"
49 done
50 }
51
52 function list_component()
53 {
54 local title="$1"
55 shift
56
57 local out="$(dit .uncov export - \
58 status!=done status!=dismissed status!=fixed "$@" |
59 process_items)"
60 if [ -n "$out" ]; then
61 echo
62 echo "# $title #"
63 echo
64 echo "$out"
65 fi
66 }
67
68 function make_todo()
69 {
70 list_component 'Core' component==
71 list_component 'Vim Plugin' component==vim-plugin
72 }
73
74 dir="$(readlink -f "$(dirname "$0")")"
75
76 make_todo | tail +2 > "$dir/../TODO.md"
Hints

Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://code.reversed.top/user/xaizek/uncov

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@code.reversed.top/user/xaizek/uncov

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a pull request:
... clone the repository ...
... make some changes and some commits ...
git push origin master