Amazon CodeGuru Reviewer

2022/04/29 - Amazon CodeGuru Reviewer - 3 updated api methods

Changes  Amazon CodeGuru Reviewer now supports suppressing recommendations from being generated on specific files and directories.

CreateCodeReview (updated) Link ¶
Changes (response)
{'CodeReview': {'ConfigFileState': 'Present | Absent | PresentWithErrors',
                'Metrics': {'SuppressedLinesOfCodeCount': 'long'}}}

Use to create a code review with a ` CodeReviewType https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_CodeReviewType.html`__ of RepositoryAnalysis . This type of code review analyzes all code under a specified branch in an associated repository. PullRequest code reviews are automatically triggered by a pull request.

See also: AWS API Documentation

Request Syntax

client.create_code_review(
    Name='string',
    RepositoryAssociationArn='string',
    Type={
        'RepositoryAnalysis': {
            'RepositoryHead': {
                'BranchName': 'string'
            },
            'SourceCodeType': {
                'CommitDiff': {
                    'SourceCommit': 'string',
                    'DestinationCommit': 'string',
                    'MergeBaseCommit': 'string'
                },
                'RepositoryHead': {
                    'BranchName': 'string'
                },
                'BranchDiff': {
                    'SourceBranchName': 'string',
                    'DestinationBranchName': 'string'
                },
                'S3BucketRepository': {
                    'Name': 'string',
                    'Details': {
                        'BucketName': 'string',
                        'CodeArtifacts': {
                            'SourceCodeArtifactsObjectKey': 'string',
                            'BuildArtifactsObjectKey': 'string'
                        }
                    }
                },
                'RequestMetadata': {
                    'RequestId': 'string',
                    'Requester': 'string',
                    'EventInfo': {
                        'Name': 'string',
                        'State': 'string'
                    },
                    'VendorName': 'GitHub'|'GitLab'|'NativeS3'
                }
            }
        },
        'AnalysisTypes': [
            'Security'|'CodeQuality',
        ]
    },
    ClientRequestToken='string'
)
type Name

string

param Name

[REQUIRED]

The name of the code review. The name of each code review in your Amazon Web Services account must be unique.

type RepositoryAssociationArn

string

param RepositoryAssociationArn

[REQUIRED]

The Amazon Resource Name (ARN) of the ` RepositoryAssociation https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_RepositoryAssociation.html`__ object. You can retrieve this ARN by calling ` ListRepositoryAssociations https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_ListRepositoryAssociations.html`__ .

A code review can only be created on an associated repository. This is the ARN of the associated repository.

type Type

dict

param Type

[REQUIRED]

