Design and Architecture
Licensing checks
Licence and copyright headers of every file, checked against your policy and the licence of your project.
Overview
Licensing Insights reads the licence and copyright header of every source file and checks it against your policy. It answers: which licences are in my code, are they allowed, are they compatible with the licence of my project, and which third-party files carry no licence information at all.
It recognises licences from the SPDX-License-Identifier tag and, when there is no tag, from the text of the header (MIT, Apache, BSD, GPL, LGPL, AGPL, MPL, ISC, Zlib, Boost and others). Deprecated identifiers (GPL-2.0, LGPL-2.1+) are flagged.
Quick start
- Open Settings > Licensing Policy.
- Enter the licence of your project (an SPDX id such as
Apache-2.0). Compatibility cannot be checked without it. - Optionally fill the allowed and denied lists, and the required header text.
- Run the analysis and open Licensing Insights > Licensing Overview.
How files are classified
The scanner does not guess from folder names. It uses what CppDepend already knows after parsing the project:
| Class | Where it comes from |
|---|---|
| Your files | The source files and header files of your projects (ProjectSourceFiles, HeaderFiles). |
| Third-party files | Framework projects, headers the parser excluded, included files marked as excluded, and the headers of external projects found in the include paths (system and library headers). |
| Generated files | Recognised by their marker (for example "generated", "do not edit"); skipped when Skip generated files is on. |
You can add folders that must always count as third-party in Extra third-party folders, and folders to leave out entirely in Excluded folders.
Settings
Page Settings > Licensing Policy. Saved in the project file, element LicensingSettings. Setting CPPDEPEND_LICENSING=0 in the environment switches the check off (useful in CI).
| Setting | Default | Effect |
|---|---|---|
| Enabled | On | Runs the check with the analysis. |
| Project licence | empty | SPDX id of your project: used for compatibility and mismatch. |
| Require a licence header | On | Own files without a licence header give LIC-MISSING-01. |
| Require a copyright notice | Off | Gives LIC-COPYRIGHT-01 when a header has no copyright line. |
| Require an SPDX tag | Off | Gives LIC-SPDX-01 when there is no machine-readable tag. |
| Required header text | empty | Text that every header must contain (LIC-TEXT-01). |
| Allowed licences / Denied licences | empty | Allowed: anything else is refused. Denied: these are refused. Both give LIC-DENIED-01. |
| Skip generated files | On | Generated code is not required to carry a header. |
| Scan third-party files | On | Reads the third-party files too. |
| Third-party limit | 5000 | Maximum number of third-party files read (see Performance). |
| Extra third-party folders / Excluded folders | empty | Folders to treat as third-party, or to ignore. |
Policy examples
LicenseRef-Proprietary, denied GPL-2.0-only, GPL-3.0-only, AGPL-3.0-only. Any GPL header in your files or in third-party headers is a LIC-DENIED-01 or LIC-INCOMPAT-01.Apache-2.0, require SPDX tag on. Files copied from a GPL project give an incompatibility; files under MIT or BSD pass.LIC-TEXT-01.Rules and how to fix
| Rule | Severity | What it means | How to fix |
|---|---|---|---|
LIC-MISSING-01 | Low | File without licence header Without a licence and a copyright notice at the top, nobody can tell under which terms the file may be used, copied or sold. | Add the standard header of your project at the top of the file, ideally with a one-line tag: // SPDX-License-Identifier: <id> and // Copyright (c) <year> <holder>. A script or a formatter hook can add it to all files at once. |
LIC-THIRDPARTY-01 | Medium | Third-party file without licence information Code copied from elsewhere without its licence is a legal risk: you cannot show that you may use it. | Find where the code comes from and keep its original licence header. If you cannot, replace the code, or add a LICENSE file in its folder and ask legal to confirm the terms. |
LIC-UNKNOWN-01 | Medium | Licence not recognised The header speaks of a licence, but it is not one the scanner knows, so the policy and the compatibility cannot be checked. | Use a standard SPDX identifier (SPDX-License-Identifier: <id>). For a custom licence use LicenseRef-<name> and add its text in LICENSES/. |
LIC-DENIED-01 | High | Licence not allowed by the policy The licence of this file is on the denied list, or is not on the allowed list of Settings > Licensing Insights. | Replace or remove the file, get another licence from its author, or, if the policy is too strict, update it in the settings after legal approval. |
LIC-INCOMPAT-01 | High | Licence incompatible with the project licence The terms of this file cannot be combined with the licence of your project (for example GPL code in a proprietary or permissive project). | Remove the code or find an alternative with a compatible licence, ask the author for a different licence, or change the licence of the project. Ask legal before shipping. |
LIC-COPYLEFT-01 | Medium | Copyleft licence to review Copyleft licences ask you to publish the source of the combined or modified work under the same terms. Strong copyleft (GPL) and network copyleft (AGPL) reach the whole product. | Check how the file is used (linking, distribution, network service). Set the project licence in the settings so that the check can say if it is compatible, or replace the code. |
LIC-MISMATCH-01 | Low | Licence differs from the project licence The file uses another licence than the project. It can be fine (copied code), but it must be intentional and listed. | Check that the licence is compatible and keep the original header. If the file is yours, use the licence of the project. |
LIC-PROPRIETARY-01 | Medium | Proprietary notice in an open or third-party file The header says 'all rights reserved' or confidential without granting any licence, which conflicts with the licence of the project or the use of third-party code. | Replace the notice by the real licence of the file, or move the file out of the open-source or third-party part. |
LIC-COPYRIGHT-01 | Low | No copyright notice A licence without a copyright notice does not say who grants it. | Add // Copyright (c) <year> <holder> next to the licence line. |
LIC-SPDX-01 | Low | No SPDX identifier A machine-readable SPDX tag lets tools (and this page) read the licence without guessing from the text. | Add // SPDX-License-Identifier: <id> as the first line of the header. |
LIC-TEXT-01 | Medium | Required header text missing The header does not contain the text that the project requires in every file (see Settings > Licensing Insights). | Add the standard header text of your company at the top of the file. |
LIC-DEPRECATED-01 | Low | Deprecated SPDX identifier Identifiers such as GPL-2.0 or LGPL-2.1+ are deprecated: they do not say 'only' or 'or later' clearly. | Use the -only or -or-later form (GPL-2.0-only, GPL-2.0-or-later) that matches the real intent of the file. |
Where to see results
- Licensing Insights > Licensing Overview: licence inventory (how many files per licence), folders, third-party files, findings with the fix of each rule.
- Issues: tool Licensing, one issue per finding with file and line.
- File on disk:
licensing.jsonin the analysis output folder (inventory, folders, findings, how to fix).
Performance on large projects
Only the top of each file is read, never the whole file. Your own files are always read. Third-party files can be numerous (system headers), so they are read in parallel and limited by Third-party limit; the log says how many third-party files were known and how many were read. Switch Scan third-party files off to skip them completely.
Limits
- The check reads headers, not the real origin of the code: code pasted without its header is invisible.
- Licence recognition from free text is a best effort; unknown wording gives
LIC-UNKNOWN-01for review. - Compatibility is based on common licence families and is not legal advice. Ask your legal team for the final decision.
Questions
Why are system headers listed?
They are third-party files known from the include paths. Reduce them with Third-party limit or switch the scan off.
Why no compatibility findings?
The project licence is empty. Enter it in the policy page.
Thanks for your feedback. Tell us more or request a feature.
