Skip to content

Commit

Permalink
refactor(chore): fix sonar smells after new analysis (#152)
Browse files Browse the repository at this point in the history
fix sonar code smells after new analysis performed on sonarcloud

GH-148
  • Loading branch information
sf-sahil-jassal committed Jan 10, 2024
1 parent 2065ab5 commit 1cdf543
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/middleware/ratelimit.middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export class RatelimitMiddlewareProvider implements Provider<Middleware> {
const operationMetadata = metadata ? metadata.options : {};

// Create options based on global config and method level config
const opts = Object.assign({}, this.config, operationMetadata);
const opts = {...this.config, ...operationMetadata};

if (dataStore) {
opts.store = dataStore;
Expand Down
2 changes: 1 addition & 1 deletion src/providers/ratelimit-action.provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export class RatelimitActionProvider implements Provider<RateLimitAction> {
const operationMetadata = metadata ? metadata.options : {};

// Create options based on global config and method level config
const opts = Object.assign({}, this.config, operationMetadata);
const opts = {...this.config, ...operationMetadata};

if (dataStore) {
opts.store = dataStore;
Expand Down
7 changes: 4 additions & 3 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ export interface DataSourceConfig {
export interface RateLimitConfig {
enabledByDefault?: boolean;
}
export interface RateLimitAction {
(request: Request, response: Response): Promise<void>;
}
export type RateLimitAction = (
request: Request,
response: Response,
) => Promise<void>;

export type RateLimitOptions = Writable<Partial<Options>> &
DataSourceConfig &
Expand Down

0 comments on commit 1cdf543

Please sign in to comment.