The type of code review to create. This is specified using a ` CodeReviewType https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_CodeReviewType.html`__ object. You can create a code review only of type RepositoryAnalysis .

  • RepositoryAnalysis (dict) -- [REQUIRED]

    A code review that analyzes all code under a specified branch in an associated repository. The associated repository is specified using its ARN in ` CreateCodeReview https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_CreateCodeReview`__ .

    • RepositoryHead (dict) --

      A ` SourceCodeType https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_SourceCodeType`__ that specifies the tip of a branch in an associated repository.

      • BranchName (string) -- [REQUIRED]

        The name of the branch in an associated repository. The RepositoryHeadSourceCodeType specifies the tip of this branch.

    • SourceCodeType (dict) --

      Specifies the source code that is analyzed in a code review.

      • CommitDiff (dict) --

        A ` SourceCodeType https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_SourceCodeType`__ that specifies a commit diff created by a pull request on an associated repository.

        • SourceCommit (string) --

          The SHA of the source commit used to generate a commit diff. This field is required for a pull request code review.

        • DestinationCommit (string) --

          The SHA of the destination commit used to generate a commit diff. This field is required for a pull request code review.

        • MergeBaseCommit (string) --

          The SHA of the merge base of a commit.

      • RepositoryHead (dict) --

        A ` SourceCodeType https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_SourceCodeType`__ that specifies the tip of a branch in an associated repository.

        • BranchName (string) -- [REQUIRED]

          The name of the branch in an associated repository. The RepositoryHeadSourceCodeType specifies the tip of this branch.

      • BranchDiff (dict) --

        A type of ` SourceCodeType https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_SourceCodeType`__ that specifies a source branch name and a destination branch name in an associated repository.

        • SourceBranchName (string) -- [REQUIRED]

          The source branch for a diff in an associated repository.

        • DestinationBranchName (string) -- [REQUIRED]

          The destination branch for a diff in an associated repository.

      • S3BucketRepository (dict) --

        Information about an associated repository in an S3 bucket that includes its name and an S3RepositoryDetails object. The S3RepositoryDetails object includes the name of an S3 bucket, an S3 key for a source code .zip file, and an S3 key for a build artifacts .zip file. S3BucketRepository is required in ` SourceCodeType https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_SourceCodeType`__ for S3BucketRepository based code reviews.

        • Name (string) -- [REQUIRED]

          The name of the repository when the ProviderType is S3Bucket .

        • Details (dict) --

          An S3RepositoryDetails object that specifies the name of an S3 bucket and a CodeArtifacts object. The CodeArtifacts object includes the S3 object keys for a source code .zip file and for a build artifacts .zip file.

          • BucketName (string) --

            The name of the S3 bucket used for associating a new S3 repository. It must begin with codeguru-reviewer- .

          • CodeArtifacts (dict) --

            A CodeArtifacts object. The CodeArtifacts object includes the S3 object key for a source code .zip file and for a build artifacts .zip file that contains .jar or .class files.

            • SourceCodeArtifactsObjectKey (string) -- [REQUIRED]

              The S3 object key for a source code .zip file. This is required for all code reviews.

            • BuildArtifactsObjectKey (string) --

              The S3 object key for a build artifacts .zip file that contains .jar or .class files. This is required for a code review with security analysis. For more information, see Create code reviews with security analysis in the Amazon CodeGuru Reviewer User Guide .

      • RequestMetadata (dict) --

        Metadata that is associated with a code review. This applies to any type of code review supported by CodeGuru Reviewer. The RequestMetadaa field captures any event metadata. For example, it might capture metadata associated with an event trigger, such as a push or a pull request.

        • RequestId (string) --

          The ID of the request. This is required for a pull request code review.

        • Requester (string) --

          An identifier, such as a name or account ID, that is associated with the requester. The Requester is used to capture the author/actor name of the event request.

        • EventInfo (dict) --

          Information about the event associated with a code review.

          • Name (string) --

            The name of the event. The possible names are pull_request , workflow_dispatch , schedule , and push

          • State (string) --

            The state of an event. The state might be open, closed, or another state.

        • VendorName (string) --

          The name of the repository vendor used to upload code to an S3 bucket for a CI/CD code review. For example, if code and artifacts are uploaded to an S3 bucket for a CI/CD code review by GitHub scripts from a GitHub repository, then the repository association's ProviderType is S3Bucket and the CI/CD repository vendor name is GitHub. For more information, see the definition for ProviderType in RepositoryAssociation .

  • AnalysisTypes (list) --

    They types of analysis performed during a repository analysis or a pull request review. You can specify either Security , CodeQuality , or both.

    • (string) --

type ClientRequestToken

string

param ClientRequestToken

Amazon CodeGuru Reviewer uses this value to prevent the accidental creation of duplicate code reviews if there are failures and retries.

This field is autopopulated if not provided.

rtype

dict

returns

Response Syntax

{
    'CodeReview': {
        'Name': 'string',
        'CodeReviewArn': 'string',
        'RepositoryName': 'string',
        'Owner': 'string',
        'ProviderType': 'CodeCommit'|'GitHub'|'Bitbucket'|'GitHubEnterpriseServer'|'S3Bucket',
        'State': 'Completed'|'Pending'|'Failed'|'Deleting',
        'StateReason': 'string',
        'CreatedTimeStamp': datetime(2015, 1, 1),
        'LastUpdatedTimeStamp': datetime(2015, 1, 1),
        'Type': 'PullRequest'|'RepositoryAnalysis',
        'PullRequestId': 'string',
        'SourceCodeType': {
            'CommitDiff': {
                'SourceCommit': 'string',
                'DestinationCommit': 'string',
                'MergeBaseCommit': 'string'
            },
            'RepositoryHead': {
                'BranchName': 'string'
            },
            'BranchDiff': {
                'SourceBranchName': 'string',
                'DestinationBranchName': 'string'
            },
            'S3BucketRepository': {
                'Name': 'string',
                'Details': {
                    'BucketName': 'string',
                    'CodeArtifacts': {
                        'SourceCodeArtifactsObjectKey': 'string',
                        'BuildArtifactsObjectKey': 'string'
                    }
                }
            },
            'RequestMetadata': {
                'RequestId': 'string',
                'Requester': 'string',
                'EventInfo': {
                    'Name': 'string',
                    'State': 'string'
                },
                'VendorName': 'GitHub'|'GitLab'|'NativeS3'
            }
        },
        'AssociationArn': 'string',
        'Metrics': {
            'MeteredLinesOfCodeCount': 123,
            'SuppressedLinesOfCodeCount': 123,
            'FindingsCount': 123
        },
        'AnalysisTypes': [
            'Security'|'CodeQuality',
        ],
        'ConfigFileState': 'Present'|'Absent'|'PresentWithErrors'
    }
}

