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.
Quick start
Section titled “Quick start”ccsh analyse # map the current folder into <folder name>.cc.json.gzccsh analyse path/to/project # map another folder; the map still lands in the current folderOpen the map in the Web Studio.
What it runs
Section titled “What it runs”- The Raw Text Parser, Unified Parser, Dependency Parser and Domain Language Parser, each when it applies to the folder.
- The Git Log Parser (
repo-scan) when the folder is the root of a git repository. - The SVN Log Parser when the folder is the root of an svn working copy.
ccsh analyserunssvn log --verbose --non-interactiveitself, sosvnhas to be on thePATH.
The history only adds metrics to the files the code parsers mapped: excluded, ignored and deleted files do not come back through it.
Options
Section titled “Options”| Option | Effect |
|---|---|
FOLDER | the 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-changes | maps only the files that differ from the remote tracking branch |
--author-ownership | adds each author’s share of each file under an invented name, from git blame |
--with-author-names | writes real author names instead of invented ones, also for commit changes (needs --author-ownership) |
--commit-changes-since YYYY-MM-DD | adds what each commit since this day changed in each file, and who made it |
--commit=REF | maps the codebase at a git commit, tag, branch or date |
-p, --parallel | runs the analysers at the same time |
-nc, --not-compressed | writes the map uncompressed |
-q, --quiet | keeps 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 and past commits
Section titled “Local changes and past commits”--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
Section titled “Author ownership”--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
Section titled “Commit changes”--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.
What is not in the map
Section titled “What is not in the map”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.gzNot 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.
Interactive mode and exit codes
Section titled “Interactive mode and exit codes”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.
Related
Section titled “Related”- Quality gate: the same analysis, checked against rules
- Merge Filter: add metrics from importers to the map
- CodeCharta Shell