ahmadnassri/httpsnippet

View on GitHub

Showing 282 of 282 total issues

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

export const okhttp: Client = {
  info: {
    key: 'okhttp',
    title: 'OkHttp',
    link: 'http://square.github.io/okhttp/',
Severity: Major
Found in src/targets/java/okhttp/client.ts and 1 other location - About 3 days to fix
src/targets/kotlin/okhttp/client.ts on lines 15..76

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 580.

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 okhttp: Client = {
  info: {
    key: 'okhttp',
    title: 'OkHttp',
    link: 'http://square.github.io/okhttp/',
Severity: Major
Found in src/targets/kotlin/okhttp/client.ts and 1 other location - About 3 days to fix
src/targets/java/okhttp/client.ts on lines 15..75

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 580.

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

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

  convert: ({ queryObj, url, postData, allHeaders, method }, options) => {
    const opts = {
      indent: '    ',
      pretty: true,
      ...options,
Severity: Minor
Found in src/targets/python/requests/client.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

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

runCustomFixtures({
  targetId: 'objc',
  clientId: 'nsurlsession',
  tests: [
    {
Severity: Major
Found in src/targets/objc/nsurlsession/client.test.ts and 1 other location - About 6 hrs to fix
src/targets/swift/nsurlsession/client.test.ts on lines 7..44

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 164.

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

runCustomFixtures({
  targetId: 'swift',
  clientId: 'nsurlsession',
  tests: [
    {
Severity: Major
Found in src/targets/swift/nsurlsession/client.test.ts and 1 other location - About 6 hrs to fix
src/targets/objc/nsurlsession/client.test.ts on lines 7..36

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 164.

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

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

  convert: ({ fullUrl, method, httpVersion, headersObj, allHeaders, postData }, options = {}) => {
    const {
      binary = false,
      globOff = false,
      indent = '  ',
Severity: Minor
Found in src/targets/shell/curl/client.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 convert has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

  convert: ({ allHeaders, postData, queryObj, fullUrl, method, url }, options) => {
    const opts = {
      body: false,
      cert: false,
      headers: false,
Severity: Minor
Found in src/targets/shell/httpie/client.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 convert has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

  convert: ({ postData, fullUrl, method, cookies, headersObj }, options) => {
    const opts = {
      closingTag: false,
      indent: '  ',
      noTags: false,
Severity: Minor
Found in src/targets/php/guzzle/client.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

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

<?php

$curl = curl_init();

curl_setopt_array($curl, [
Severity: Major
Found in src/targets/php/curl/fixtures/multipart-file.php and 5 other locations - About 4 hrs to fix
src/targets/php/curl/fixtures/application-form-encoded.php on lines 1..28
src/targets/php/curl/fixtures/multipart-data.php on lines 1..28
src/targets/php/curl/fixtures/multipart-form-data-no-params.php on lines 1..28
src/targets/php/curl/fixtures/multipart-form-data.php on lines 1..28
src/targets/php/curl/fixtures/text-plain.php on lines 1..28

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 164.

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 6 locations. Consider refactoring.
Open

<?php

$curl = curl_init();

curl_setopt_array($curl, [
Severity: Major
Found in src/targets/php/curl/fixtures/application-form-encoded.php and 5 other locations - About 4 hrs to fix
src/targets/php/curl/fixtures/multipart-data.php on lines 1..28
src/targets/php/curl/fixtures/multipart-file.php on lines 1..28
src/targets/php/curl/fixtures/multipart-form-data-no-params.php on lines 1..28
src/targets/php/curl/fixtures/multipart-form-data.php on lines 1..28
src/targets/php/curl/fixtures/text-plain.php on lines 1..28

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 164.

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 6 locations. Consider refactoring.
Open

<?php

$curl = curl_init();

curl_setopt_array($curl, [
Severity: Major
Found in src/targets/php/curl/fixtures/multipart-data.php and 5 other locations - About 4 hrs to fix
src/targets/php/curl/fixtures/application-form-encoded.php on lines 1..28
src/targets/php/curl/fixtures/multipart-file.php on lines 1..28
src/targets/php/curl/fixtures/multipart-form-data-no-params.php on lines 1..28
src/targets/php/curl/fixtures/multipart-form-data.php on lines 1..28
src/targets/php/curl/fixtures/text-plain.php on lines 1..28

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 164.

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 6 locations. Consider refactoring.
Open

<?php

$curl = curl_init();

curl_setopt_array($curl, [
src/targets/php/curl/fixtures/application-form-encoded.php on lines 1..28
src/targets/php/curl/fixtures/multipart-data.php on lines 1..28
src/targets/php/curl/fixtures/multipart-file.php on lines 1..28
src/targets/php/curl/fixtures/multipart-form-data.php on lines 1..28
src/targets/php/curl/fixtures/text-plain.php on lines 1..28

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 164.

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 6 locations. Consider refactoring.
Open

<?php

$curl = curl_init();

curl_setopt_array($curl, [
Severity: Major
Found in src/targets/php/curl/fixtures/text-plain.php and 5 other locations - About 4 hrs to fix
src/targets/php/curl/fixtures/application-form-encoded.php on lines 1..28
src/targets/php/curl/fixtures/multipart-data.php on lines 1..28
src/targets/php/curl/fixtures/multipart-file.php on lines 1..28
src/targets/php/curl/fixtures/multipart-form-data-no-params.php on lines 1..28
src/targets/php/curl/fixtures/multipart-form-data.php on lines 1..28

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 164.

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 6 locations. Consider refactoring.
Open

<?php

$curl = curl_init();

curl_setopt_array($curl, [
Severity: Major
Found in src/targets/php/curl/fixtures/multipart-form-data.php and 5 other locations - About 4 hrs to fix
src/targets/php/curl/fixtures/application-form-encoded.php on lines 1..28
src/targets/php/curl/fixtures/multipart-data.php on lines 1..28
src/targets/php/curl/fixtures/multipart-file.php on lines 1..28
src/targets/php/curl/fixtures/multipart-form-data-no-params.php on lines 1..28
src/targets/php/curl/fixtures/text-plain.php on lines 1..28

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 164.

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 add headersObj to source object case insensitive when HTTP/1.0', () => {
        const snippet = new HTTPSnippet({
          ...headers,
          httpVersion: 'HTTP/1.1',
          headers: [
Severity: Major
Found in src/httpsnippet.test.ts and 1 other location - About 3 hrs to fix
src/httpsnippet.test.ts on lines 179..199

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 114.

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 add headersObj to source object lowercased when HTTP/2.x', () => {
        const snippet = new HTTPSnippet({
          ...headers,
          httpVersion: 'HTTP/2',
          headers: [
Severity: Major
Found in src/httpsnippet.test.ts and 1 other location - About 3 hrs to fix
src/httpsnippet.test.ts on lines 157..177

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 114.

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

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

  convert: ({ postData, headersObj, method, queryObj, cookiesObj, url }, options = {}) => {
    const { closingTag = false, indent = '  ', noTags = false, shortTags = false } = options;

    const { push, blank, join } = new CodeBuilder({ indent });
    let hasBody = false;
Severity: Minor
Found in src/targets/php/http2/client.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 convert has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

  convert: ({ postData, method, allHeaders, fullUrl }, options = {}) => {
    const { blank, push, join } = new CodeBuilder({ indent: '\t' });

    const {
      showBoilerplate = true,
Severity: Minor
Found in src/targets/go/native/client.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

Identical blocks of code found in 18 locations. Consider refactoring.
Open

const req = http.request(options, function (res) {
  const chunks = [];

  res.on('data', function (chunk) {
    chunks.push(chunk);
Severity: Major
Found in src/targets/node/native/fixtures/jsonObj-null-value.js and 17 other locations - About 3 hrs to fix
src/targets/node/native/fixtures/application-form-encoded.js on lines 14..25
src/targets/node/native/fixtures/application-json.js on lines 13..24
src/targets/node/native/fixtures/cookies.js on lines 13..24
src/targets/node/native/fixtures/custom-method.js on lines 11..22
src/targets/node/native/fixtures/full.js on lines 16..27
src/targets/node/native/fixtures/headers.js on lines 15..26
src/targets/node/native/fixtures/https.js on lines 11..22
src/targets/node/native/fixtures/insecure-skip-verify.js on lines 12..23
src/targets/node/native/fixtures/jsonObj-multiline.js on lines 13..24
src/targets/node/native/fixtures/multipart-data.js on lines 13..24
src/targets/node/native/fixtures/multipart-file.js on lines 13..24
src/targets/node/native/fixtures/multipart-form-data-no-params.js on lines 13..24
src/targets/node/native/fixtures/multipart-form-data.js on lines 13..24
src/targets/node/native/fixtures/nested.js on lines 11..22
src/targets/node/native/fixtures/query.js on lines 11..22
src/targets/node/native/fixtures/short.js on lines 11..22
src/targets/node/native/fixtures/text-plain.js on lines 13..24

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 109.

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

Identical blocks of code found in 18 locations. Consider refactoring.
Open

const req = http.request(options, function (res) {
  const chunks = [];

  res.on('data', function (chunk) {
    chunks.push(chunk);
Severity: Major
Found in src/targets/node/native/fixtures/custom-method.js and 17 other locations - About 3 hrs to fix
src/targets/node/native/fixtures/application-form-encoded.js on lines 14..25
src/targets/node/native/fixtures/application-json.js on lines 13..24
src/targets/node/native/fixtures/cookies.js on lines 13..24
src/targets/node/native/fixtures/full.js on lines 16..27
src/targets/node/native/fixtures/headers.js on lines 15..26
src/targets/node/native/fixtures/https.js on lines 11..22
src/targets/node/native/fixtures/insecure-skip-verify.js on lines 12..23
src/targets/node/native/fixtures/jsonObj-multiline.js on lines 13..24
src/targets/node/native/fixtures/jsonObj-null-value.js on lines 13..24
src/targets/node/native/fixtures/multipart-data.js on lines 13..24
src/targets/node/native/fixtures/multipart-file.js on lines 13..24
src/targets/node/native/fixtures/multipart-form-data-no-params.js on lines 13..24
src/targets/node/native/fixtures/multipart-form-data.js on lines 13..24
src/targets/node/native/fixtures/nested.js on lines 11..22
src/targets/node/native/fixtures/query.js on lines 11..22
src/targets/node/native/fixtures/short.js on lines 11..22
src/targets/node/native/fixtures/text-plain.js on lines 13..24

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 109.

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