Response Structure

  • (dict) --

    • CodeReview (dict) --

      Information about a code review. A code review belongs to the associated repository that contains the reviewed code.

      • Name (string) --

        The name of the code review.

      • CodeReviewArn (string) --

        The Amazon Resource Name (ARN) of the ` CodeReview https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_CodeReview.html`__ object.

      • RepositoryName (string) --

        The name of the repository.

      • Owner (string) --

        The owner of the repository. For an Amazon Web Services CodeCommit repository, this is the Amazon Web Services account ID of the account that owns the repository. For a GitHub, GitHub Enterprise Server, or Bitbucket repository, this is the username for the account that owns the repository. For an S3 repository, it can be the username or Amazon Web Services account ID.

      • ProviderType (string) --

        The type of repository that contains the reviewed code (for example, GitHub or Bitbucket).

      • State (string) --

        The valid code review states are:

        • Completed : The code review is complete.

        • Pending : The code review started and has not completed or failed.

        • Failed : The code review failed.

        • Deleting : The code review is being deleted.

      • StateReason (string) --

        The reason for the state of the code review.

      • CreatedTimeStamp (datetime) --

        The time, in milliseconds since the epoch, when the code review was created.

      • LastUpdatedTimeStamp (datetime) --

        The time, in milliseconds since the epoch, when the code review was last updated.

      • Type (string) --

        The type of code review.

      • PullRequestId (string) --

        The pull request ID for the code review.

      • SourceCodeType (dict) --

        The type of the source code for the code review.

        • CommitDiff (dict) --

          A ` SourceCodeType https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_SourceCodeType`__ that specifies a commit diff created by a pull request on an associated repository.

          • SourceCommit (string) --

            The SHA of the source commit used to generate a commit diff. This field is required for a pull request code review.

          • DestinationCommit (string) --

            The SHA of the destination commit used to generate a commit diff. This field is required for a pull request code review.

          • MergeBaseCommit (string) --

            The SHA of the merge base of a commit.

        • RepositoryHead (dict) --

          A ` SourceCodeType https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_SourceCodeType`__ that specifies the tip of a branch in an associated repository.

          • BranchName (string) --

            The name of the branch in an associated repository. The RepositoryHeadSourceCodeType specifies the tip of this branch.

        • BranchDiff (dict) --

          A type of ` SourceCodeType https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_SourceCodeType`__ that specifies a source branch name and a destination branch name in an associated repository.

          • SourceBranchName (string) --

            The source branch for a diff in an associated repository.

          • DestinationBranchName (string) --

            The destination branch for a diff in an associated repository.

        • S3BucketRepository (dict) --

          Information about an associated repository in an S3 bucket that includes its name and an S3RepositoryDetails object. The S3RepositoryDetails object includes the name of an S3 bucket, an S3 key for a source code .zip file, and an S3 key for a build artifacts .zip file. S3BucketRepository is required in ` SourceCodeType https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_SourceCodeType`__ for S3BucketRepository based code reviews.

          • Name (string) --

            The name of the repository when the ProviderType is S3Bucket .

          • Details (dict) --

            An S3RepositoryDetails object that specifies the name of an S3 bucket and a CodeArtifacts object. The CodeArtifacts object includes the S3 object keys for a source code .zip file and for a build artifacts .zip file.

            • BucketName (string) --

              The name of the S3 bucket used for associating a new S3 repository. It must begin with codeguru-reviewer- .

            • CodeArtifacts (dict) --

              A CodeArtifacts object. The CodeArtifacts object includes the S3 object key for a source code .zip file and for a build artifacts .zip file that contains .jar or .class files.

              • SourceCodeArtifactsObjectKey (string) --

                The S3 object key for a source code .zip file. This is required for all code reviews.

              • BuildArtifactsObjectKey (string) --

                The S3 object key for a build artifacts .zip file that contains .jar or .class files. This is required for a code review with security analysis. For more information, see Create code reviews with security analysis in the Amazon CodeGuru Reviewer User Guide .

        • RequestMetadata (dict) --

          Metadata that is associated with a code review. This applies to any type of code review supported by CodeGuru Reviewer. The RequestMetadaa field captures any event metadata. For example, it might capture metadata associated with an event trigger, such as a push or a pull request.

          • RequestId (string) --

            The ID of the request. This is required for a pull request code review.

          • Requester (string) --

            An identifier, such as a name or account ID, that is associated with the requester. The Requester is used to capture the author/actor name of the event request.

          • EventInfo (dict) --

            Information about the event associated with a code review.

            • Name (string) --

              The name of the event. The possible names are pull_request , workflow_dispatch , schedule , and push

            • State (string) --

              The state of an event. The state might be open, closed, or another state.

          • VendorName (string) --

            The name of the repository vendor used to upload code to an S3 bucket for a CI/CD code review. For example, if code and artifacts are uploaded to an S3 bucket for a CI/CD code review by GitHub scripts from a GitHub repository, then the repository association's ProviderType is S3Bucket and the CI/CD repository vendor name is GitHub. For more information, see the definition for ProviderType in RepositoryAssociation .

      • AssociationArn (string) --

        The Amazon Resource Name (ARN) of the ` RepositoryAssociation https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_RepositoryAssociation.html`__ that contains the reviewed source code. You can retrieve associated repository ARNs by calling ` ListRepositoryAssociations https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_ListRepositoryAssociations.html`__ .

      • Metrics (dict) --

        The statistics from the code review.

        • MeteredLinesOfCodeCount (integer) --

          MeteredLinesOfCodeCount is the number of lines of code in the repository where the code review happened. This does not include non-code lines such as comments and blank lines.

        • SuppressedLinesOfCodeCount (integer) --

          SuppressedLinesOfCodeCount is the number of lines of code in the repository where the code review happened that CodeGuru Reviewer did not analyze. The lines suppressed in the analysis is based on the excludeFiles variable in the aws-codeguru-reviewer.yml file. This number does not include non-code lines such as comments and blank lines.

        • FindingsCount (integer) --

          Total number of recommendations found in the code review.

      • AnalysisTypes (list) --

        The types of analysis performed during a repository analysis or a pull request review. You can specify either Security , CodeQuality , or both.

        • (string) --

      • ConfigFileState (string) --

        The state of the aws-codeguru-reviewer.yml configuration file that allows the configuration of the CodeGuru Reviewer analysis. The file either exists, doesn't exist, or exists with errors at the root directory of your repository.

