Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Add explicit return type for most functions #138

Merged
merged 3 commits into from
Dec 10, 2024

Conversation

lym953
Copy link
Contributor

@lym953 lym953 commented Oct 22, 2024

What does this PR do?

Add explicit return type for most functions.

Not adding return type for functions whose return type is too long, e.g.

function findSubscriptionsInTemplate(resources: Resources): {
    key: string;
    subscriptionResource: {
        Type: string;
        Properties: any;
    };
}[] {
  ...
}

Motivation

To make code easier to understand.

Testing Guidelines

npm test can still pass.

Additional Notes

Types of changes

  • Bug fix
  • New feature
  • Breaking change
  • Misc (docs, refactoring, dependency upgrade, etc.)

Check all that apply

  • This PR's description is comprehensive
  • This PR contains breaking changes that are documented in the description
  • This PR introduces new APIs or parameters that are documented and unlikely to change in the foreseeable future
  • This PR impacts documentation, and it has been updated (or a ticket has been logged)
  • This PR's changes are covered by the automated tests
  • This PR collects user input/sensitive content into Datadog

@lym953 lym953 requested a review from a team as a code owner October 22, 2024 19:26
@@ -243,7 +249,7 @@ export async function shouldSubscribeLogGroup(cloudWatchLogs: CloudWatchLogs, lo
return true;
}

async function describeSubscriptionFilters(cloudWatchLogs: CloudWatchLogs, logGroupName: string) {
async function describeSubscriptionFilters(cloudWatchLogs: CloudWatchLogs, logGroupName: string): Promise<any> {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Quality Violation

Unexpected any. Specify a different type. (...read more)

Do not use the any type, as it is too broad and can lead to unexpected behavior.

View in Datadog  Leave us feedback  Documentation

export async function getExistingLambdaLogGroupsOnStack(
cloudWatchLogs: CloudWatchLogs,
stackName: string,
): Promise<any> {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Quality Violation

Unexpected any. Specify a different type. (...read more)

Do not use the any type, as it is too broad and can lead to unexpected behavior.

View in Datadog  Leave us feedback  Documentation

Base automatically changed from yiming.luo/fix-test to main December 10, 2024 17:28
@duncanista duncanista merged commit daf17af into main Dec 10, 2024
12 checks passed
@duncanista duncanista deleted the yiming.luo/add-return-type branch December 10, 2024 17:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants