public-js/ng-openapi-gen

View on GitHub

Showing 168 of 293 total issues

Function tsTypeVal has a Cognitive Complexity of 63 (exceeds 5 allowed). Consider refactoring.
Open

export function tsTypeVal(
    schemaOrRef: SchemaObject | ReferenceObject | undefined,
    openApi: OpenAPIObject,
    options: Options,
    imports?: Map<string, OaImport>,
Severity: Minor
Found in packages/ng-openapi-gen/src/lib/utils/open-api.ts - About 1 day 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 addTypeDef has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
Open

    private addTypeDef(propSchema: JSONSchema7) {
        if (this.prop.type === 'array') {
            propSchema.type = this.prop.type;
            propSchema.items = { type: this.prop.arrayOf };
        } else if (this.prop.type === 'enum') {
Severity: Minor
Found in tools/executors/schema-generator/types/prop-for-json.ts - About 6 hrs 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 append has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
Open

  append(params: HttpParams): HttpParams {
    if (this.value instanceof Array) {
      // Array serialization
      if (this.options.explode) {
        for (const v of this.value) {

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

  append(params: HttpParams): HttpParams {
    if (this.value instanceof Array) {
      // Array serialization
      if (this.options.explode) {
        for (const v of this.value) {

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

  append(params: HttpParams): HttpParams {
    if (this.value instanceof Array) {
      // Array serialization
      if (this.options.explode) {
        for (const v of this.value) {

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

  append(params: HttpParams): HttpParams {
    if (this.value instanceof Array) {
      // Array serialization
      if (this.options.explode) {
        for (const v of this.value) {

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

  append(params: HttpParams): HttpParams {
    if (this.value instanceof Array) {
      // Array serialization
      if (this.options.explode) {
        for (const v of this.value) {

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

  append(params: HttpParams): HttpParams {
    if (this.value instanceof Array) {
      // Array serialization
      if (this.options.explode) {
        for (const v of this.value) {

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

  append(params: HttpParams): HttpParams {
    if (this.value instanceof Array) {
      // Array serialization
      if (this.options.explode) {
        for (const v of this.value) {

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

  append(params: HttpParams): HttpParams {
    if (this.value instanceof Array) {
      // Array serialization
      if (this.options.explode) {
        for (const v of this.value) {

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

    private getTypeDef(name: string, prop: Property) {
        let typeValue;
        if (prop.type === 'array') {
            typeValue = `${prop.arrayOf}[]`;
        } else if (prop.type === 'enum') {
Severity: Minor
Found in tools/executors/schema-generator/types/prop-for-model.ts - About 4 hrs 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 collectOperations has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

    protected collectOperations(): void {
        for (const [opPath, pathSpec] of Object.entries(this.openApi.paths)) {
            for (const method of HTTP_METHODS) {
                const methodSpec: OperationObject | undefined = pathSpec[method];
                if (!methodSpec) {
Severity: Minor
Found in packages/ng-openapi-gen/src/lib/generator.ts - About 3 hrs 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 createImports has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

    protected createImports(
        schema: SchemaObject | ReferenceObject | undefined,
        imports: Map<string, OaImport>,
        additional = false,
        processOneOf = false,
Severity: Minor
Found in packages/ng-openapi-gen/src/lib/oa-base.ts - About 3 hrs 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 tsTypeVal has 85 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function tsTypeVal(
    schemaOrRef: SchemaObject | ReferenceObject | undefined,
    openApi: OpenAPIObject,
    options: Options,
    imports?: Map<string, OaImport>,
Severity: Major
Found in packages/ng-openapi-gen/src/lib/utils/open-api.ts - About 3 hrs to fix

    File no-tag.service.ts has 308 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /* tslint:disable */
    /* eslint-disable */
    
    /**
     * This file was generated automatically from API specification.

      Function syncDirs has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

      export function syncDirs(srcDir: string, destDir: string, removeStale: boolean, verbose: boolean): void {
          fse.ensureDirSync(destDir);
      
          const srcFiles = readdirSync(srcDir);
          for (const file of srcFiles) {
      Severity: Minor
      Found in packages/ng-openapi-gen/src/lib/utils/file-system.ts - About 3 hrs 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

      NoTagService has 25 functions (exceeds 20 allowed). Consider refactoring.
      Open

      @Injectable()
      export class NoTagService {
        constructor(
          @Inject(API_ROOT_URL_TOKEN) private rootUrl: string,
          @Inject(HttpClient) private http: HttpClient,

        File request-builder.ts has 282 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        /* tslint:disable */
        /* eslint-disable */
        
        /**
         * This file was generated automatically from API specification.

          File request-builder.ts has 282 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          /* tslint:disable */
          /* eslint-disable */
          
          /**
           * This file was generated automatically from API specification.

            File request-builder.ts has 282 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            /* tslint:disable */
            /* eslint-disable */
            
            /**
             * This file was generated automatically from API specification.
              Severity
              Category
              Status
              Source
              Language