DescribeCodeReview (updated) Link ¶
Changes (response)
{'CodeReview': {'ConfigFileState': 'Present | Absent | PresentWithErrors',
                'Metrics': {'SuppressedLinesOfCodeCount': 'long'}}}

Returns the metadata associated with the code review along with its status.

See also: AWS API Documentation

Request Syntax

client.describe_code_review(
    CodeReviewArn='string'
)
type CodeReviewArn

string

param CodeReviewArn

[REQUIRED]

The Amazon Resource Name (ARN) of the ` CodeReview https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_CodeReview.html`__ object.

rtype

dict

returns

Response Syntax

{
    'CodeReview': {
        'Name': 'string',
        'CodeReviewArn': 'string',
        'RepositoryName': 'string',
        'Owner': 'string',
        'ProviderType': 'CodeCommit'|'GitHub'|'Bitbucket'|'GitHubEnterpriseServer'|'S3Bucket',
        'State': 'Completed'|'Pending'|'Failed'|'Deleting',
        'StateReason': 'string',
        'CreatedTimeStamp': datetime(2015, 1, 1),
        'LastUpdatedTimeStamp': datetime(2015, 1, 1),
        'Type': 'PullRequest'|'RepositoryAnalysis',
        'PullRequestId': 'string',
        'SourceCodeType': {
            'CommitDiff': {
                'SourceCommit': 'string',
                'DestinationCommit': 'string',
                'MergeBaseCommit': 'string'
            },
            'RepositoryHead': {
                'BranchName': 'string'
            },
            'BranchDiff': {
                'SourceBranchName': 'string',
                'DestinationBranchName': 'string'
            },
            'S3BucketRepository': {
                'Name': 'string',
                'Details': {
                    'BucketName': 'string',
                    'CodeArtifacts': {
                        'SourceCodeArtifactsObjectKey': 'string',
                        'BuildArtifactsObjectKey': 'string'
                    }
                }
            },
            'RequestMetadata': {
                'RequestId': 'string',
                'Requester': 'string',
                'EventInfo': {
                    'Name': 'string',
                    'State': 'string'
                },
                'VendorName': 'GitHub'|'GitLab'|'NativeS3'
            }
        },
        'AssociationArn': 'string',
        'Metrics': {
            'MeteredLinesOfCodeCount': 123,
            'SuppressedLinesOfCodeCount': 123,
            'FindingsCount': 123
        },
        'AnalysisTypes': [
            'Security'|'CodeQuality',
        ],
        'ConfigFileState': 'Present'|'Absent'|'PresentWithErrors'
    }
}

