1

I am often inspecting heterogeneous code bases, and would like to, at a quick glance, know the percentage of files per language, just like Github shows for a repository:

Github's code distribution per programming language

However, in Github's case, once we enter a subdirectory of the repository, this data is no longer available.

I'd like to have the same, but for a local directory, either graphically or via the command-line, ideally Linux-compatible.

Related tools

cloc shows a numerical table, but it does not group by subdirectory, so if I want to get more details, I have to:

  • run cloc . for the main directory;
  • find out where are the files (which subdirectories, if any);
  • enter each subdirectory and re-run cloc . to get the values for that directory.

The absence of bars, colors, etc, makes it very hard to quickly evaluate where are most of the files for a given language.


WinDirStat does offer graphical facilities for navigating and grouping directories and, I believe, is able to colorize files by extension. But the Linux equivalent, k4dirstat, does not offer this colorization (its colors are only related to the depth of the elements).

Other similar tools, such as Baobab, seem not to offer grouping-per-file-type capabilities.


Is there a Linux-compatible tool that fits my usage scenario?

0

It's not ideal, but I found out that QDirStat works closely to what I want: like WinDirStat, it allows coloring per file type, and it displays a tree view so that larger directories take more place, and makes it easier to find out where is the bulk of the files for a given programming language.

However, it does not allow filtering files, only directories. So while it is possible to exclude directories such as .git, it is not possible to exclude specific files from a directory, for instance to filter out .jpg files lying in a directory containing sources. In some cases, most of the space is taken by those files, and the best you can do is let them remain black and white, so you can visually ignore them more easily.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.