pharindoko/json-serverless

View on GitHub

Showing 27 of 84 total issues

Function task has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        task: async (task) => {
          if (process.env.NODE_ENV === 'local') {
            Helpers.removeDir(stackFolder + '/node_modules');
            await fs.copy(
              templateFolder + '/node_modules',
Severity: Minor
Found in packages/cli/src/commands/update-stack.ts - About 1 hr to fix

    Function validate has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      validate(): RuleEvent[] {
        try {
          if (
            this.jsonObject &&
            typeof this.jsonObject === 'object' &&
    Severity: Minor
    Found in packages/server/src/validations/validationrule.ts - About 1 hr to fix

      Function callBackend has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              callBackend: async args => {
                const graphqlRequest = args.context['req'];
                const httpProtocol = graphqlRequest
                  .get('host')
                  .startsWith('localhost')
      Severity: Minor
      Found in packages/server/src/app/core.app.ts - About 1 hr to fix

        Function convertNumber has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          private convertNumber(num: number) {
            /*
              Append to 'this.outSwagger' string with Swagger schema attributes relative to given number
              Global variables updated:
              -this.outSwagger
        Severity: Minor
        Found in packages/server/src/specifications/swagger/swagger.defgen.ts - About 45 mins to fix

        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 validate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          static validate(json: {}, specificationDependent: boolean): ValidationResult {
            const validationResult = new ValidationResult();
            const rules = new Array<ValidationRule>();
            rules.push(new IsObjectRule(json));
            rules.push(new HasObjectKeyRule(json));
        Severity: Minor
        Found in packages/server/src/validations/json.validator.ts - About 35 mins to fix

        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 constructor has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          constructor(server: express.Express, apiKey: string) {
            this.server = server;
            this.apiKey = apiKey;
            this.authenticationMiddleware = (whiteList: string[]) => async (
              req,
        Severity: Minor
        Found in packages/server/src/auth/apikey.strategy.ts - About 25 mins to fix

        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 conversorSelection has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          private conversorSelection(obj) {
            this.changeIndentation(this.tabCount + 1);
            if (typeof obj === 'number') {
              // attribute is a number
              this.convertNumber(obj);
        Severity: Minor
        Found in packages/server/src/specifications/swagger/swagger.defgen.ts - About 25 mins to fix

        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

        Severity
        Category
        Status
        Source
        Language