Skip to content

Analyse a project in one step

ccsh analyse maps a codebase in one step. It runs an opinionated selection of parsers and options to get you started, adds the git or svn history and merges the results into one map you can open in the visualization. It needs no config file.

Terminal window
ccsh analyse # map the current folder into <folder name>.cc.json.gz
ccsh analyse path/to/project # map another folder; the map still lands in the current folder

Open the map in the Web Studio.

The history only adds metrics to the files the code parsers mapped: excluded, ignored and deleted files do not come back through it.

OptionEffect
FOLDERthe project folder (default: the current folder)
-o, --output-file=<file>where to write the map (default: <folder name>.cc.json.gz in the current folder)
-e, --exclude=<patterns>comma-separated regex patterns of files and folders that every code parser skips
--without=NAME[,NAME...]parsers or histories to leave out, such as --without=dependencyparser,svn
--local-changesmaps only the files that differ from the remote tracking branch
--author-ownershipadds each author’s share of each file under an invented name, from git blame
--with-author-nameswrites real author names instead of invented ones, also for commit changes (needs --author-ownership)
--commit-changes-since YYYY-MM-DDadds what each commit since this day changed in each file, and who made it
--commit=REFmaps the codebase at a git commit, tag, branch or date
-p, --parallelruns the analysers at the same time
-nc, --not-compressedwrites the map uncompressed
-q, --quietkeeps the output of the analysers off the console

--without takes the parser names rawtextparser, unifiedparser, dependencyparser and domainlanguageparser, and git and svn (or gitlogparser and svnlogparser) for the histories. An unknown name stops the command with a list of the names it accepts.

--local-changes maps only the files you changed since your last push, with their git history, as described in Analyse local changes. The Dependency Parser and the Domain Language Parser are left out, because they need every file of the project.

--commit maps the codebase as it was at a commit, tag, branch or date, as described in Analyse a past commit. All parsers and the git history read one temporary worktree at that commit, the svn history is left out, and the map name starts with the short commit hash, such as 0907bc8.shop.cc.json.gz.

The two options cannot be combined.

--author-ownership adds who owns each file to the map, as described in the Git Log Parser, and the Explorer shows it. It needs the git history, so it cannot be combined with --without=git.

The names are pseudonymous, not anonymous: anyone with the repository can match them to people by comparing git blame, so the map may still be personal data under GDPR. Treat and share it accordingly.

--with-author-names, next to --author-ownership, opts out of this: the map then holds real names as git has them, under a clustering titled Author ownership (real names) and in the commit changes, and still no emails. The command warns about it last, even with --silent, and the Explorer’s Clusters tab shows a warning for such a map.

--commit-changes-since YYYY-MM-DD adds what each commit since that day changed to the map, as described in the Git Log parser, with each commit’s author and co-authors under the same invented names as in the author ownership, or their real names with --with-author-names. Invented names are pseudonymous, not anonymous: anyone with the repository can match them and the hashes to people, and commit subjects are free text, so a map may still be personal data under GDPR. The note is the last thing the command prints.

The last lines of the output, after the Map: line, name every parser and history that is not in the map, and why:

Map: ./shop.cc.json.gz
Not in the map:
dependencyparser: found no file it reads in .
git history: . is inside the git repository /home/me/shop, not at its root. Analyse /home/me/shop to include it.
svn history: no svn working copy found for .

A history is missing when the folder is in no repository or working copy, when it lies inside one but not at its root (analyse the root instead), when svn is not installed, or when svn log or the git log fails. The map is written either way.

The svn history only matches the code when the working copy is a checkout of the trunk of a single-project repository. For a checkout of a branch or of a project inside a multi-project repository, the map has no svn metrics.

Started without arguments, ccsh asks for a folder and first offers to analyse everything with ccsh analyse, before the list of single analysers.

ccsh analyse exits with 0 when the map is written, with 1 when the analysis fails and with 2 when the command line cannot be parsed.