Showing 27 of 43 total issues
Function dynamoDbDriver
has 115 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const dynamoDbDriver: DriverBuilder<DynamoDbParameters, AWS.DynamoDB.DocumentClient> = (
params,
logger: Logger
): DynamoDbDriver => {
let { TableName } = params;
Function rdsDriver
has 97 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const rdsDriver: DriverBuilder<AuroraRdsParameters, AWS.RDSDataService> = (
params: AuroraRdsParameters,
logger: Logger
): AuroraRdsDriver => {
let dataService: AWS.RDSDataService;
Function s3DriverBuilder
has 87 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const s3DriverBuilder: DriverBuilder<S3DriverParameters, AWS.S3> = (
params,
logger: Logger
): S3Driver => {
let bucketName: string;
Function getScripts
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
Open
export default async function getScripts({
config,
scope,
context,
log,
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function lambdaDriverBuilder
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const lambdaDriverBuilder: DriverBuilder<LambdaParameters, AWS.Lambda> = (
params,
logger: Logger
): LambdaDriver => {
let FunctionName: string;
Function cognitoDriver
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const cognitoDriver: DriverBuilder<CognitoDriverParams, AWS.CognitoIdentityServiceProvider> = (
params,
logger: Logger
): CognitoDriver => {
let cognitoidentityserviceprovider: AWS.CognitoIdentityServiceProvider;
Function tracker
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const tracker: ExecutionTracker<DynamoTrackerParams> = (params, log: Logger) => {
const { TableName } = params;
const DocumentDb = new AWS.DynamoDB.DocumentClient({
region: params.region,
apiVersion: "2012-08-10",
Function run
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async run() {
const { args, flags } = this.parse(List);
const { scripts } = await loadScripts(flags);
cli.info(`Found ${scripts.length} scripts`);
Function createScriptContext
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
Open
export default function createScriptContext(
drivers: Map<string, Driver<any, any>>,
config: { [key: string]: string },
log: Logger,
defaultParams?: Record<string, string>
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function loadScripts
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default async function loadScripts(
flags: DefaultFlagParameters
): Promise<LoadScriptsResult> {
let config = await loadConfiguration(path.resolve(flags.config), { flags });
let stage = "prod";
Function run
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async run() {
const { flags } = this.parse(Up);
let stage: string = "";
let scripts: Array<InitializedMigrationScript>;
let context: ScriptContext;
Function default
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function (flags: DefaultFlagParameters, numberToRun: number = Infinity): Listr {
let stage: string = "";
let scripts: Array<InitializedMigrationScript>;
let context: ScriptContext;
Function loadScript
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export async function loadScript<T>(
filename: string,
log: Logger,
scriptGlobals?: any
): Promise<T> {
Function createScriptContext
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function createScriptContext(
drivers: Map<string, Driver<any, any>>,
config: { [key: string]: string },
log: Logger,
defaultParams?: Record<string, string>
Function putRecordsBulk
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async putRecordsBulk<T>(records: Array<T>): Promise<Array<T>> {
logger(`Writing ${records.length} entries to ${TableName}`);
const params = {
ReturnConsumedCapacity: "INDEXES",
Function getStackOutput
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async function getStackOutput(
params: GetOutputParameters
): Promise<Array<AWS.CloudFormation.Output>> {
const region = params[REGION_KEY];
const stackName = params[STACK_KEY];
Function getResourceValue
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async function getResourceValue(log: Logger, params: GetResourceParameters): Promise<string> {
const { stack, region, logicalId } = params;
log(`Getting details for ${region} stack ${stack}`);
let data: ListStackResourcesOutput;
Function ProcessParams
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default async function ProcessParams(
params: Record<string, string | ProcessorParams>,
log: Logger,
defaultParams?: Record<string, string>
): Promise<Record<string, string>> {
Function cleanup
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async cleanup() {
if (!Object.keys(updatedVariables).length) {
return;
}
Function run
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async run() {
const { args, flags } = this.parse(New);
let config = await loadConfiguration(path.resolve(flags.config));
const prefix = DataMigrationProcessor.getMigrationsPath(config, flags.scope);