OpenHPS/openhps-react-native

View on GitHub

Showing 19 of 19 total issues

Function onmessage has 67 lines of code (exceeds 25 allowed). Consider refactoring.
Open

self.onmessage = (message: string) => {
    const msg = JSON.parse(message);
    switch (msg.action) {
        /**
         * Initialize the positioning model
Severity: Major
Found in demo/demo_fingerprinting/external/workers/worker.ts - About 2 hrs to fix

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

                if (rotationRate) {
                    dataFrame.addSensor(
                        new Gyroscope(
                            (this.source ? this.source.uid : this.uid) + '_gyro',
                            new AngularVelocity(rotationRate.x, rotationRate.y, rotationRate.z),
    Severity: Major
    Found in src/nodes/IMUSourceNode.ts and 2 other locations - About 2 hrs to fix
    src/nodes/IMUSourceNode.ts on lines 102..110
    src/nodes/IMUSourceNode.ts on lines 131..139

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

    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

                if (magnetometer) {
                    dataFrame.addSensor(
                        new Magnetometer(
                            (this.source ? this.source.uid : this.uid) + '_magnetometer',
                            new Magnetism(magnetometer.x, magnetometer.y, magnetometer.z),
    Severity: Major
    Found in src/nodes/IMUSourceNode.ts and 2 other locations - About 2 hrs to fix
    src/nodes/IMUSourceNode.ts on lines 102..110
    src/nodes/IMUSourceNode.ts on lines 122..130

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

    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

                if (acceleration) {
                    dataFrame.addSensor(
                        new Accelerometer(
                            (this.source ? this.source.uid : this.uid) + '_accl',
                            new Acceleration(acceleration.x, acceleration.y, acceleration.z),
    Severity: Major
    Found in src/nodes/IMUSourceNode.ts and 2 other locations - About 2 hrs to fix
    src/nodes/IMUSourceNode.ts on lines 122..130
    src/nodes/IMUSourceNode.ts on lines 131..139

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

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

    function init() {
        ModelBuilder.create()
            .addService(new SocketClient())
            .withLogger((level: string, log: any) => {
                self.postMessage(JSON.stringify({
    Severity: Minor
    Found in demo/demo_fingerprinting/external/workers/worker.ts - About 1 hr to fix

      Function createFrame has 48 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public createFrame(): Promise<void> {
              return new Promise<void>((resolve) => {
                  const dataFrame = new DataFrame();
                  dataFrame.source = this.source;
      
      
      Severity: Minor
      Found in src/nodes/IMUSourceNode.ts - About 1 hr to fix

        Function render has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            render() {
                return (
                    <Container>
                        <Header title={"Connect"}/>
                        <Content 
        Severity: Minor
        Found in demo/demo_fingerprinting/src/pages/ConnectionPage.tsx - About 1 hr to fix

          Function scan has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            scan() {
              this.setState({
                ...this.state,
                scanning: true,
              });
          Severity: Minor
          Found in demo/demo_fingerprinting/src/pages/DatapointPage.tsx - About 1 hr to fix

            Function start has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public start(): Promise<void> {
                    return new Promise((resolve) => {
                        this._manager.stopDeviceScan();
                        this._manager.startDeviceScan(
                            this.options.uuids,
            Severity: Minor
            Found in src/nodes/BLESourceNode.ts - About 1 hr to fix

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

                          <Tab heading="Train" tabStyle={{ /* ... */ }}>
                              <MapTab
                                  app={this.props.app}
                                  datapointsJson={datapoints}
                              />
              Severity: Major
              Found in demo/demo_fingerprinting/src/pages/MainPage.tsx and 1 other location - About 1 hr to fix
              demo/demo_fingerprinting/src/pages/MainPage.tsx on lines 54..59

              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

                          <Tab heading="Test" tabStyle={{ /* ... */ }}>
                              <MapTab
                                  app={this.props.app}
                                  datapointsJson={testdatapoints}
                              />
              Severity: Major
              Found in demo/demo_fingerprinting/src/pages/MainPage.tsx and 1 other location - About 1 hr to fix
              demo/demo_fingerprinting/src/pages/MainPage.tsx on lines 48..53

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

                render() {
                  return (
                    <Container>
                      <MapView
                        style={{
              Severity: Minor
              Found in demo/demo_fingerprinting/src/pages/MapTab.tsx - About 1 hr to fix

                Method initializeFlipper has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                  private static void initializeFlipper(Context context) {
                    if (BuildConfig.DEBUG) {
                      try {
                        /*
                         We use reflection here to pick up the class that initializes Flipper,

                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

                    } else {
                      return <DatapointsOverlay
                        datapoints={this.state.datapoints}
                        scale={SCALE}
                        app={this.props.app}
                Severity: Minor
                Found in demo/demo_fingerprinting/src/pages/MapTab.tsx and 1 other location - About 40 mins to fix
                demo/demo_fingerprinting/src/pages/MapTab.tsx on lines 54..60

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

                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

                    if (this.props.trajectory) {
                      return <TrajectoryOverlay
                        datapoints={this.state.datapoints}
                        scale={SCALE}
                        app={this.props.app}
                Severity: Minor
                Found in demo/demo_fingerprinting/src/pages/MapTab.tsx and 1 other location - About 40 mins to fix
                demo/demo_fingerprinting/src/pages/MapTab.tsx on lines 60..66

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

                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

                    constructor(props: IProps) {
                        super(props);
                        this.state = {
                            datapoints: this.props.datapoints,
                        };
                Severity: Minor
                Found in demo/demo_fingerprinting/src/components/TrajectoryOverlay.tsx and 1 other location - About 35 mins to fix
                demo/demo_fingerprinting/src/components/DatapointsOverlay.tsx on lines 24..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 47.

                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

                    constructor(props: IProps) {
                        super(props);
                        this.state = {
                            datapoints: this.props.datapoints,
                        };
                Severity: Minor
                Found in demo/demo_fingerprinting/src/components/DatapointsOverlay.tsx and 1 other location - About 35 mins to fix
                demo/demo_fingerprinting/src/components/TrajectoryOverlay.tsx on lines 24..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 47.

                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

                    public onPull(): Promise<DataFrame> {
                        return new Promise<DataFrame>((resolve) => {
                            resolve(undefined);
                        });
                    }
                Severity: Minor
                Found in src/nodes/IMUSourceNode.ts and 1 other location - About 35 mins to fix
                src/nodes/BLESourceNode.ts on lines 77..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 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

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

                    public onPull(): Promise<DataFrame> {
                        return new Promise<DataFrame>((resolve) => {
                            resolve(undefined);
                        });
                    }
                Severity: Minor
                Found in src/nodes/BLESourceNode.ts and 1 other location - About 35 mins to fix
                src/nodes/IMUSourceNode.ts on lines 146..150

                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

                Severity
                Category
                Status
                Source
                Language