Response Structure

  • (dict) --

    • CodeReview (dict) --

      Information about the code review.

      • Name (string) --

        The name of the code review.

      • CodeReviewArn (string) --

        The Amazon Resource Name (ARN) of the ` CodeReview https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_CodeReview.html`__ object.

      • RepositoryName (string) --

        The name of the repository.

      • Owner (string) --

        The owner of the repository. For an Amazon Web Services CodeCommit repository, this is the Amazon Web Services account ID of the account that owns the repository. For a GitHub, GitHub Enterprise Server, or Bitbucket repository, this is the username for the account that owns the repository. For an S3 repository, it can be the username or Amazon Web Services account ID.

      • ProviderType (string) --

        The type of repository that contains the reviewed code (for example, GitHub or Bitbucket).

      • State (string) --

        The valid code review states are:

        • Completed : The code review is complete.

        • Pending : The code review started and has not completed or failed.

        • Failed : The code review failed.

        • Deleting : The code review is being deleted.

      • StateReason (string) --

        The reason for the state of the code review.

      • CreatedTimeStamp (datetime) --

        The time, in milliseconds since the epoch, when the code review was created.

      • LastUpdatedTimeStamp (datetime) --

        The time, in milliseconds since the epoch, when the code review was last updated.

      • Type (string) --

        The type of code review.

      • PullRequestId (string) --

        The pull request ID for the code review.

      • SourceCodeType (dict) --

        The type of the source code for the code review.

        • CommitDiff (dict) --

          A ` SourceCodeType https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_SourceCodeType`__ that specifies a commit diff created by a pull request on an associated repository.

          • SourceCommit (string) --

            The SHA of the source commit used to generate a commit diff. This field is required for a pull request code review.

          • DestinationCommit (string) --

            The SHA of the destination commit used to generate a commit diff. This field is required for a pull request code review.

          • MergeBaseCommit (string) --

            The SHA of the merge base of a commit.

        • RepositoryHead (dict) --

          A ` SourceCodeType https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_SourceCodeType`__ that specifies the tip of a branch in an associated repository.

          • BranchName (string) --

            The name of the branch in an associated repository. The RepositoryHeadSourceCodeType specifies the tip of this branch.

        • BranchDiff (dict) --

          A type of ` SourceCodeType https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_SourceCodeType`__ that specifies a source branch name and a destination branch name in an associated repository.

          • SourceBranchName (string) --

            The source branch for a diff in an associated repository.

          • DestinationBranchName (string) --

            The destination branch for a diff in an associated repository.

        • S3BucketRepository (dict) --

          Information about an associated repository in an S3 bucket that includes its name and an S3RepositoryDetails object. The S3RepositoryDetails object includes the name of an S3 bucket, an S3 key for a source code .zip file, and an S3 key for a build artifacts .zip file. S3BucketRepository is required in ` SourceCodeType https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_SourceCodeType`__ for S3BucketRepository based code reviews.

          • Name (string) --

            The name of the repository when the ProviderType is S3Bucket .

          • Details (dict) --

            An S3RepositoryDetails object that specifies the name of an S3 bucket and a CodeArtifacts object. The CodeArtifacts object includes the S3 object keys for a source code .zip file and for a build artifacts .zip file.

            • BucketName (string) --

              The name of the S3 bucket used for associating a new S3 repository. It must begin with codeguru-reviewer- .

            • CodeArtifacts (dict) --

              A CodeArtifacts object. The CodeArtifacts object includes the S3 object key for a source code .zip file and for a build artifacts .zip file that contains .jar or .class files.

              • SourceCodeArtifactsObjectKey (string) --

                The S3 object key for a source code .zip file. This is required for all code reviews.

              • BuildArtifactsObjectKey (string) --

                The S3 object key for a build artifacts .zip file that contains .jar or .class files. This is required for a code review with security analysis. For more information, see Create code reviews with security analysis in the Amazon CodeGuru Reviewer User Guide .

        • RequestMetadata (dict) --

          Metadata that is associated with a code review. This applies to any type of code review supported by CodeGuru Reviewer. The RequestMetadaa field captures any event metadata. For example, it might capture metadata associated with an event trigger, such as a push or a pull request.

          • RequestId (string) --

            The ID of the request. This is required for a pull request code review.

          • Requester (string) --

            An identifier, such as a name or account ID, that is associated with the requester. The Requester is used to capture the author/actor name of the event request.

          • EventInfo (dict) --

            Information about the event associated with a code review.

            • Name (string) --

              The name of the event. The possible names are pull_request , workflow_dispatch , schedule , and push

            • State (string) --

              The state of an event. The state might be open, closed, or another state.

          • VendorName (string) --

            The name of the repository vendor used to upload code to an S3 bucket for a CI/CD code review. For example, if code and artifacts are uploaded to an S3 bucket for a CI/CD code review by GitHub scripts from a GitHub repository, then the repository association's ProviderType is S3Bucket and the CI/CD repository vendor name is GitHub. For more information, see the definition for ProviderType in RepositoryAssociation .

      • AssociationArn (string) --

        The Amazon Resource Name (ARN) of the ` RepositoryAssociation https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_RepositoryAssociation.html`__ that contains the reviewed source code. You can retrieve associated repository ARNs by calling ` ListRepositoryAssociations https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_ListRepositoryAssociations.html`__ .

      • Metrics (dict) --

        The statistics from the code review.

        • MeteredLinesOfCodeCount (integer) --

          MeteredLinesOfCodeCount is the number of lines of code in the repository where the code review happened. This does not include non-code lines such as comments and blank lines.

        • SuppressedLinesOfCodeCount (integer) --

          SuppressedLinesOfCodeCount is the number of lines of code in the repository where the code review happened that CodeGuru Reviewer did not analyze. The lines suppressed in the analysis is based on the excludeFiles variable in the aws-codeguru-reviewer.yml file. This number does not include non-code lines such as comments and blank lines.

        • FindingsCount (integer) --

          Total number of recommendations found in the code review.

      • AnalysisTypes (list) --

        The types of analysis performed during a repository analysis or a pull request review. You can specify either Security , CodeQuality , or both.

        • (string) --

      • ConfigFileState (string) --

        The state of the aws-codeguru-reviewer.yml configuration file that allows the configuration of the CodeGuru Reviewer analysis. The file either exists, doesn't exist, or exists with errors at the root directory of your repository.

