OpenHPS/openhps-react-native

View on GitHub

Showing 8 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

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

              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

                Severity
                Category
                Status
                Source
                Language