XYOracleNetwork/sdk-xyo-react-js

View on GitHub

Showing 476 of 476 total issues

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

      {
        geometry: {
          coordinates: [-89.284_175_483_532_56, 42.073_117_831_973_4],
          type: 'Point',
        },
packages/plugins/packages/location-points-map/src/components/storyPayload.tsx on lines 18..31
packages/plugins/packages/location-points-map/src/components/storyPayload.tsx on lines 32..45
packages/plugins/packages/location-points-map/src/components/storyPayload.tsx on lines 88..101
packages/plugins/packages/location-points-map/src/components/storyPayload.tsx on lines 102..115
packages/plugins/packages/location-points-map/src/components/storyPayload.tsx on lines 116..129
packages/plugins/packages/location-points-map/src/components/storyPayload.tsx on lines 144..157
packages/plugins/packages/location-points-map/src/components/storyPayload.tsx on lines 158..171

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

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 testReport has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    async (address: string, tokenInterface?: string) => {
      if (node) {
        try {
          // test indexed call
          const diviner = asDivinerInstance(await node.resolve(IndexedDivinerName))

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

          {
            geometry: {
              coordinates: [-83.2376, 33.0787],
              type: 'Point',
            },
    packages/plugins/packages/location-points-map/src/components/storyPayload.tsx on lines 18..31
    packages/plugins/packages/location-points-map/src/components/storyPayload.tsx on lines 32..45
    packages/plugins/packages/location-points-map/src/components/storyPayload.tsx on lines 46..59
    packages/plugins/packages/location-points-map/src/components/storyPayload.tsx on lines 102..115
    packages/plugins/packages/location-points-map/src/components/storyPayload.tsx on lines 116..129
    packages/plugins/packages/location-points-map/src/components/storyPayload.tsx on lines 144..157
    packages/plugins/packages/location-points-map/src/components/storyPayload.tsx on lines 158..171

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

    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 mapPoints = useMemo(() => {
        return (map && features?.length)
          ? new MapPoints({
            features, map, zoom,
          })
    Severity: Major
    Found in packages/sdk/packages/map/src/Components/MapBoxPoints.tsx and 1 other location - About 1 hr to fix
    packages/sdk/packages/map/src/Contexts/HeatMapInitializer/Provider.tsx on lines 39..45

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

    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 mapHeat = useMemo(() => {
        return (map && features?.length)
          ? new MapHeat({
            features, map, zoom,
          })
    packages/sdk/packages/map/src/Components/MapBoxPoints.tsx on lines 42..48

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

    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 useWeakModulesFromNode has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export const useWeakModulesFromNode = (
      filter?: ModuleFilter,
      config?: ModuleFromNodeConfig,
    ): [WeakRef<ModuleInstance>[] | undefined, Error | undefined] => {
      const [node, nodeError] = useNode(config)
    Severity: Minor
    Found in packages/modules/packages/node/src/hooks/useWeakModulesFromNode.ts - About 1 hr to fix

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

      export const EmbedPluginCard: React.FC<BusyCardProps> = ({ ...props }) => {
        const { payload } = useResolvePayload()
        const {
          activePlugin: ActivePlugin, plugins, hideElementsConfig,
        } = useEmbedPluginState()

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

              {
                geometry: {
                  coordinates: [7.276_487_4, 43.702_727_8],
                  type: 'Point',
                },
        packages/plugins/packages/location-points-map/src/components/storyPayload.tsx on lines 60..73
        packages/plugins/packages/location-points-map/src/components/storyPayload.tsx on lines 74..87
        packages/plugins/packages/location-points-map/src/components/storyPayload.tsx on lines 130..143

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

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

              {
                geometry: {
                  coordinates: [7.276_505_7, 43.702_730_2],
                  type: 'Point',
                },
        packages/plugins/packages/location-points-map/src/components/storyPayload.tsx on lines 4..17
        packages/plugins/packages/location-points-map/src/components/storyPayload.tsx on lines 60..73
        packages/plugins/packages/location-points-map/src/components/storyPayload.tsx on lines 130..143

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

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

              {
                geometry: {
                  coordinates: [7.276_495_1, 43.702_729_5],
                  type: 'Point',
                },
        packages/plugins/packages/location-points-map/src/components/storyPayload.tsx on lines 4..17
        packages/plugins/packages/location-points-map/src/components/storyPayload.tsx on lines 60..73
        packages/plugins/packages/location-points-map/src/components/storyPayload.tsx on lines 74..87

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

        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

              {iconOnly
                ? null
                : (
                    <RawInfoDialog
                      defaultExpandedJson={defaultExpandedJson}
        packages/sdk/packages/payload/packages/raw-info/src/components/Button/RawInfoIconButton.tsx on lines 50..61

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

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

              {
                geometry: {
                  coordinates: [7.276_478_5, 43.702_732_1],
                  type: 'Point',
                },
        packages/plugins/packages/location-points-map/src/components/storyPayload.tsx on lines 4..17
        packages/plugins/packages/location-points-map/src/components/storyPayload.tsx on lines 74..87
        packages/plugins/packages/location-points-map/src/components/storyPayload.tsx on lines 130..143

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

        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

                {iconOnly
                  ? null
                  : (
                      <RawInfoDialog
                        defaultExpandedJson={defaultExpandedJson}
        packages/sdk/packages/payload/packages/raw-info/src/components/Button/RawInfoButton.tsx on lines 62..73

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

        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

                    : resolvedSchema === undefined
                      ? (
                          <IconButton ref={buttonRef} size="small" onClick={() => onClick(buttonDispatch)}>
                            <NewReleasesIcon color="disabled" fontSize="inherit" />
                          </IconButton>
        packages/sdk/packages/schema/src/components/Property/SchemaProperty.tsx on lines 60..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 57.

        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

                  ? resolvedSchema === null
                    ? (
                        <IconButton ref={buttonRef} size="small" onClick={() => onClick(buttonDispatch)}>
                          <NewReleasesIcon color="warning" fontSize="inherit" />
                        </IconButton>
        packages/sdk/packages/schema/src/components/Property/SchemaProperty.tsx on lines 66..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 57.

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

        export const usePromise = <TResult>(
          promise: () => Promise<TResult | undefined>,
          dependencies: DependencyList,
          debug: string | undefined = undefined,
        ): [TResult | undefined, Error | undefined, State | undefined] => {
        Severity: Minor
        Found in packages/sdk/packages/wallet/src/contexts/Wallet/usePromise.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 EllipsisTableCellWithRef has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

          ({
            children, href, link = false, to, value, ...props
          }, ref) => {
            const data = useMemo(() => {
              if (children) {

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

        export const parseMeausureString = (measure?: string, absolute?: number) => {
          if (measure !== undefined && measure !== null && measure.length > 0) {
            if (measure.endsWith('px')) {
              return Number.parseFloat(measure.slice(0, Math.max(0, measure.length - 2)))
            } else if (measure.endsWith('%')) {
        Severity: Minor
        Found in packages/sdk/packages/shared/src/lib/getActualPaddingX.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 useAccessCodes has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

        export const useAccessCodes = (localStorageKey: string, validCodeLength = 6) => {
          const [validated, setValidated] = useState(false)
          const [codeInput, setCodeInput] = useState('')
        
          const onAccessCodeSuccess = () => {
        Severity: Minor
        Found in packages/sdk/packages/access-gate/src/hooks/useAccessCodes.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 useDivinePayload has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export const useDivinePayload = <T extends Payload = Payload>(
          huri?: string,
        ): [T | undefined | null, Dispatch<T | null | undefined>, Error | undefined] => {
          const { diviner } = usePayloadDiviner()
          const [payload, setPayload] = useState<T | null>()
          Severity
          Category
          Status
          Source
          Language