Skip to content

Commit

Permalink
feat(client-codeguru-reviewer): Amazon CodeGuru Reviewer now supports…
Browse files Browse the repository at this point in the history
… suppressing recommendations from being generated on specific files and directories.
  • Loading branch information
awstools committed Apr 29, 2022
1 parent 5bea879 commit 0aabfad
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 12 deletions.
45 changes: 43 additions & 2 deletions clients/client-codeguru-reviewer/src/models/models_0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1020,6 +1020,12 @@ export namespace CreateCodeReviewRequest {
});
}

export enum ConfigFileState {
ABSENT = "Absent",
PRESENT = "Present",
PRESENT_WITH_ERRORS = "PresentWithErrors",
}

/**
* <p>
* Information about the statistics from the code review.
Expand All @@ -1028,12 +1034,22 @@ export namespace CreateCodeReviewRequest {
export interface Metrics {
/**
* <p>
* <code>MeteredLinesOfCode</code> is the number of lines of code in the repository where the code review happened.
* <code>MeteredLinesOfCodeCount</code> 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.
* </p>
*/
MeteredLinesOfCodeCount?: number;

/**
* <p>
* <code>SuppressedLinesOfCodeCount</code> 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 <code>excludeFiles</code> variable in the
* <code>aws-codeguru-reviewer.yml</code> file. This number does not include non-code lines
* such as comments and blank lines. </p>
*/
SuppressedLinesOfCodeCount?: number;

/**
* <p>
* Total number of recommendations found in the code review.
Expand Down Expand Up @@ -1196,10 +1212,17 @@ export interface CodeReview {
Metrics?: Metrics;

/**
* <p>They types of analysis performed during a repository analysis or a pull request review. You can specify either
* <p>The types of analysis performed during a repository analysis or a pull request review. You can specify either
* <code>Security</code>, <code>CodeQuality</code>, or both.</p>
*/
AnalysisTypes?: (AnalysisType | string)[];

/**
* <p>The state of the <code>aws-codeguru-reviewer.yml</code> 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.</p>
*/
ConfigFileState?: ConfigFileState | string;
}

