ahmadnassri/httpsnippet

View on GitHub

Showing 282 of 282 total issues

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

Severity: Major
Found in src/targets/python/python3/fixtures/jsonObj-null-value.py and 8 other locations - About 3 hrs to fix
src/targets/python/python3/fixtures/application-form-encoded.py on lines 0..14
src/targets/python/python3/fixtures/application-json.py on lines 0..14
src/targets/python/python3/fixtures/jsonObj-multiline.py on lines 0..14
src/targets/python/python3/fixtures/multipart-data.py on lines 0..14
src/targets/python/python3/fixtures/multipart-file.py on lines 0..14
src/targets/python/python3/fixtures/multipart-form-data-no-params.py on lines 0..14
src/targets/python/python3/fixtures/multipart-form-data.py on lines 0..14
src/targets/python/python3/fixtures/text-plain.py on lines 0..14

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

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

Severity: Major
Found in src/targets/python/python3/fixtures/jsonObj-multiline.py and 8 other locations - About 3 hrs to fix
src/targets/python/python3/fixtures/application-form-encoded.py on lines 0..14
src/targets/python/python3/fixtures/application-json.py on lines 0..14
src/targets/python/python3/fixtures/jsonObj-null-value.py on lines 0..14
src/targets/python/python3/fixtures/multipart-data.py on lines 0..14
src/targets/python/python3/fixtures/multipart-file.py on lines 0..14
src/targets/python/python3/fixtures/multipart-form-data-no-params.py on lines 0..14
src/targets/python/python3/fixtures/multipart-form-data.py on lines 0..14
src/targets/python/python3/fixtures/text-plain.py on lines 0..14

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

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

Severity: Major
Found in src/targets/python/python3/fixtures/application-json.py and 8 other locations - About 3 hrs to fix
src/targets/python/python3/fixtures/application-form-encoded.py on lines 0..14
src/targets/python/python3/fixtures/jsonObj-multiline.py on lines 0..14
src/targets/python/python3/fixtures/jsonObj-null-value.py on lines 0..14
src/targets/python/python3/fixtures/multipart-data.py on lines 0..14
src/targets/python/python3/fixtures/multipart-file.py on lines 0..14
src/targets/python/python3/fixtures/multipart-form-data-no-params.py on lines 0..14
src/targets/python/python3/fixtures/multipart-form-data.py on lines 0..14
src/targets/python/python3/fixtures/text-plain.py on lines 0..14

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

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

Severity: Major
Found in src/targets/python/python3/fixtures/multipart-data.py and 8 other locations - About 3 hrs to fix
src/targets/python/python3/fixtures/application-form-encoded.py on lines 0..14
src/targets/python/python3/fixtures/application-json.py on lines 0..14
src/targets/python/python3/fixtures/jsonObj-multiline.py on lines 0..14
src/targets/python/python3/fixtures/jsonObj-null-value.py on lines 0..14
src/targets/python/python3/fixtures/multipart-file.py on lines 0..14
src/targets/python/python3/fixtures/multipart-form-data-no-params.py on lines 0..14
src/targets/python/python3/fixtures/multipart-form-data.py on lines 0..14
src/targets/python/python3/fixtures/text-plain.py on lines 0..14

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

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