ListCodeReviews (updated) Link ¶
Changes (response)
{'CodeReviewSummaries': {'MetricsSummary': {'SuppressedLinesOfCodeCount': 'long'}}}

Lists all the code reviews that the customer has created in the past 90 days.

See also: AWS API Documentation

Request Syntax

client.list_code_reviews(
    ProviderTypes=[
        'CodeCommit'|'GitHub'|'Bitbucket'|'GitHubEnterpriseServer'|'S3Bucket',
    ],
    States=[
        'Completed'|'Pending'|'Failed'|'Deleting',
    ],
    RepositoryNames=[
        'string',
    ],
    Type='PullRequest'|'RepositoryAnalysis',
    MaxResults=123,
    NextToken='string'
)
type ProviderTypes

list

param ProviderTypes

List of provider types for filtering that needs to be applied before displaying the result. For example, providerTypes=[GitHub] lists code reviews from GitHub.

  • (string) --

type States

list

param States

List of states for filtering that needs to be applied before displaying the result. For example, states=[Pending] lists code reviews in the Pending state.

The valid code review states are:

  • Completed : The code review is complete.

  • Pending : The code review started and has not completed or failed.

  • Failed : The code review failed.

  • Deleting : The code review is being deleted.

  • (string) --

type RepositoryNames

list

param RepositoryNames

List of repository names for filtering that needs to be applied before displaying the result.

  • (string) --

type Type

string

param Type

[REQUIRED]

The type of code reviews to list in the response.

type MaxResults

integer

param MaxResults

The maximum number of results that are returned per call. The default is 100.

type NextToken

