Skip to content

Commit

Permalink
chore: fix typos and code review issues
Browse files Browse the repository at this point in the history
Co-authored-by: David Lynam <[email protected]>
  • Loading branch information
eoinsha and David Lynam committed Dec 13, 2023
1 parent 576ceef commit e1b33ea
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 11 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ Metadata:
```
See the [Configuration](#configuration) section below for more detailed instructions on fine tuning SLIC Watch to your needs.

If you want to override the default alarm and dashboard settings for each Lambda Functino resource, add the `slicWatch` property to the `Metadata` section.
If you want to override the default alarm and dashboard settings for each Lambda Function resource, add the `slicWatch` property to the `Metadata` section.

### Adding the SLIC Watch Transform to CDK Apps
Once you have deployed the macro, add it to CDK Stack in the constructor of the class that extends Stack. It should be done for every Stack in the CDK App.
Expand Down Expand Up @@ -181,7 +181,7 @@ this.templateOptions.metadata = {

## Features

CloudWatch Alarms and Dashboard widgets are created for all supported resources in the CloudFormation stack generated by The Serverless Framework. This includes generated resources as well as resources specifed explicitly in the `resources` section.
CloudWatch Alarms and Dashboard widgets are created for all supported resources in the CloudFormation stack generated by The Serverless Framework. This includes generated resources as well as resources specified explicitly in the `resources` section.
Any feature can be configured or disabled completely - see the section on [configuration](#configuration) to see how.

### Lambda Functions
Expand Down Expand Up @@ -366,7 +366,7 @@ this.templateOptions.metadata = {
}
```

- The `alarmActionsConfig` may be optionally added to specifc one or more SNS Topic destinations for all alarm status changes to `ALARM` and `OK`. If you omit destination topics, alarms are still created but are not sent to any destination. For example:
- The `alarmActionsConfig` may be optionally added to specific one or more SNS Topic destinations for all alarm status changes to `ALARM` and `OK`. If you omit destination topics, alarms are still created but are not sent to any destination. For example:
```yaml
slicWatch:
alarmActionsConfig:
Expand Down
4 changes: 2 additions & 2 deletions core/inputs/general-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ export class ConfigError extends Error {

/**
* Validates and transforms the user-provided top-level configuration for SLIC Watch.
* The configuration is validated accoring to the config schema. Defaults are applied
* where not provided by the user. Finally, the alarm actions are addded.
* The configuration is validated according to the config schema. Defaults are applied
* where not provided by the user. Finally, the alarm actions are added.
*
* @param slicWatchConfig The user-provided configuration
* @returns Resolved configuration
Expand Down
5 changes: 1 addition & 4 deletions core/tests/testing-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,7 @@ export function getDashboardWidgetsByTitle (dashboard: Dashboard, ...patterns: R
return patterns.map((pattern) => {
const widgets = dashboard.widgets.filter((widget) => {
const props = widget.properties as MetricWidgetProperties
if (typeof props?.title === 'string') {
return pattern.test(props.title)
}
return false
return typeof props?.title === 'string' && pattern.test(props.title)
})
if (widgets.length > 1) {
throw new Error(`Multiple widgets found matching ${pattern}`)
Expand Down
3 changes: 1 addition & 2 deletions test-utils/snapshot-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ export function sortObject (obj: object): object {
const sortedObj: Record<string, any> = {}
for (const [key, value] of Object.entries(obj).sort(([a], [b]) => (a).localeCompare(b))) {
if (typeof value === 'object' && value !== null && !Array.isArray(value)) {
const obj = value
sortedObj[key] = sortObject(typeof obj.toJSON === 'function' ? obj.toJSON() : obj)
sortedObj[key] = sortObject(typeof value.toJSON === 'function' ? value.toJSON() : value)
} else {
sortedObj[key] = value
}
Expand Down

0 comments on commit e1b33ea

Please sign in to comment.