Esri/react-arcgis

View on GitHub

Showing 15 of 15 total issues

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

            return (
                <div id="base-container" style={mapStyle} className={this.props.className}>
                    <ArcContainer id={this.state.mapContainerId} style={{ width: '100%', height: '100%' }} />
                    <div style={centerStyle as any}>
                        {loadElement}
Severity: Major
Found in src/ts/components/ArcBase.tsx and 1 other location - About 3 hrs to fix
src/ts/components/ArcBase.tsx on lines 116..123

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

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

        return (
            <div id="base-container" style={mapStyle} className={this.props.className}>
                <ArcContainer id={this.state.mapContainerId} style={{ width: '100%', height: '100%' }} />
                <div style={centerStyle as any}>
                    {failElement}
Severity: Major
Found in src/ts/components/ArcBase.tsx and 1 other location - About 3 hrs to fix
src/ts/components/ArcBase.tsx on lines 107..114

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

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

    public render() {
        const centerStyle = {
            left: '50%',
            marginRight: '-50%',
            position: 'absolute',
Severity: Major
Found in src/ts/components/ArcBase.tsx - About 2 hrs to fix

    Function WebBase has 37 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          ([WebConstructor, ViewConstructor, all], containerId) => {
            const mapData = new Promise((resolve, reject) => {
                try {
                    const map: __esri.WebMap | __esri.WebScene = new WebConstructor({
                        portalItem: {
    Severity: Minor
    Found in src/ts/components/ArcComposites.tsx - About 1 hr to fix

      Function mapData has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              const mapData = new Promise((resolve, reject) => {
                  try {
                      const map: __esri.WebMap | __esri.WebScene = new WebConstructor({
                          portalItem: {
                              id: props.id
      Severity: Minor
      Found in src/ts/components/ArcComposites.tsx - About 1 hr to fix

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

        export const WebScene = (props: SceneProps) => (
            <WebBase
                scriptUri={['esri/WebScene', 'esri/views/SceneView', 'dojo/promise/all']}
                {...props}
                viewProperties={props.viewProperties}
        Severity: Major
        Found in src/ts/components/WebComposites.tsx and 1 other location - About 1 hr to fix
        src/ts/components/WebComposites.tsx on lines 16..23

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

        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 WebMap = (props: MapProps) => (
            <WebBase
                scriptUri={['esri/WebMap', 'esri/views/MapView', 'dojo/promise/all']}
                {...props}
                viewProperties={props.viewProperties}
        Severity: Major
        Found in src/ts/components/WebComposites.tsx and 1 other location - About 1 hr to fix
        src/ts/components/WebComposites.tsx on lines 25..32

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

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

        const BermudaTriangle = (props) => {
        
            const [graphic, setGraphic] = useState(null);
            useEffect(() => {
        
        
        Severity: Minor
        Found in demo/src/BermudaTriangle.js - About 1 hr to fix

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

                          Object.keys(eventMap).forEach((key) => {  // Set view events to any user defined callbacks
                              if (props[key]) {
                                  typedView.on(eventMap[key], props[key]);
                              }
                          });
          Severity: Major
          Found in src/ts/components/ArcComposites.tsx and 1 other location - About 1 hr to fix
          src/ts/components/ArcComposites.tsx on lines 113..117

          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

                                  Object.keys(eventMap).forEach((key) => {  // Set view events to any user defined callbacks
                                      if (props[key]) {
                                          view.on(eventMap[key], props[key]);
                                      }
                                  });
          Severity: Major
          Found in src/ts/components/ArcComposites.tsx and 1 other location - About 1 hr to fix
          src/ts/components/ArcComposites.tsx on lines 65..69

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

              public render() {
                  const centerStyle = {
                      left: '50%',
                      marginRight: '-50%',
                      position: 'absolute',
          Severity: Minor
          Found in src/ts/components/ArcBase.tsx - About 35 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

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

          export interface MapProps extends BaseProps {
              id: string;
              mapProperties?: __esri.WebMapProperties;
              viewProperties?: __esri.MapViewProperties;
          }
          Severity: Minor
          Found in src/ts/components/WebComposites.tsx and 1 other location - About 35 mins to fix
          src/ts/components/WebComposites.tsx on lines 10..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 46.

          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 interface SceneProps extends BaseProps {
              id: string;
              mapProperties?: __esri.WebSceneProperties;
              viewProperties?: __esri.SceneViewProperties;
          }
          Severity: Minor
          Found in src/ts/components/WebComposites.tsx and 1 other location - About 35 mins to fix
          src/ts/components/WebComposites.tsx on lines 4..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 46.

          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 failElement = (
                      this.props.failElement ? this.props.failElement :
                      <h3 id="react-arcgis-fail-text">The ArcGIS API failed to load.</h3>
                  );
          Severity: Minor
          Found in src/ts/components/ArcBase.tsx and 1 other location - About 30 mins to fix
          src/ts/components/ArcBase.tsx on lines 78..81

          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 loadElement = (
                      this.props.loadElement ? this.props.loadElement :
                      <h3 id="react-arcgis-loading-text">Loading...</h3>
                  );
          Severity: Minor
          Found in src/ts/components/ArcBase.tsx and 1 other location - About 30 mins to fix
          src/ts/components/ArcBase.tsx on lines 83..86

          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

          Severity
          Category
          Status
          Source
          Language