[Qa-debsources] DB modification for cloc plugin

Stefano Zacchiroli zack at debian.org
Wed Apr 13 15:18:23 UTC 2016


On Wed, Apr 13, 2016 at 10:24:20AM +0200, Matthieu Caneill wrote:
> Thanks for working on this!

Hear, hear.

> Since it's about cloc, and not likely to change (other kind of meta
> information should be added in the future directly in the Files
> table), I would suggest file_cloc.

Or, if you feel funny enough, we can use cloccounts, which is just one
character away from sloccounts, but is incidentally also very
semantically appropriate.  I think with indexes doing the aggregate by
package would actually be really fast, and could be done on the fly,
rather than having a separate dedicated table. It's worth being tested,
but I'm actually pretty confident it'd work fine.

> > I also don't know what to do as history_cloc. Were there any thoughts to
> > implement this in a different way than the current implementation of the
> > history_sloccount?
> 
> I think the current way is fine, but maybe Zack will have something to
> add here.

I'd go the same way of the other history_* tables.

> > CREATE TYPE languages as ENUM(
> s/languages/cloc_languages/?

Yeah, definitely.

> > CREATE TABLE file_metas (
> >   id SERIAL NOT NULL,
> >   file_id BIGINT NOT NULL,
> >   code Integer NOT NULL,
> >   comment Integer,
> >   language languages NOT NULL,
> >   CONSTRAINT file_metas_file_id_fkey
> >     FOREIGN KEY (file_id) REFERENCES files(id)
> >     ON DELETE CASCADE,
> >   PRIMARY KEY (id)
> > );
> 
> * We should create a UNIQUE constraint for (file_id, language);

... and drop id, yes (unless you can think of specific reasons why we
would event want to point to a specific line count entry).

Question: can cloc actually return multiple languages for the same file?

(The above constraint seems to conservatively assume that it could,
which is a nice assumption for the DB, but I'm curious anyhow)

> * I would append the suffix _count to code and comment;
> * Why drop the blank lines count of cloc? FWIW, once we have it it's
>   almost free to store.

*nod*

Cheers.
-- 
Stefano Zacchiroli  . . . . . . .  zack at upsilon.cc . . . . o . . . o . o
Maître de conférences . . . . . http://upsilon.cc/zack . . . o . . . o o
Former Debian Project Leader . . . . . @zacchiro . . . . o o o . . . o .
« the first rule of tautology club is the first rule of tautology club »
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/qa-debsources/attachments/20160413/edb590a3/attachment.sig>


More information about the Qa-debsources mailing list