fgiova/aws-signature

View on GitHub

Showing 4 of 4 total issues

Function getCanonicalPath has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

function getCanonicalPath({ path }: HttpRequest, isS3: boolean) {
    if (!isS3) {
        // Non-S3 services, we normalize the path and then double URI encode it.
        // Ref: "Remove Dot Segments" https://datatracker.ietf.org/doc/html/rfc3986#section-5.2.4
        const normalizedPathSegments = [];
Severity: Minor
Found in src/aws/createCanonicalRequest.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

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

export function getCanonicalHeaders (
    {headers}: HttpRequest,
    unsignableHeaders?: Set<string>,
    signableHeaders?: Set<string>
) {
Severity: Minor
Found in src/aws/getCanonicalHeaders.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 getPayloadHash has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export function getPayloadHash(
    { headers, body }: HttpRequest,
){
    for (const headerName of Object.keys(headers)) {
        if (headerName.toLowerCase() === SHA256_HEADER) {
Severity: Minor
Found in src/aws/getPayloadHash.ts - About 25 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function getCanonicalQuery has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export function getCanonicalQuery ({ query = {} }: HttpRequest) {
    const keys: Array<string> = [];
    const serialized: Record<string, string> = {};
    for (const key of Object.keys(query).sort()) {
        if (key.toLowerCase() === SIGNATURE_HEADER) {
Severity: Minor
Found in src/aws/getCanonicalQuery.ts - About 25 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Severity
Category
Status
Source
Language