Mashape/httpsnippet

View on GitHub

Showing 52 of 282 total issues

Function convert has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

  convert: ({ method, url, cookies, queryObj, postData, headersObj }, options) => {
    const opts = {
      indent: '  ',
      ...options,
    };
Severity: Minor
Found in src/targets/node/unirest/client.ts - About 1 hr 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 convert has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

  convert: ({ postData, method, fullUrl, allHeaders }, options) => {
    const opts = {
      indent: '  ',
      ...options,
    };
Severity: Minor
Found in src/targets/java/okhttp/client.ts - About 1 hr 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 literalRepresentation has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

export const literalRepresentation = <T, U>(
  value: T,
  opts: U,
  indentLevel?: number,
): number | string => {
Severity: Minor
Found in src/targets/swift/helpers.ts - About 1 hr 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 convert has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

  convert: (
    { uriObj, postData, fullUrl, method, httpVersion, cookies, headersObj },
    options = {},
  ) => {
    const {
Severity: Minor
Found in src/targets/php/curl/client.ts - About 1 hr 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 literalRepresentation has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const literalRepresentation = (
  value: any,
  opts: Record<string, any>,
  indentLevel?: number,
): any => {
Severity: Minor
Found in src/targets/python/helpers.ts - About 1 hr to fix

Function escapeString has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function escapeString(rawValue: any, options: EscapeOptions = {}) {
  const {
    delimiter = '"',
    escapeChar = '\\',
    escapeNewlines = true
Severity: Minor
Found in src/helpers/escape.ts - About 1 hr to fix

Function literalRepresentation has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const literalRepresentation = <T, U>(
  value: T,
  opts: U,
  indentLevel?: number,
): number | string => {
Severity: Minor
Found in src/targets/swift/helpers.ts - About 1 hr to fix

Function convertType has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

export const convertType = (obj: any[] | any, indent?: string, lastIndent?: string) => {
  lastIndent = lastIndent || '';
  indent = indent || '';

  switch (Object.prototype.toString.call(obj)) {
Severity: Minor
Found in src/targets/php/helpers.ts - About 1 hr 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 convert has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  convert: ({ allHeaders, method, url, queryObj, postData }, options) => {
    const opts = {
      indent: '  ',
      ...options,
    };
Severity: Minor
Found in src/targets/javascript/axios/client.ts - About 1 hr 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 convert has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  convert: ({ method, url, queryObj, postData, headersObj, cookies }, options) => {
    const opts = {
      indent: '  ',
      ...options,
    };
Severity: Minor
Found in src/targets/node/request/client.ts - About 1 hr 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 literalRepresentation has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

export const literalRepresentation = (value: any, indentation?: number): string => {
  const join = indentation === undefined ? ', ' : `,\n   ${' '.repeat(indentation)}`;

  switch (Object.prototype.toString.call(value)) {
    case '[object Number]':
Severity: Minor
Found in src/targets/objc/helpers.ts - About 1 hr 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 convertType has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const convertType = (obj: any[] | any, indent?: string, lastIndent?: string) => {
  lastIndent = lastIndent || '';
  indent = indent || '';

  switch (Object.prototype.toString.call(obj)) {
Severity: Minor
Found in src/targets/php/helpers.ts - About 1 hr to fix

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

const jsToEdn = (js: any) => {
  switch (jsType(js)) {
    case 'string':
      return `"${js.replace(/"/g, '\\"')}"`;

Severity: Minor
Found in src/targets/clojure/clj_http/client.ts - About 1 hr to fix

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

      builder => {
        builder
          .option('target', {
            alias: 't',
            type: 'string',
Severity: Minor
Found in src/cli.ts - About 1 hr to fix

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

  constructor(input: HarEntry | HarRequest) {
    let entries: Entry[] = [];

    // prep the main container
    this.requests = [];
Severity: Minor
Found in src/httpsnippet.ts - About 1 hr to fix

Function convert has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  convert: ({ method, url, queryObj, allHeaders, postData }, options) => {
    const opts = {
      indent: '  ',
      ...options,
    };
Severity: Minor
Found in src/targets/node/axios/client.ts - About 55 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 convert has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  convert: ({ method, postData, allHeaders, fullUrl }, options) => {
    const opts = {
      indent: '  ',
      short: false,
      verbose: false,
Severity: Minor
Found in src/targets/shell/wget/client.ts - About 55 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

Avoid deeply nested control flow statements.
Open

              if (headerName) {
                delete headersObj[headerName];
              }
Severity: Major
Found in src/targets/php/guzzle/client.ts - About 45 mins to fix

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

  convert: ({ uriObj, method, allHeaders, postData }, options = {}) => {
    const { indent = '  ', insecureSkipVerify = false } = options;
    const { blank, join, push, unshift } = new CodeBuilder({ indent });

    const reqOpts = {
Severity: Minor
Found in src/targets/node/native/client.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 generatePowershellConvert has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

export const generatePowershellConvert = (command: PowershellCommand) => {
  const convert: Converter<any> = ({
    method,
    headersObj,
    cookies,
Severity: Minor
Found in src/targets/powershell/common.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

Severity
Category
Status
Source
Language