Skip to content

Manage your project's files (add, remove, filter, exclude)

Which files are in your project determines what Understand analyzes. Keeping third-party and generated code out speeds up analysis and cleans up your results.

In the GUI

Open Project → Configure Project and go to the source/files section. Right-click in the file tree for the actions:

  • Add Directory… — add a source folder. Add File… — add individual files.
  • Remove Selected Files — drop files from the project. Remove Unavailable Files — clear files that no longer exist on disk. Restore Selected Files — undo a removal.
  • Rescan Directory — re-scan a folder for files added or deleted since it was added.

Watched vs unwatched directories

Each directory is either Watched or Unwatched (shown as an attribute in the tree):

  • Watched — Understand automatically picks up new and deleted files matching the directory's filters on the next analysis. This is the usual choice for your own source tree.
  • Unwatched — the file list is fixed; new files on disk are ignored until you add them.

A watched directory carries filters (which file types/languages to include), an exclude pattern, an additional include pattern, and a subdirectories flag.

Per-directory and per-file overrides

To give a folder or file different settings than the project default, right-click it and choose Configure Override Settings…. Use Copy Override Settings / Paste Override Settings to apply the same override elsewhere. This is how you, for example, parse one subtree with different includes or macros.

Group files by build project, not just directory

When you import a Visual Studio solution or Xcode project (the wizard's Import Settings page, or und add -vs … / und add -xcode …), Understand analyzes the files those build projects reference — but the file tree is still organized by folder on disk, which may not match the solution's project breakdown. To browse, measure, and graph by build project (or any grouping you choose) instead of by directory, build an architecture: it lets you place each project's files under its own node, so a solution with several projects becomes several components you can analyze independently.

From the command line

und add <directory> myProject.und            # add a directory (default type)
und add -file file1.cpp file2.cpp myProject.und
und add -watch off -exclude "*.java","*.cpp" <directory> myProject.und   # unwatched, with excludes
und remove -file file1.cpp myProject.und     # remove files
und remove <directory> myProject.und         # remove a directory

Useful und add switches: -watch on|off, -subdir, -exclude <patterns>, -filter, -noncode, -lang, and -analyzelater (skip the automatic re-analysis of changed files); the removal switches are in the und remove reference. See Configure settings & filter files from the CLI.

Tip

After changing the file set, re-analyze so the database matches. See Keep your analysis up to date.