Severity: Major
Found in src/targets/python/python3/fixtures/multipart-file.py and 8 other locations - About 3 hrs to fix
src/targets/python/python3/fixtures/application-form-encoded.py on lines 0..14
src/targets/python/python3/fixtures/application-json.py on lines 0..14
src/targets/python/python3/fixtures/jsonObj-multiline.py on lines 0..14
src/targets/python/python3/fixtures/jsonObj-null-value.py on lines 0..14
src/targets/python/python3/fixtures/multipart-data.py on lines 0..14
src/targets/python/python3/fixtures/multipart-form-data-no-params.py on lines 0..14
src/targets/python/python3/fixtures/multipart-form-data.py on lines 0..14
src/targets/python/python3/fixtures/text-plain.py on lines 0..14

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

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('getHeader', () => {
    it('should get a header', () => {
      expect(getHeader(headers, 'content-type')).toBe(
        'multipart/form-data; boundary=---011000010111000001101001',
      );
Severity: Major
Found in src/helpers/headers.test.ts and 1 other location - About 3 hrs to fix
src/helpers/headers.test.ts on lines 22..29

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

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('getHeaderName', () => {
    it('should get a header name', () => {
      expect(getHeaderName(headers, 'content-type')).toBe('Content-Type');
      expect(getHeaderName(headers, 'content-TYPE')).toBe('Content-Type');
      expect(getHeaderName(headers, 'Accept')).toBe('accept');
Severity: Major
Found in src/helpers/headers.test.ts and 1 other location - About 3 hrs to fix
src/helpers/headers.test.ts on lines 9..20

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

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

import Foundation

let headers = ["cookie": "foo=bar; bar=baz", "accept": "application/json", "content-type": "application/x-www-form-urlencoded"]

let postData = NSMutableData(data: "foo=bar".data(using: String.Encoding.utf8)!)
Severity: Major
Found in src/targets/swift/nsurlsession/fixtures/pretty-option.swift and 1 other location - About 3 hrs to fix
src/targets/swift/nsurlsession/fixtures/full.swift 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 213.

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

import Foundation

let headers = [
  "cookie": "foo=bar; bar=baz",
  "accept": "application/json",
Severity: Major
Found in src/targets/swift/nsurlsession/fixtures/full.swift and 1 other location - About 3 hrs to fix
src/targets/swift/nsurlsession/fixtures/pretty-option.swift on lines 1..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 213.

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 23 (exceeds 5 allowed). Consider refactoring.
Open

  convert: ({ queryObj, method, postData, url, allHeaders }, options) => {
    const { push, join } = new CodeBuilder({ indent: options?.indent });
    const methods = ['get', 'post', 'put', 'delete', 'patch', 'head', 'options'];
    method = method.toLowerCase();

Severity: Minor
Found in src/targets/clojure/clj_http/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

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

<?php

$curl = curl_init();

curl_setopt_array($curl, [
Severity: Major
Found in src/targets/php/curl/fixtures/nested.php and 4 other locations - About 3 hrs to fix
src/targets/php/curl/fixtures/custom-method.php on lines 1..24
src/targets/php/curl/fixtures/https.php on lines 1..24
src/targets/php/curl/fixtures/query.php on lines 1..24
src/targets/php/curl/fixtures/short.php on lines 1..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 144.

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

<?php

$curl = curl_init();

curl_setopt_array($curl, [
Severity: Major
Found in src/targets/php/curl/fixtures/https.php and 4 other locations - About 3 hrs to fix
src/targets/php/curl/fixtures/custom-method.php on lines 1..24
src/targets/php/curl/fixtures/nested.php on lines 1..24
src/targets/php/curl/fixtures/query.php on lines 1..24
src/targets/php/curl/fixtures/short.php on lines 1..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 144.

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

<?php

$curl = curl_init();

curl_setopt_array($curl, [
Severity: Major
Found in src/targets/php/curl/fixtures/short.php and 4 other locations - About 3 hrs to fix
src/targets/php/curl/fixtures/custom-method.php on lines 1..24
src/targets/php/curl/fixtures/https.php on lines 1..24
src/targets/php/curl/fixtures/nested.php on lines 1..24
src/targets/php/curl/fixtures/query.php on lines 1..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 144.

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

<?php

$curl = curl_init();

curl_setopt_array($curl, [
Severity: Major
Found in src/targets/php/curl/fixtures/query.php and 4 other locations - About 3 hrs to fix
src/targets/php/curl/fixtures/custom-method.php on lines 1..24
src/targets/php/curl/fixtures/https.php on lines 1..24
src/targets/php/curl/fixtures/nested.php on lines 1..24
src/targets/php/curl/fixtures/short.php on lines 1..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 144.

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

<?php

$curl = curl_init();

curl_setopt_array($curl, [
Severity: Major
Found in src/targets/php/curl/fixtures/custom-method.php and 4 other locations - About 3 hrs to fix
src/targets/php/curl/fixtures/https.php on lines 1..24
src/targets/php/curl/fixtures/nested.php on lines 1..24
src/targets/php/curl/fixtures/query.php on lines 1..24
src/targets/php/curl/fixtures/short.php on lines 1..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 144.

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 22 (exceeds 5 allowed). Consider refactoring.
Open

  convert: ({ uriObj: { path, protocol, host }, postData, allHeaders, method }, options = {}) => {
    const { insecureSkipVerify = false } = options;

    const { push, blank, join } = new CodeBuilder();
    // Start Request
Severity: Minor
Found in src/targets/python/python3/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 19 (exceeds 5 allowed). Consider refactoring.
Open

  convert: ({ method, fullUrl, postData, headersObj, cookies }, options) => {
    const opts = {
      indent: '  ',
      ...options,
    };
Severity: Minor
Found in src/targets/node/fetch/client.ts - About 2 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

import Foundation

let headers = ["cookie": "foo=bar; bar=baz"]

let request = NSMutableURLRequest(url: NSURL(string: "http://mockbin.com/har")! as URL,
Severity: Major
Found in src/targets/swift/nsurlsession/fixtures/cookies.swift and 1 other location - About 2 hrs to fix
src/targets/swift/nsurlsession/fixtures/multipart-form-data-no-params.swift on lines 1..21

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

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

import Foundation

let headers = ["Content-Type": "multipart/form-data"]

let request = NSMutableURLRequest(url: NSURL(string: "http://mockbin.com/har")! as URL,
src/targets/swift/nsurlsession/fixtures/cookies.swift on lines 1..21

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

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

val client = OkHttpClient()

val mediaType = MediaType.parse("text/plain")
val body = RequestBody.create(mediaType, "Hello World")
val request = Request.Builder()
Severity: Major
Found in src/targets/kotlin/okhttp/fixtures/text-plain.kt and 1 other location - About 2 hrs to fix
src/targets/kotlin/okhttp/fixtures/application-form-encoded.kt on lines 1..11

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

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