XYOracleNetwork/plugins

View on GitHub

Showing 232 of 232 total issues

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

const config: XyTsupConfig = {
  compile: {
    browser: {},
    node: {},
    neutral: { src: true },
packages/payloadset/packages/blockchain/packages/ethereum/packages/gas/packages/etherchain/xy.config.ts on lines 2..8
packages/payloadset/packages/blockchain/packages/ethereum/packages/gas/packages/ethers/xy.config.ts on lines 2..8
packages/payloadset/packages/blockchain/packages/ethereum/packages/gas/packages/etherscan/xy.config.ts on lines 2..8
packages/payloadset/packages/blockchain/packages/ethereum/packages/gas/packages/gas/xy.config.ts on lines 2..8
packages/payloadset/packages/crypto/packages/market/packages/asset/xy.config.ts on lines 2..8
packages/payloadset/packages/crypto/packages/market/packages/coingecko/xy.config.ts on lines 2..8
packages/payloadset/packages/crypto/packages/market/packages/uniswap/xy.config.ts on lines 2..8
packages/payloadset/packages/crypto/packages/market/xy.config.ts on lines 2..8
packages/payloadset/packages/crypto/xy.config.ts on lines 2..8
packages/payloadset/packages/domain/xy.config.ts on lines 2..8
packages/payloadset/packages/elevation/xy.config.ts on lines 2..8
packages/payloadset/packages/evm/packages/abi/xy.config.ts on lines 2..8
packages/payloadset/packages/evm/packages/call/packages/token-uri/diviner/xy.config.ts on lines 2..8
packages/payloadset/packages/evm/packages/call/xy.config.ts on lines 2..8
packages/payloadset/packages/evm/packages/erc1822/xy.config.ts on lines 2..8
packages/payloadset/packages/evm/packages/erc1967/xy.config.ts on lines 2..8
packages/payloadset/packages/evm/packages/events/xy.config.ts on lines 2..8
packages/payloadset/packages/evm/packages/token-interface/packages/diviner/xy.config.ts on lines 2..8
packages/payloadset/packages/evm/xy.config.ts on lines 2..8
packages/payloadset/packages/file/xy.config.ts on lines 2..8
packages/payloadset/packages/id/xy.config.ts on lines 2..8
packages/payloadset/packages/image-thumbnail/packages/diviner/xy.config.ts on lines 2..8
packages/payloadset/packages/location-certainty/xy.config.ts on lines 2..8
packages/payloadset/packages/location/xy.config.ts on lines 2..8
packages/payloadset/packages/module-instance/xy.config.ts on lines 2..8
packages/payloadset/packages/payments/packages/providers/packages/rebilly/packages/authorization/packages/card/xy.config.ts on lines 2..8
packages/payloadset/packages/payments/xy.config.ts on lines 2..8
packages/payloadset/packages/pentair/xy.config.ts on lines 2..8
packages/payloadset/packages/schema/xy.config.ts on lines 2..8
packages/payloadset/packages/stock/packages/market/packages/tzero/xy.config.ts on lines 2..8
packages/payloadset/packages/system/xy.config.ts on lines 2..8
packages/payloadset/packages/url-safety/xy.config.ts on lines 2..8
packages/payloadset/packages/xml/xy.config.ts on lines 2..8

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

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

const config: XyTsupConfig = {
  compile: {
    browser: {},
    node: {},
    neutral: { src: true },
Severity: Major
Found in packages/payloadset/packages/crypto/xy.config.ts and 33 other locations - About 30 mins to fix
packages/payloadset/packages/blockchain/packages/ethereum/packages/gas/packages/etherchain/xy.config.ts on lines 2..8
packages/payloadset/packages/blockchain/packages/ethereum/packages/gas/packages/ethers/xy.config.ts on lines 2..8
packages/payloadset/packages/blockchain/packages/ethereum/packages/gas/packages/etherscan/xy.config.ts on lines 2..8
packages/payloadset/packages/blockchain/packages/ethereum/packages/gas/packages/gas/xy.config.ts on lines 2..8
packages/payloadset/packages/crypto/packages/market/packages/asset/xy.config.ts on lines 2..8
packages/payloadset/packages/crypto/packages/market/packages/coingecko/xy.config.ts on lines 2..8
packages/payloadset/packages/crypto/packages/market/packages/uniswap/xy.config.ts on lines 2..8
packages/payloadset/packages/crypto/packages/market/xy.config.ts on lines 2..8
packages/payloadset/packages/domain/xy.config.ts on lines 2..8
packages/payloadset/packages/elevation/xy.config.ts on lines 2..8
packages/payloadset/packages/evm/packages/abi/xy.config.ts on lines 2..8
packages/payloadset/packages/evm/packages/call/packages/token-uri/diviner/xy.config.ts on lines 2..8
packages/payloadset/packages/evm/packages/call/xy.config.ts on lines 2..8
packages/payloadset/packages/evm/packages/contract/packages/witness/xy.config.ts on lines 2..8
packages/payloadset/packages/evm/packages/erc1822/xy.config.ts on lines 2..8
packages/payloadset/packages/evm/packages/erc1967/xy.config.ts on lines 2..8
packages/payloadset/packages/evm/packages/events/xy.config.ts on lines 2..8
packages/payloadset/packages/evm/packages/token-interface/packages/diviner/xy.config.ts on lines 2..8
packages/payloadset/packages/evm/xy.config.ts on lines 2..8
packages/payloadset/packages/file/xy.config.ts on lines 2..8
packages/payloadset/packages/id/xy.config.ts on lines 2..8
packages/payloadset/packages/image-thumbnail/packages/diviner/xy.config.ts on lines 2..8
packages/payloadset/packages/location-certainty/xy.config.ts on lines 2..8
packages/payloadset/packages/location/xy.config.ts on lines 2..8
packages/payloadset/packages/module-instance/xy.config.ts on lines 2..8
packages/payloadset/packages/payments/packages/providers/packages/rebilly/packages/authorization/packages/card/xy.config.ts on lines 2..8
packages/payloadset/packages/payments/xy.config.ts on lines 2..8
packages/payloadset/packages/pentair/xy.config.ts on lines 2..8
packages/payloadset/packages/schema/xy.config.ts on lines 2..8
packages/payloadset/packages/stock/packages/market/packages/tzero/xy.config.ts on lines 2..8
packages/payloadset/packages/system/xy.config.ts on lines 2..8
packages/payloadset/packages/url-safety/xy.config.ts on lines 2..8
packages/payloadset/packages/xml/xy.config.ts on lines 2..8

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

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

export const isAddressTransactionHistoryPayload = (payload: Payload): payload is AddressTransactionHistoryPayload => {
  return payload.schema === AddressTransactionHistorySchema
}
packages/payload/packages/crypto/packages/nft/packages/collection/src/Payload/Payload.ts on lines 8..10
packages/payload/packages/crypto/packages/nft/packages/nft/src/Payload/Payload.ts on lines 8..10

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

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

const config: XyTsupConfig = {
  compile: {
    browser: {},
    node: { src: true },
    neutral: {},
packages/payloadset/packages/image-thumbnail/xy.config.ts on lines 3..9
packages/payloadset/packages/prometheus/xy.config.ts on lines 2..8

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

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

const config: XyTsupConfig = {
  compile: {
    browser: { src: true },

    node: {},
packages/payloadset/packages/file/packages/browser/xy.config.ts on lines 2..8

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

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

export const moduleIdentifiersContainsOneOf = (
  escrowTerms: EscrowTerms,
  propertyExpression: PayloadValueExpression<EscrowTerms, 'appraisalAuthorities' | 'buyer' | 'escrowAgent' | 'paymentAuthorities' | 'seller'>,
  moduleIdentifiers: ModuleIdentifier[],
  required: boolean = true,

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

export const getDomainLengthValidator = (
  minNameLength = MIN_DOMAIN_LENGTH,
  maxLength = MAX_DOMAIN_LENGTH,
): PayloadValidationFunctionWithError<Payload<DomainFields>> => {
  return (

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

export const getNftsOwnedByAddressWithMetadata = async (
  /** @param publicAddress The address of the wallet to search for NFTs */
  publicAddress: string,
  /** @param provider The provider to use for accessing the block chain */
  providers: Provider[],

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

export const scoreAnimationUrl = (animation_url: unknown): ScaledScore => {
  const score: ScaledScore = [0, 0]
  if (animation_url === undefined || animation_url === null) return PASS
  incrementPossible(score)
  if (typeof animation_url !== 'string') return score

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

export const evaluateAttribute = (attribute: OpenSeaNftAttribute): ScaledScore => {
  const score: ScaledScore = [0, 1]
  const max_value = attribute?.max_value
  const trait_type = attribute?.trait_type
  const value = attribute?.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 getDomainReservedNamesValidator has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const getDomainReservedNamesValidator = (reservedNames: string[]): PayloadValidationFunction<Payload<DomainFields>> => {
  return (payload: Payload<DomainFields>) => {
    const { domain } = payload
    // Check if any of our fragments are in the name
    for (const reserved of reservedNames) {

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

export const moduleIdentifiersContainsAllOf = (
  escrowTerms: EscrowTerms,
  selector: PayloadValueExpression<EscrowTerms, 'appraisalAuthorities' | 'buyer' | 'escrowAgent' | 'paymentAuthorities' | 'seller'>,
  moduleIdentifiers: ModuleIdentifier[],
  required: boolean = true,

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