Continuous Integration (CI) is the process of integrating new code into your project early and often.
As team members complete their work, they integrate it back into the overall project. Each time they do, an automated process is triggered that quickly determines if the new code has introduced any problems (i.e., did it break the build?). If problems are found, most CI tools will show a “red” light, indicating a problem must be resolved. If no problems are found, a “green” light will indicate the code is safe to ship.
Code Climate works great alongside all testing environments, including CIs. You can configure your build server to send Code Climate a report indicating how exhaustively each line of your codebase was tested. We’ll display your test coverage alongside our code quality analysis, providing you a view of your codebase across multiple dimensions. Code that is both poorly graded and poorly tested may be a red flag.
Since Git repositories can contain multiple branches, Code Climate needs to know which branch to focus on. We refer to this branch as the default.
When you view your repository (e.g., when you’re checking out your Feed page), virtually all the data shown is specific to the default branch (this is true for all pages, except the Branches page).
A default branch is defined when adding your repository to Code Climate:
- When adding a private GitHub repository (without entering a URI), or when adding an open source GitHub repository, your default Code Climate branch will always be set to your default Github branch.
- For all other situations, you'll be prompted to set the default branch.
You can also set your default branch after you setup your repository
By adding the same repository to Code Climate multiple times, you can set a default branch for each instance. This may be helpful, for example, if you want two separate Feeds for the same repository (each focused on a different branch).
Before going down this path, however, be sure you understand a repository's Branches page. That page may already solve your use case.
A grade point average (or GPA) is an academic grading system used to indicate overall performance. It provides a single number as a representation of how well a student performed during a portion of their academic career.
Code Climate borrows the four-point GPA system used by many high schools and colleges in the United States as a way to indicate the overall code quality of a repository.
Academic GPAs are calculated by averaging the grades from all of a student's courses.
For example: A student is assigned a letter grade in each of their courses, from A to F. Each letter grade is worth between 4.0 points to 0.0 points.
A student who scored three As, one B, and one C would have a GPA of 3.4. Not bad!
Note: This is a simplified example, as most GPA systems also weight letter grades based on the number of credits a course is worth.
Code Climate assigns a GPA to each repository based on the quality of its codebase.
We calculate a repository’s GPA by aggregating the grades for each class/module/file, weighted by lines of code, into an average. This value is the overall repository GPA.
Within each repository file, letter grades are calculated by summing up all of the code's issues and then applying this value to an absolute scale. Each issue has a “remediation cost,” which allows us to sum together the cost of different issue types (e.g., duplication, complexity).
If you will be performing administrative tasks in Code Climate, it’s helpful to understand the difference between organizations and users.
- Organizations (not users) are what we associate with plans and billing information.
- Organizations can have between one and many users.
- Organizations (not users) are who own repositories. This ensures Code Climate’s access to a repository won’t be affected if a user leaves an organization.
If you added a repository to Code Climate by clicking Add Open Source Repo, the repository will not be owned by an organization or user (though it can still be administered).
- Users are humans (hey, that’s you!).
- Users can be members of one or many organizations.
- Users should map to a single person, not be shared amongst different people.
- A Code Climate user can be linked to a GitHub user account (highly recommended).
When penalizing grades for violations, Code Climate uses the concept of remediation, or the amount of effort required to improve a software issue. Remediation points assigned to a violation are a numerical representation of the amount of work needed to repair the issue.
|Remediation Points||File Rating|
|0 - 2M||A|
|> 2M - 4M||B|
|> 4M - 8M||C|
|> 8M - 16M||D|
Git assigns each commit a unique identifier, which is comprised of a 40 character string. Here’s an example: 226ba6afcc4b4c507878ac914f7a7020a6174f3e.
People commonly refer to this string as a SHA, because it is calculated by taking a SHA-1 hash of the contents of a commit (plus some header information). It is virtually impossible for two SHAs to be identical. If you view a commit in GitHub, or run
git log, you can see a commit’s SHA.
The SHA value shown on your Feed page in Code Climate is only a portion of the entire 40 character SHA string.
An SSH key allows for secure data communication. Within the context of Code Climate, an SSH key grants us access to
git clone and
git pull your repository to our secure server to analyze your codebase.
Many of our users don’t need to deal with SSH keys when adding their repository to Code Climate. If you've added your private GitHub repository via our streamlined method, we'll automatically install the SSH key for you.
Tip: In GitHub, you can see the Code Climate SSH key by accessing the repository’s Settings menu and selecting the Deploy keys tab.
If you've imported your repository via a URI, you'll need to manually install the SSH key. Step by step instructions can be found here.
Within Code Climate, you can view the SSH key that we associate with your repository inside its Settings menu. Note that if you've added your repository to Code Climate by selecting Add Open Source Repo, SSH keys are not used (and therefore will not be displayed in your Settings menu).
A uniform resource identifier (or URI) is a unique string that identifies a resource, like a website or server. Within the context of Code Climate, a URI points us to a specific Git repository.
Alternatively, if you’re adding a non-Github repository, or are otherwise being prompted for a URI by Code Climate, you'll need to manually enter it. Below are some examples:
DIY Git Server
git@<Fully Qualified Domain Name>/<Repo Path>/<Repo Name>.git