ask-utils/ask-utils

View on GitHub

Showing 218 of 218 total issues

Function render has 500 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    render(isNormalMode) {
        let tp = lithtml.html(`
        <nav>
            <ul class="list">
                <li class="title">
Severity: Major
Found in docs/js/menu-wc.js - About 2 days to fix

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

                it('should return true when match state', async () => {
                    type State = 'start' | 'step1' | 'help'
                    const requestHandler = RequestHandlerFactory.create<State>({
                        requestType: 'IntentRequest',
                        intentName: 'HelloIntent',
    packages/router/__tests__/libs/requestHandlers/createRequestHandler.test.ts on lines 121..154

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 227.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

                it('should return true when match state', async () => {
                    type State = 'start' | 'step1' | 'help'
                    const requestHandler = RequestHandlerFactory.create<State>({
                        requestType: 'IntentRequest',
                        intentName: 'HelloIntent',
    packages/router/__tests__/libs/requestHandlers/createRequestHandler.test.ts on lines 86..119

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 227.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        describe('isNumber()', () => {
            it('should return false when given null', () => {
                expect(isNumber(null)).toEqual(false)
            })
            it('should return false when given undefined', () => {
    packages/proactive-event/__tests__/libs/helpers/typeGuards.test.ts on lines 62..81

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 206.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        describe('isString()', () => {
            it('should return false when given null', () => {
                expect(isString(null)).toEqual(false)
            })
            it('should return false when given undefined', () => {
    packages/proactive-event/__tests__/libs/helpers/typeGuards.test.ts on lines 42..61

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 206.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    File menu-wc.js has 512 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    'use strict';
    
    
    customElements.define('compodoc-menu', class extends HTMLElement {
        constructor() {
    Severity: Major
    Found in docs/js/menu-wc.js - About 1 day to fix

      File createRequestHandler.test.ts has 499 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /* eslint-disable @typescript-eslint/explicit-function-return-type */
      import {
          CustomSkillFactory
      } from 'ask-sdk-core'
      import {

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

                each(['error', 'fatal']).it('Should record the %d log', (type: keyof TsLogger) => {
                    (logger as any)[type]('test')
                    const logData = JSON.parse(stdErr[0])
                    expect(logData.argumentsArray).toEqual(['test'])
                    expect(logData.instanceName).toEqual(requestEnvelope.request.type)
        Severity: Major
        Found in packages/labo/libs/Logger/__tests__/Logger.spec.ts and 1 other location - About 6 hrs to fix
        packages/labo/libs/Logger/__tests__/Logger.spec.ts on lines 45..53

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 172.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

                each(['silly', 'info', 'debug', 'trace']).it('Should record the %d log', (type: keyof TsLogger) => {
                    (logger as any)[type]('test')
                    const logData = JSON.parse(stdOut[0])
                    expect(logData.argumentsArray).toEqual(['test'])
                    expect(logData.instanceName).toEqual(requestEnvelope.request.type)
        Severity: Major
        Found in packages/labo/libs/Logger/__tests__/Logger.spec.ts and 1 other location - About 6 hrs to fix
        packages/labo/libs/Logger/__tests__/Logger.spec.ts on lines 54..62

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 172.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            describe('getWeatherAlert', () => {
                execGenericTests(getWeatherAlert)
                it('should return valid props when given valid object', () => {
                    const param = getWeatherAlert({
                        alertType: 'TORNADO',
        packages/proactive-event/__tests__/libs/helpers/index.test.ts on lines 123..145

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 142.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            describe('getMessageState', () => {
                execGenericTests(getMessageState)
                it('should return valid props when given valid object', () => {
                    const param = getMessageState({
                        status: 'UNREAD',
        packages/proactive-event/__tests__/libs/helpers/index.test.ts on lines 63..85

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 142.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            describe('isCreativeWork()', () => {
                execGenericTests(isCreativeWork)
                it('should return false when given object', () => {
                    expect(isCreativeWork({
                        name: 'hello'
        packages/proactive-event/__tests__/libs/helpers/typeGuards.test.ts on lines 115..133

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 139.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            describe('isAvailability()', () => {
                execGenericTests(isAvailability)
                it('should return false when given object', () => {
                    expect(isAvailability({
                        startTime: 'hello'
        packages/proactive-event/__tests__/libs/helpers/typeGuards.test.ts on lines 96..114

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 139.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        File model.ts has 379 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        /* eslint-disable import/export */
        
        export namespace Types {
            export type Locale = 'de-DE' | 'en-AU' | 'en-CA' | 'en-GB' | 'en-IN' | 'en-US' | 'es-ES' | 'es-MX' | 'fr-CA' | 'fr-FR' | 'it-IT' | 'ja-JP'
            export type dateTime = string
        Severity: Minor
        Found in packages/proactive-event/libs/model.ts - About 5 hrs to fix

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                      it('should return false when given unmatch intent request', async () => {
                          const handlerInput = createIntentRequestHandlerInput({
                              name: 'HelloIntent',
                              confirmationStatus: 'NONE'
                          })
          Severity: Major
          Found in packages/router/__tests__/libs/matcher/RouteMatcher.test.ts and 1 other location - About 4 hrs to fix
          packages/router/__tests__/libs/matcher/RouteMatcher.test.ts on lines 42..55

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 128.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                      it('should return true when given match intent request', async () => {
                          const handlerInput = createIntentRequestHandlerInput({
                              name: 'HelloIntent',
                              confirmationStatus: 'NONE'
                          })
          Severity: Major
          Found in packages/router/__tests__/libs/matcher/RouteMatcher.test.ts and 1 other location - About 4 hrs to fix
          packages/router/__tests__/libs/matcher/RouteMatcher.test.ts on lines 56..69

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 128.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                      it('should return false when given un-match intent request', async () => {
                          const handlerInput = createIntentRequestHandlerInput({
                              name: 'ByeIntent',
                              confirmationStatus: 'NONE'
                          })
          Severity: Major
          Found in packages/router/__tests__/libs/matcher/RouteMatcher.test.ts and 1 other location - About 4 hrs to fix
          packages/router/__tests__/libs/matcher/RouteMatcher.test.ts on lines 12..25

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 125.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                      it('should return true when given match intent request', async () => {
                          const handlerInput = createIntentRequestHandlerInput({
                              name: 'HelloIntent',
                              confirmationStatus: 'NONE'
                          })
          Severity: Major
          Found in packages/router/__tests__/libs/matcher/RouteMatcher.test.ts and 1 other location - About 4 hrs to fix
          packages/router/__tests__/libs/matcher/RouteMatcher.test.ts on lines 26..39

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 125.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

          export const getAvailability = (obj: any): Types.Availability => {
              if (isAvailability(obj)) {
                  const { method, startTime, provider } = obj
                  const newProps: Types.Availability = { method, startTime }
                  if (provider) newProps.provider = provider
          Severity: Major
          Found in packages/proactive-event/libs/helpers/index.ts and 1 other location - About 4 hrs to fix
          packages/proactive-event/libs/helpers/index.ts on lines 58..66

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 121.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

          export const getMessageGroup = (obj: any): Types.MessageGroup => {
              if (isMessageGroup(obj)) {
                  const { creator, count, urgency } = obj
                  const newProps: Types.MessageGroup = { creator, count }
                  if (urgency) newProps.urgency = urgency
          Severity: Major
          Found in packages/proactive-event/libs/helpers/index.ts and 1 other location - About 4 hrs to fix
          packages/proactive-event/libs/helpers/index.ts on lines 25..33

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 121.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Severity
          Category
          Status
          Source
          Language