export namespace CodeReview {
Expand Down Expand Up @@ -1653,6 +1676,24 @@ export interface MetricsSummary {
*/
MeteredLinesOfCodeCount?: number;

/**
* <p>Lines of code suppressed in the code review based on the <code>excludeFiles</code>
* element in the <code>aws-codeguru-reviewer.yml</code> 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 <i>changed</i> 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 <code>aws-codeguru-reviewer.yml</code> file, then
* <code>SuppressedLinesOfCodeCount</code> 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 <code>SuppressedLinesOfCodeCount</code> only includes the lines in the 2 files
* that changed. If only 1 of the 2 files changed in the pull request, then
* <code>SuppressedLinesOfCodeCount</code> returns 100 (1 * 100) as the total number of
* lines of code suppressed.</p>
*/
SuppressedLinesOfCodeCount?: number;

/**
* <p>
* Total number of recommendations found in the code review.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1691,6 +1691,7 @@ const deserializeAws_restJson1CodeReview = (output: any, context: __SerdeContext
: undefined,
AssociationArn: __expectString(output.AssociationArn),
CodeReviewArn: __expectString(output.CodeReviewArn),
ConfigFileState: __expectString(output.ConfigFileState),
CreatedTimeStamp:
output.CreatedTimeStamp !== undefined && output.CreatedTimeStamp !== null
? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.CreatedTimeStamp)))
Expand Down Expand Up @@ -1788,13 +1789,15 @@ const deserializeAws_restJson1Metrics = (output: any, context: __SerdeContext):
return {
FindingsCount: __expectLong(output.FindingsCount),
MeteredLinesOfCodeCount: __expectLong(output.MeteredLinesOfCodeCount),
SuppressedLinesOfCodeCount: __expectLong(output.SuppressedLinesOfCodeCount),
} as any;
};

const deserializeAws_restJson1MetricsSummary = (output: any, context: __SerdeContext): MetricsSummary => {
return {
FindingsCount: __expectLong(output.FindingsCount),
MeteredLinesOfCodeCount: __expectLong(output.MeteredLinesOfCodeCount),
SuppressedLinesOfCodeCount: __expectLong(output.SuppressedLinesOfCodeCount),
} as any;
};

Expand Down
58 changes: 48 additions & 10 deletions codegen/sdk-codegen/aws-models/codeguru-reviewer.json
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,13 @@
"AnalysisTypes": {
"target": "com.amazonaws.codegurureviewer#AnalysisTypes",
"traits": {
"smithy.api#documentation": "<p>They types of analysis performed during a repository analysis or a pull request review. You can specify either \n <code>Security</code>, <code>CodeQuality</code>, or both.</p>"
"smithy.api#documentation": "<p>The types of analysis performed during a repository analysis or a pull request review. You can specify either \n <code>Security</code>, <code>CodeQuality</code>, or both.</p>"
}
},
"ConfigFileState": {
"target": "com.amazonaws.codegurureviewer#ConfigFileState",
"traits": {
"smithy.api#documentation": "<p>The state of the <code>aws-codeguru-reviewer.yml</code> configuration file that allows\n the configuration of the CodeGuru Reviewer analysis. The file either exists, doesn't exist, or exists\n with errors at the root directory of your repository.</p>"
}
}
},
Expand Down Expand Up @@ -571,6 +577,25 @@
}
}
},
"com.amazonaws.codegurureviewer#ConfigFileState": {
"type": "string",
"traits": {
"smithy.api#enum": [
{
"value": "Present",
"name": "PRESENT"
},
{
"value": "Absent",
"name": "ABSENT"
},
{
"value": "PresentWithErrors",
"name": "PRESENT_WITH_ERRORS"
}
]
}
},
"com.amazonaws.codegurureviewer#ConflictException": {
"type": "structure",
"members": {
Expand Down Expand Up @@ -1167,6 +1192,12 @@
"smithy.api#box": {}
}
},
"com.amazonaws.codegurureviewer#LinesOfCodeCount": {
"type": "long",
"traits": {
"smithy.api#box": {}
}
},
"com.amazonaws.codegurureviewer#ListCodeReviews": {
"type": "operation",
"input": {
Expand Down Expand Up @@ -1497,6 +1528,7 @@
"smithy.api#paginated": {
"inputToken": "NextToken",
"outputToken": "NextToken",
"items": "RepositoryAssociationSummaries",
"pageSize": "MaxResults"
}
}
Expand Down Expand Up @@ -1637,19 +1669,19 @@
}
}
},
"com.amazonaws.codegurureviewer#MeteredLinesOfCodeCount": {
"type": "long",
"traits": {
"smithy.api#box": {}
}
},
"com.amazonaws.codegurureviewer#Metrics": {
"type": "structure",
"members": {
"MeteredLinesOfCodeCount": {
"target": "com.amazonaws.codegurureviewer#MeteredLinesOfCodeCount",
"target": "com.amazonaws.codegurureviewer#LinesOfCodeCount",
"traits": {
"smithy.api#documentation": "<p>\n <code>MeteredLinesOfCodeCount</code> is the number of lines of code in the repository where the code review happened. \n This does not include non-code lines such as comments and blank lines.\n </p>"
}
},
"SuppressedLinesOfCodeCount": {
"target": "com.amazonaws.codegurureviewer#LinesOfCodeCount",
"traits": {
"smithy.api#documentation": "<p>\n <code>MeteredLinesOfCode</code> is the number of lines of code in the repository where the code review happened. \n This does not include non-code lines such as comments and blank lines.\n </p>"
"smithy.api#documentation": "<p>\n <code>SuppressedLinesOfCodeCount</code> is the number of lines of code in the repository\n where the code review happened that CodeGuru Reviewer did not analyze. The lines suppressed in the\n analysis is based on the <code>excludeFiles</code> variable in the\n <code>aws-codeguru-reviewer.yml</code> file. This number does not include non-code lines\n such as comments and blank lines. </p>"
}
},
"FindingsCount": {
Expand All @@ -1667,11 +1699,17 @@
"type": "structure",
"members": {
"MeteredLinesOfCodeCount": {
"target": "com.amazonaws.codegurureviewer#MeteredLinesOfCodeCount",
"target": "com.amazonaws.codegurureviewer#LinesOfCodeCount",
"traits": {
"smithy.api#documentation": "<p>\n Lines of code metered in the code review. For the initial code review pull request and all subsequent revisions, \n this includes all lines of code in the files added to the pull request. In subsequent revisions, for files that already \n 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 \n and import statements. For example, if you submit a pull request containing 5 files, each with 500 lines of code, and in \n 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, \n <code>MeteredLinesOfCodeCount</code> includes the first 5 files (5 * 500 = 2,500 lines), the new file (200 lines) and the 25 changed lines of\n code for a total of 2,725 lines of code.\n </p>"
}
},
"SuppressedLinesOfCodeCount": {
"target": "com.amazonaws.codegurureviewer#LinesOfCodeCount",
"traits": {
"smithy.api#documentation": "<p>Lines of code suppressed in the code review based on the <code>excludeFiles</code>\n element in the <code>aws-codeguru-reviewer.yml</code> file. For full repository analyses,\n this number includes all lines of code in the files that are suppressed. For pull requests,\n this number only includes the <i>changed</i> lines of code that are\n suppressed. In both cases, this number does not include non-code lines such as comments and\n import statements. For example, if you initiate a full repository analysis on a repository\n containing 5 files, each file with 100 lines of code, and 2 files are listed as excluded in\n the <code>aws-codeguru-reviewer.yml</code> file, then\n <code>SuppressedLinesOfCodeCount</code> returns 200 (2 * 100) as the total number of\n lines of code suppressed. However, if you submit a pull request for the same repository,\n then <code>SuppressedLinesOfCodeCount</code> only includes the lines in the 2 files\n that changed. If only 1 of the 2 files changed in the pull request, then\n <code>SuppressedLinesOfCodeCount</code> returns 100 (1 * 100) as the total number of\n lines of code suppressed.</p>"
}
},
"FindingsCount": {
"target": "com.amazonaws.codegurureviewer#FindingsCount",
"traits": {
Expand Down

0 comments on commit 0aabfad

Please sign in to comment.