When you have defined one or more integrations with repository hosts, you can add projects to LGTM using the main interface, the administration interface, or the rest API.
By default, LGTM analyzes all commits to the default branch of each project you add. This is known as full analysis mode. You can, however, tell LGTM to use sparse analysis or upload analysis for specific projects, if required.
Adding a few projects
Typically, any user of LGTM can add projects directly from their
You can configure LGTM Enterprise to prevent users adding projects from their My projects page.
Administrators can also add projects to LGTM by posting a request to the
/projects endpoint of the rest API. By default, LGTM builds and analyzes the project in the same way as for projects added through the user interface. For more information, see
On the Add tab, enter the URLs or host names for the project repositories you want to add, one per line.More about repository URLs
You can add projects hosted by any supported repository type using the repository's web URL (HTTP or HTTPS). Alternatively, for projects hosted on Bitbucket.org or GitHub.com, you can use the repository's clone URL. For repositories in Subversion or simple Git, the web URL must match a repository root URL specified in one of the integrations (to find out more about the repository root URL, see Specifying aliases and root URLs for direct Git or Subversion integration).
Typically a project's repository URL is the one that displays the home page for the project in the repository management system. For example, a URL for a project in GitHub Enterprise might be something like:
If you're adding a project under TFVC control (either in TFS or Azure DevOps) you can do so using a variety of URLs. The team name in the URL is optional, as is
_versionControlat the end of the URL.
DefaultCollectionis an optional part of the URL for Azure DevOps, but is mandatory for TFS.
For example, the following URLs for the same TFVC project repository, in Azure DevOps, are all valid:
URLs can use URL encoding or not.
The final example shown above does not specify a branch path at the end of the URL. This URL would add the whole repository rather than a specific branch. If you add the whole repository you should be aware that you will get duplicate alerts if the same coding issue appears on multiple branches.
If you want to use sparse analysis for these projects—where not every commit is analyzed—click Advanced options and select the Add projects in sparse analysis mode check box.
When you enable sparse analysis for a project, instead of building and analyzing all commits to the default branch of a project, LGTM only builds and analyzes the HEAD commit at the time the repository is polled for changes. This applies to the analysis for all languages in a project.
Enabling this mode reduces the computational burden of projects, but has some drawbacks. For more information, see Using sparse analysis.
If you do not want LGTM Enterprise to attempt to analyze all languages for the projects you're adding, clear the appropriate language check box(es) in the Advanced options section.
If you want to ensure the added projects are only processed by worker daemons running on particular worker host servers, enter appropriate, space-separated, labels in the Worker labels box.Examples
If you want the project(s) you are adding to be processed only on a host machine that is running Linux, add the label
unix. To mandate that Windows is used, add the label
If you add a label
tiger-team, then the project(s) you are adding will only be processed on machines that have also been assigned this label (plus any label that might have been assigned to specific languages). For example, if Python has been assigned the label
python-environment, then any Python code in the project(s) you are adding will only be processed on machines that have the labels
For information about labeling, see Defining which workers can build and analyze a project.
Click Add to process the URLs.
Each URL is processed as follows:
- Each URL is tested against the repository host URLs specified by integrations (and, if simple Git or Subversion are configured, also the repository root URLs):
- If a match is found, a series of "attempt-build" jobs are queued for the repository, one per language.
- If no match is found, an error is reported on the Add project page.
- Each attempt-build job runs and tries to analyze the codebase:
- If at least one language is analyzed successfully, the repository is registered as an LGTM project.
- If the analysis fails for all languages, an error is reported.
For projects added using the Administration interface, you can monitor the progress of the attempt-build jobs by returning to the Add tab periodically, scrolling to the
A table is displayed, listing each of the projects you added and showing the status of the attempt-build jobs for each language supported by LGTM Enterprise. After each language is processed for each project, a green check mark or a red cross is displayed, depending on whether the job succeeded or failed. Click the check mark or cross to display the log for that job.
Initial view of project data
Initially only some of the parts of LGTM that are visible to standard users are populated with analysis data for a newly added project. You will be able to see details for the initially analyzed commit in the Alerts tab and the Files tab. Parts of the interface that display data calculated by comparing analysis between a commit and its predecessor commit will not be populated until at least one historic commit (that is, a commit made prior to the initially processed commit) is analyzed.
The new project can be examined using the query console as soon as the initial analysis data is added. This is because queries run from the query console are always run against the data for the most recent version of the code to have been analyzed by LGTM.