Skip to content

Commit

Permalink
fix(all-services): fix sonar issues in all services (#2018)
Browse files Browse the repository at this point in the history
  • Loading branch information
arpit1503khanna authored Mar 5, 2024
1 parent 780175c commit 33dfa77
Show file tree
Hide file tree
Showing 50 changed files with 112 additions and 104 deletions.
6 changes: 4 additions & 2 deletions packages/cli/src/__tests__/commands/extension.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import {extensionSuite} from '../suite/extension';
import {commandTest} from '../helper/command-test.helper';
import {Extension} from '../../commands/extension';
import {commandTest} from '../helper/command-test.helper';
import {extensionSuite} from '../suite/extension';

// sonarignore:start
describe('extension', () => {
extensionSuite.forEach(testCase => {
commandTest(testCase, Extension);
});
});
// sonarignore:end
8 changes: 5 additions & 3 deletions packages/cli/src/__tests__/commands/microservice.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import {microservicePromptsSuite} from '../suite/microservice-prompts';
import {microserviceOptionsSuite} from '../suite/microservice-options';
import {commandTest} from '../helper/command-test.helper';
import {Microservice} from '../../commands/microservice';
import {commandTest} from '../helper/command-test.helper';
import {microserviceOptionsSuite} from '../suite/microservice-options';
import {microservicePromptsSuite} from '../suite/microservice-prompts';

// sonarignore:start
describe('microservice', () => {
describe('with options', () => {
microserviceOptionsSuite.forEach(testCase => {
Expand All @@ -15,3 +16,4 @@ describe('microservice', () => {
});
});
});
// sonarignore:end
6 changes: 4 additions & 2 deletions packages/cli/src/__tests__/commands/scaffold.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import {scaffoldSuite} from '../suite/scaffold';
import {commandTest} from '../helper/command-test.helper';
import {Scaffold} from '../../commands/scaffold';
import {commandTest} from '../helper/command-test.helper';
import {scaffoldSuite} from '../suite/scaffold';

// sonarignore:start
describe('scaffold', () => {
scaffoldSuite.forEach(testCase => {
commandTest(testCase, Scaffold);
});
});
// sonarignore:end
6 changes: 4 additions & 2 deletions packages/cli/src/__tests__/commands/update.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import {updateSuite} from '../suite/update';
import {commandTest} from '../helper/command-test.helper';
import {Update} from '../../commands/update';
import {commandTest} from '../helper/command-test.helper';
import {updateSuite} from '../suite/update';

// sonarignore:start
describe('update', () => {
updateSuite.forEach(testCase => {
commandTest(testCase, Update);
});
});
// sonarignore:end
4 changes: 2 additions & 2 deletions packages/cli/src/commands/cdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import {CdkOptions} from '../types';

const DEFAULT_APP_PATH = 'src/application.ts';
export class Cdk extends Base<CdkOptions> {
static description = 'add arc-cdk';
static readonly description = 'add arc-cdk';

static flags = {
static readonly flags = {
help: flags.boolean({
name: 'help',
description: 'show manual pages',
Expand Down
6 changes: 3 additions & 3 deletions packages/cli/src/commands/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ import Base from '../command-base';
import {ExtensionOptions} from '../types';

export class Extension extends Base<ExtensionOptions> {
static description = 'add an extension';
static readonly description = 'add an extension';

static flags = {
static readonly flags = {
help: flags.boolean({
name: 'help',
description: 'show manual pages',
type: 'boolean',
}),
};
static args = [
static readonly args = [
{name: 'name', description: 'Name of the extension', required: false},
];

Expand Down
6 changes: 3 additions & 3 deletions packages/cli/src/commands/microservice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import {DATASOURCES, SERVICES} from '../enum';
import {MicroserviceOptions} from '../types';

export class Microservice extends Base<MicroserviceOptions> {
static description = 'add a microservice';
static readonly description = 'add a microservice';

static flags = {
static readonly flags = {
help: flags.boolean({
name: 'help',
description: 'show manual pages',
Expand Down Expand Up @@ -74,7 +74,7 @@ export class Microservice extends Base<MicroserviceOptions> {
exclusive: ['facade', 'includeMigrations'],
}),
};
static args = [
static readonly args = [
{name: 'name', description: 'Name of the microservice', required: false},
];

Expand Down
6 changes: 3 additions & 3 deletions packages/cli/src/commands/scaffold.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import Base from '../command-base';
import {ScaffoldOptions} from '../types';

export class Scaffold extends Base<ScaffoldOptions> {
static description = 'create a project scaffold';
static readonly description = 'create a project scaffold';

static flags = {
static readonly flags = {
help: flags.boolean({
name: 'help',
description: 'show manual pages',
Expand Down Expand Up @@ -38,7 +38,7 @@ export class Scaffold extends Base<ScaffoldOptions> {
description: 'description of the repo',
}),
};
static args = [
static readonly args = [
{name: 'name', description: 'name of the project', required: false},
];

Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/commands/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import Base from '../command-base';
import {UpdateOptions} from '../generators/update/types/types';

export class Update extends Base<UpdateOptions> {
static description = 'update the dependencies of a loopback project';
static readonly description = 'update the dependencies of a loopback project';

static flags = {
static readonly flags = {
help: flags.boolean({
name: 'help',
description: 'show manual pages',
Expand Down
84 changes: 42 additions & 42 deletions packages/core/locales/en.json
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
{
"Bearer realm=\"Users\"": "Bearer realm=\"Users\"",
"Not Found": "Not Found",
"EntityNotFound": "EntityNotFound",
"WorkflowVersionNotFound": "WorkflowVersionNotFound",
"[{\"instancePath\"": "\"/valueB\",\"schemaPath\":\"#/properties/valueB/type\",\"keyword\":\"type\",\"params\":{\"type\":\"string\"},\"message\":\"must be string\"}]",
"WorkflowNotFound": "WorkflowNotFound",
"The request body is invalid. See error object `details` property for more info.": "The request body is invalid. See error object `details` property for more info.",
"Client Invalid": "Client Invalid",
"Token Invalid": "Token Invalid",
"PasswordCannotBeChangedForExternalUser": "PasswordCannotBeChangedForExternalUser",
"Required parameter token is missing!": "Required parameter token is missing!",
"Password cannot be same as previous password!": "Password cannot be same as previous password!",
"Token Expired": "Token Expired",
"Invalid Credentials": "Invalid Credentials",
"NotAllowedAccess": "NotAllowedAccess",
"ReceiverNotFound": "ReceiverNotFound",
"No user is found with given criteria to send notifications.": "No user is found with given criteria to send notifications.",
"Entity not found": " message_files with id \"1\"",
"Cannot set properties of undefined (setting 'modifiedBy')": "Cannot set properties of undefined (setting 'modifiedBy')",
"Start Date Can Not Greater Then End Date": "Start Date Can Not Greater Then End Date",
"Primary Calendar Not Exist": "Primary Calendar Not Exist",
"Calendar Not Exist": "Calendar Not Exist",
"Subscription Not exist": "Subscription Not exist",
"Duplicate DayOfWeek": "Duplicate DayOfWeek",
"Id in Request Body not matching with Query Parameters": "Id in Request Body not matching with Query Parameters",
"Event Not Exist": "Event Not Exist",
"could not update the task": "could not update the task",
"Invalid API key or secret": "Invalid API key or secret",
"Action prohibited.": "Action prohibited.",
"Bad Request": "Bad Request",
"Display Order is missing in the request": "Display Order is missing in the request",
"Invalid survey Id": "Invalid survey Id",
"Entity not found.": "Entity not found.",
"Survey Id in path and body does not match": "Survey Id in path and body does not match",
"Responder Already Added": "Responder Already Added",
"Survey can not be deleted in this status": "Survey can not be deleted in this status",
"Survey start date should be current date only and status should be active": "Survey start date should be current date only and status should be active",
"End date can not be less than start date": "End date can not be less than start date",
"Survey can not be activated without a start date": "Survey can not be activated without a start date",
"Invalid value entered in name": "Invalid value entered in name",
"API not found !": "API not found !"
}
"Bearer realm=\"Users\"": "Bearer realm=\"Users\"",
"Not Found": "Not Found",
"EntityNotFound": "EntityNotFound",
"WorkflowVersionNotFound": "WorkflowVersionNotFound",
"[{\"instancePath\"": "\"/valueB\",\"schemaPath\":\"#/properties/valueB/type\",\"keyword\":\"type\",\"params\":{\"type\":\"string\"},\"message\":\"must be string\"}]",
"WorkflowNotFound": "WorkflowNotFound",
"The request body is invalid. See error object `details` property for more info.": "The request body is invalid. See error object `details` property for more info.",
"Client Invalid": "Client Invalid",
"Token Invalid": "Token Invalid",
"PasswordCannotBeChangedForExternalUser": "PasswordCannotBeChangedForExternalUser",
"Required parameter token is missing!": "Required parameter token is missing!",
"Password cannot be same as previous password!": "Password cannot be same as previous password!",
"Token Expired": "Token Expired",
"Invalid Credentials": "Invalid Credentials",
"NotAllowedAccess": "NotAllowedAccess",
"ReceiverNotFound": "ReceiverNotFound",
"No user is found with given criteria to send notifications.": "No user is found with given criteria to send notifications.",
"Entity not found": " message_files with id \"1\"",
"Cannot set properties of undefined (setting 'modifiedBy')": "Cannot set properties of undefined (setting 'modifiedBy')",
"Start Date Can Not Greater Then End Date": "Start Date Can Not Greater Then End Date",
"Primary Calendar Not Exist": "Primary Calendar Not Exist",
"Calendar Not Exist": "Calendar Not Exist",
"Subscription Not exist": "Subscription Not exist",
"Duplicate DayOfWeek": "Duplicate DayOfWeek",
"Id in Request Body not matching with Query Parameters": "Id in Request Body not matching with Query Parameters",
"Event Not Exist": "Event Not Exist",
"could not update the task": "could not update the task",
"Invalid API key or secret": "Invalid API key or secret",
"Action prohibited.": "Action prohibited.",
"Bad Request": "Bad Request",
"Display Order is missing in the request": "Display Order is missing in the request",
"Invalid survey Id": "Invalid survey Id",
"Entity not found.": "Entity not found.",
"Survey Id in path and body does not match": "Survey Id in path and body does not match",
"Responder Already Added": "Responder Already Added",
"Survey can not be deleted in this status": "Survey can not be deleted in this status",
"Survey start date should be current date only and status should be active": "Survey start date should be current date only and status should be active",
"End date can not be less than start date": "End date can not be less than start date",
"Survey can not be activated without a start date": "Survey can not be activated without a start date",
"Invalid value entered in name": "Invalid value entered in name",
"API not found !": "API not found !"
}
2 changes: 1 addition & 1 deletion sandbox/audit-ms-example/src/datasources/pg.datasource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class PgDataSource
extends juggler.DataSource
implements LifeCycleObserver
{
static dataSourceName = AuditDbSourceName;
static readonly dataSourceName = AuditDbSourceName;
static readonly defaultConfig = config;

constructor(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export class AuthCacheDataSource
extends juggler.DataSource
implements LifeCycleObserver
{
static dataSourceName = AuthCacheSourceName;
static readonly dataSourceName = AuthCacheSourceName;
static readonly defaultConfig = config;

constructor(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export class AuthDbDataSource
extends juggler.DataSource
implements LifeCycleObserver
{
static dataSourceName = AuthDbSourceName;
static readonly dataSourceName = AuthDbSourceName;
static readonly defaultConfig = config;

constructor(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class PgdbDataSource
extends juggler.DataSource
implements LifeCycleObserver
{
static dataSourceName = AuthDbSourceName;
static readonly dataSourceName = AuthDbSourceName;
static readonly defaultConfig = config;

constructor(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export class RedisDataSource
extends juggler.DataSource
implements LifeCycleObserver
{
static dataSourceName = AuthCacheSourceName;
static readonly dataSourceName = AuthCacheSourceName;
static readonly defaultConfig = config;

constructor(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class CacheDbDataSource
extends juggler.DataSource
implements LifeCycleObserver
{
static dataSourceName = 'cacheDb';
static readonly dataSourceName = 'cacheDb';
static readonly defaultConfig = config;

constructor(
Expand Down
2 changes: 1 addition & 1 deletion sandbox/cache-example/src/datasources/db.datasource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class DbDataSource
extends juggler.DataSource
implements LifeCycleObserver
{
static dataSourceName = 'db';
static readonly dataSourceName = 'db';
static readonly defaultConfig = config;

constructor(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export class AuthcacheDataSource
extends juggler.DataSource
implements LifeCycleObserver
{
static dataSourceName = AuthCacheSourceName;
static readonly dataSourceName = AuthCacheSourceName;
static readonly defaultConfig = config;

constructor(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export class MessageDataSource
extends juggler.DataSource
implements LifeCycleObserver
{
static dataSourceName = 'message';
static readonly dataSourceName = 'message';
static readonly defaultConfig = config;

constructor(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export class NotificationDataSource
extends juggler.DataSource
implements LifeCycleObserver
{
static dataSourceName = 'notification';
static readonly dataSourceName = 'notification';
static readonly defaultConfig = config;

constructor(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class ChatDbDataSource
extends juggler.DataSource
implements LifeCycleObserver
{
static dataSourceName = 'chatDb';
static readonly dataSourceName = 'chatDb';
static readonly defaultConfig = config;

constructor(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class NotifAccessCacheDataSource
extends juggler.DataSource
implements LifeCycleObserver
{
static dataSourceName = 'NotifAccessCache';
static readonly dataSourceName = 'NotifAccessCache';
static readonly defaultConfig = config;

constructor(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export class NotifdbDataSource
extends juggler.DataSource
implements LifeCycleObserver
{
static dataSourceName = NotifDbSourceName;
static readonly dataSourceName = NotifDbSourceName;
static readonly defaultConfig = config;

constructor(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export class AuthcacheDataSource
extends juggler.DataSource
implements LifeCycleObserver
{
static dataSourceName = AuthCacheSourceName;
static readonly dataSourceName = AuthCacheSourceName;
static readonly defaultConfig = config;

constructor(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export class MessageDataSource
extends juggler.DataSource
implements LifeCycleObserver
{
static dataSourceName = 'message';
static readonly dataSourceName = 'message';
static readonly defaultConfig = config;

constructor(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export class NotificationDataSource
extends juggler.DataSource
implements LifeCycleObserver
{
static dataSourceName = 'notification';
static readonly dataSourceName = 'notification';
static readonly defaultConfig = config;

constructor(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class ChatDbDataSource
extends juggler.DataSource
implements LifeCycleObserver
{
static dataSourceName = 'chatDb';
static readonly dataSourceName = 'chatDb';
static readonly defaultConfig = config;

constructor(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class NotifAccessCacheDataSource
extends juggler.DataSource
implements LifeCycleObserver
{
static dataSourceName = 'NotifAccessCache';
static readonly dataSourceName = 'NotifAccessCache';
static readonly defaultConfig = config;

constructor(
Expand Down
Loading

0 comments on commit 33dfa77

Please sign in to comment.