Showing 25 of 36 total issues
Function intentUtterProcessor
has 154 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function intentUtterProcessor(voxaSheets: IVoxaSheet[], AVAILABLE_LOCALES: string[]) {
const voxaSheetsIntent = filterSheets(voxaSheets, [SheetTypes.INTENT]);
const voxaSheetsUtter = _.reduce(
filterSheets(voxaSheets, [SheetTypes.UTTERANCE]),
File Processor.ts
has 396 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
* Copyright (c) 2018 Rain Agency <contact@rain.agency>
* Author: Rain Agency <contact@rain.agency>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
Function action
has 137 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function action() {
const interactionFile = path.join(process.cwd(), "interaction.json");
let hasAnInteractionFile = false;
try {
// a path we KNOW is totally bogus and not a module
Function result
has 132 lines of code (exceeds 25 allowed). Consider refactoring. Open
.map((voxaSheetIntent: IVoxaSheet) => {
const locale = sheetLocale(voxaSheetIntent, AVAILABLE_LOCALES);
let previousIntent: string;
voxaSheetIntent.data = _.chain(voxaSheetIntent.data)
.map(row => {
File Schema.ts
has 326 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
* Copyright (c) 2018 Rain Agency <contact@rain.agency>
* Author: Rain Agency <contact@rain.agency>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
Function observe
has 92 lines of code (exceeds 25 allowed). Consider refactoring. Open
const observe = Observable.create((obs: any) => {
const override = (answers: any) => {
return answers.interactionFile;
};
const onlyCommaAnswer = (input: string) => {
File DialogflowSchema.ts
has 313 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
* Copyright (c) 2018 Rain Agency <contact@rain.agency>
* Author: Rain Agency <contact@rain.agency>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
Function action
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
export async function action() {
const interactionFile = path.join(process.cwd(), "interaction.json");
let hasAnInteractionFile = false;
try {
// a path we KNOW is totally bogus and not a module
- 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 buildViewsMapping
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
public buildViewsMapping(): void {
function pathsFinder(object: any, prefixes: string[] = []) {
let paths: string[] = [];
let value: any;
if (typeof object === "object") {
Function buildIntent
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
public buildIntent(locale: string, environment: string) {
const intentsByPlatformAndEnvironments = this.intentsByPlatformAndEnvironments(
locale,
environment
);
Function buildUtterances
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
public buildUtterances(locale: string, environment: string) {
const intentsByPlatformAndEnvironments = this.intentsByPlatformAndEnvironments(
locale,
environment
);
Function viewsProcessor
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function viewsProcessor(voxaSheets: IVoxaSheet[], AVAILABLE_LOCALES: string[]) {
function sanitizeView(text: string = "") {
return text
.replace(/’/g, "'")
.replace(/’/g, "'")
Function builtIntents
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.builtIntents = intentsByPlatformAndEnvironments.map((rawIntent: IIntent) => {
let { name, events } = rawIntent;
const { parameterName, parameterValue } = rawIntent;
const { webhookForSlotFilling, slotsDefinition, responses, webhookUsed } = rawIntent;
name = name.replace("AMAZON.", "");
Function buildInteraction
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const buildInteraction = async (interactionOptions: IInteractionOptions, authKeys: any) => {
const definedInteractionOptions = defaultOptions(interactionOptions);
console.time("all");
console.time("timeframe");
Function defaultOptions
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
function defaultOptions(interactionOptions: IInteractionOptions): IDefinedInteractionOptions {
const rootPath: string = interactionOptions.rootPath || "";
const speechPath: string =
interactionOptions.speechPath || DEFAULT_INTERACTION_OPTIONS.speechPath;
const synonymPath: string =
Function buildAgent
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
public buildAgent(locale: string, environment: string) {
const intents = this.builtIntents;
const invocation = _.find(this.invocations, { locale, environment });
const invocationName = _.get(invocation, "name", "Skill with no name");
const intentsByPlatformAndEnvironments = this.intentsByPlatformAndEnvironments(
Function buildViewsMapping
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public buildViewsMapping(): void {
function pathsFinder(object: any, prefixes: string[] = []) {
let paths: string[] = [];
let value: any;
if (typeof object === "object") {
- 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 publishingProcessor
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function publishingProcessor(voxaSheets: IVoxaSheet[], AVAILABLE_LOCALES: string[]) {
const voxaSheetsPublishing = voxaSheets.filter(voxaSheet =>
_.includes(
[
SheetTypes.SKILL_ENVIRONMENTS,
Function buildIntent
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public buildIntent(locale: string, environment: string) {
const intentsByPlatformAndEnvironments = this.intentsByPlatformAndEnvironments(
locale,
environment
);
- 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 mergeManifest
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public mergeManifest(environment: string): any {
const manifest = {};
const NAMESPACE = this.NAMESPACE;
this.publishing
.filter(item => _.isEmpty(item.environments) && item.key.includes(this.NAMESPACE))