string

param NextToken

If nextToken is returned, there are more results available. The value of nextToken is a unique pagination token for each page. Make the call again using the returned token to retrieve the next page. Keep all other arguments unchanged.

rtype

dict

returns

Response Syntax

{
    'CodeReviewSummaries': [
        {
            'Name': 'string',
            'CodeReviewArn': 'string',
            'RepositoryName': 'string',
            'Owner': 'string',
            'ProviderType': 'CodeCommit'|'GitHub'|'Bitbucket'|'GitHubEnterpriseServer'|'S3Bucket',
            'State': 'Completed'|'Pending'|'Failed'|'Deleting',
            'CreatedTimeStamp': datetime(2015, 1, 1),
            'LastUpdatedTimeStamp': datetime(2015, 1, 1),
            'Type': 'PullRequest'|'RepositoryAnalysis',
            'PullRequestId': 'string',
            'MetricsSummary': {
                'MeteredLinesOfCodeCount': 123,
                'SuppressedLinesOfCodeCount': 123,
                'FindingsCount': 123
            },
            'SourceCodeType': {
                'CommitDiff': {
                    'SourceCommit': 'string',
                    'DestinationCommit': 'string',
                    'MergeBaseCommit': 'string'
                },
                'RepositoryHead': {
                    'BranchName': 'string'
                },
                'BranchDiff': {
                    'SourceBranchName': 'string',
                    'DestinationBranchName': 'string'
                },
                'S3BucketRepository': {
                    'Name': 'string',
                    'Details': {
                        'BucketName': 'string',
                        'CodeArtifacts': {
                            'SourceCodeArtifactsObjectKey': 'string',
                            'BuildArtifactsObjectKey': 'string'
                        }
                    }
                },
                'RequestMetadata': {
                    'RequestId': 'string',
                    'Requester': 'string',
                    'EventInfo': {
                        'Name': 'string',
                        'State': 'string'
                    },
                    'VendorName': 'GitHub'|'GitLab'|'NativeS3'
                }
            }
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • CodeReviewSummaries (list) --

      A list of code reviews that meet the criteria of the request.

      • (dict) --

        Information about the summary of the code review.

        • Name (string) --

          The name of the code review.

        • CodeReviewArn (string) --

          The Amazon Resource Name (ARN) of the ` CodeReview https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_CodeReview.html`__ object.

        • RepositoryName (string) --

          The name of the repository.

        • Owner (string) --

          The owner of the repository. For an Amazon Web Services CodeCommit repository, this is the Amazon Web Services account ID of the account that owns the repository. For a GitHub, GitHub Enterprise Server, or Bitbucket repository, this is the username for the account that owns the repository. For an S3 repository, it can be the username or Amazon Web Services account ID.

        • ProviderType (string) --

          The provider type of the repository association.

        • State (string) --

          The state of the code review.

          The valid code review states are:

          • Completed : The code review is complete.

          • Pending : The code review started and has not completed or failed.

          • Failed : The code review failed.

          • Deleting : The code review is being deleted.

        • CreatedTimeStamp (datetime) --

          The time, in milliseconds since the epoch, when the code review was created.

        • LastUpdatedTimeStamp (datetime) --

          The time, in milliseconds since the epoch, when the code review was last updated.

        • Type (string) --

          The type of the code review.

        • PullRequestId (string) --

          The pull request ID for the code review.

        • MetricsSummary (dict) --

          The statistics from the code review.

          • MeteredLinesOfCodeCount (integer) --

            Lines of code metered in the code review. For the initial code review pull request and all subsequent revisions, this includes all lines of code in the files added to the pull request. In subsequent revisions, for files that already existed in the pull request, this includes only the changed lines of code. In both cases, this does not include non-code lines such as comments and import statements. For example, if you submit a pull request containing 5 files, each with 500 lines of code, and in a subsequent revision you added a new file with 200 lines of code, and also modified a total of 25 lines across the initial 5 files, MeteredLinesOfCodeCount includes the first 5 files (5 * 500 = 2,500 lines), the new file (200 lines) and the 25 changed lines of code for a total of 2,725 lines of code.

          • SuppressedLinesOfCodeCount (integer) --

            Lines of code suppressed in the code review based on the excludeFiles element in the aws-codeguru-reviewer.yml file. For full repository analyses, this number includes all lines of code in the files that are suppressed. For pull requests, this number only includes the changed lines of code that are suppressed. In both cases, this number does not include non-code lines such as comments and import statements. For example, if you initiate a full repository analysis on a repository containing 5 files, each file with 100 lines of code, and 2 files are listed as excluded in the aws-codeguru-reviewer.yml file, then SuppressedLinesOfCodeCount returns 200 (2 * 100) as the total number of lines of code suppressed. However, if you submit a pull request for the same repository, then SuppressedLinesOfCodeCount only includes the lines in the 2 files that changed. If only 1 of the 2 files changed in the pull request, then SuppressedLinesOfCodeCount returns 100 (1 * 100) as the total number of lines of code suppressed.

          • FindingsCount (integer) --

            Total number of recommendations found in the code review.

        • SourceCodeType (dict) --

          Specifies the source code that is analyzed in a code review.

          • CommitDiff (dict) --

            A ` SourceCodeType https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_SourceCodeType`__ that specifies a commit diff created by a pull request on an associated repository.

            • SourceCommit (string) --

              The SHA of the source commit used to generate a commit diff. This field is required for a pull request code review.

            • DestinationCommit (string) --

              The SHA of the destination commit used to generate a commit diff. This field is required for a pull request code review.

            • MergeBaseCommit (string) --

              The SHA of the merge base of a commit.

          • RepositoryHead (dict) --

            A ` SourceCodeType https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_SourceCodeType`__ that specifies the tip of a branch in an associated repository.

            • BranchName (string) --

              The name of the branch in an associated repository. The RepositoryHeadSourceCodeType specifies the tip of this branch.

          • BranchDiff (dict) --

            A type of ` SourceCodeType https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_SourceCodeType`__ that specifies a source branch name and a destination branch name in an associated repository.

            • SourceBranchName (string) --

              The source branch for a diff in an associated repository.

            • DestinationBranchName (string) --

              The destination branch for a diff in an associated repository.

          • S3BucketRepository (dict) --

            Information about an associated repository in an S3 bucket that includes its name and an S3RepositoryDetails object. The S3RepositoryDetails object includes the name of an S3 bucket, an S3 key for a source code .zip file, and an S3 key for a build artifacts .zip file. S3BucketRepository is required in ` SourceCodeType https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_SourceCodeType`__ for S3BucketRepository based code reviews.

            • Name (string) --

              The name of the repository when the ProviderType is S3Bucket .

            • Details (dict) --

              An S3RepositoryDetails object that specifies the name of an S3 bucket and a CodeArtifacts object. The CodeArtifacts object includes the S3 object keys for a source code .zip file and for a build artifacts .zip file.

              • BucketName (string) --

                The name of the S3 bucket used for associating a new S3 repository. It must begin with codeguru-reviewer- .

              • CodeArtifacts (dict) --

                A CodeArtifacts object. The CodeArtifacts object includes the S3 object key for a source code .zip file and for a build artifacts .zip file that contains .jar or .class files.

                • SourceCodeArtifactsObjectKey (string) --

                  The S3 object key for a source code .zip file. This is required for all code reviews.

                • BuildArtifactsObjectKey (string) --

                  The S3 object key for a build artifacts .zip file that contains .jar or .class files. This is required for a code review with security analysis. For more information, see Create code reviews with security analysis in the Amazon CodeGuru Reviewer User Guide .

          • RequestMetadata (dict) --

            Metadata that is associated with a code review. This applies to any type of code review supported by CodeGuru Reviewer. The RequestMetadaa field captures any event metadata. For example, it might capture metadata associated with an event trigger, such as a push or a pull request.

            • RequestId (string) --

              The ID of the request. This is required for a pull request code review.

            • Requester (string) --

              An identifier, such as a name or account ID, that is associated with the requester. The Requester is used to capture the author/actor name of the event request.

            • EventInfo (dict) --

              Information about the event associated with a code review.

              • Name (string) --

                The name of the event. The possible names are pull_request , workflow_dispatch , schedule , and push

              • State (string) --

                The state of an event. The state might be open, closed, or another state.

            • VendorName (string) --

              The name of the repository vendor used to upload code to an S3 bucket for a CI/CD code review. For example, if code and artifacts are uploaded to an S3 bucket for a CI/CD code review by GitHub scripts from a GitHub repository, then the repository association's ProviderType is S3Bucket and the CI/CD repository vendor name is GitHub. For more information, see the definition for ProviderType in RepositoryAssociation .

    • NextToken (string) --

      Pagination token.