richrace/arctis-usb-finder

View on GitHub

Showing 8 of 46 total issues

Function testUnknownHeadset has 79 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  testUnknownHeadset() {
    // Order in popularity of the most used write bytes. We can get a false positive.
    const knownBytes = [
      [0x00, 0xb0],
      [0x06, 0x18],
Severity: Major
Found in src/use_cases/probe.ts - About 3 hrs to fix

    Function foundHeadphones has 64 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        const foundHeadphones = this.devices.map((device) => {
          console.log('Probing', device.product);
    
          const devicePath = device.path;
    
    
    Severity: Major
    Found in src/use_cases/probe.ts - About 2 hrs to fix

      Function probe has 41 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function probe() {
        console.log(' ');
        console.log('About to look for SteelSeries USB devices...');
        console.log(' ');
      
      
      Severity: Minor
      Found in src/bin/probe-arctis.ts - About 1 hr to fix

        Function testUnknownHeadset has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

          testUnknownHeadset() {
            // Order in popularity of the most used write bytes. We can get a false positive.
            const knownBytes = [
              [0x00, 0xb0],
              [0x06, 0x18],
        Severity: Minor
        Found in src/use_cases/probe.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 report has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export default function report(deviceHash: DeviceToHeadphone): DeviceToHeadphone {
          const { vendorId, productId } = deviceHash.hidDevice;
          const writeBytes = deviceHash.headphone?.writeBytes as number[];
          let device: HID.HID | undefined;
        
        
        Severity: Minor
        Found in src/use_cases/report.ts - About 1 hr to fix

          Function findHeadphones has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            private findHeadphones() {
              const hidDevices = HID.devices();
          
              this.devices = hidDevices
                .map((hidDevice): DeviceToHeadphone => {
          Severity: Minor
          Found in src/index.ts - About 1 hr to fix

            Function report has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

            export default function report(deviceHash: DeviceToHeadphone): DeviceToHeadphone {
              const { vendorId, productId } = deviceHash.hidDevice;
              const writeBytes = deviceHash.headphone?.writeBytes as number[];
              let device: HID.HID | undefined;
            
            
            Severity: Minor
            Found in src/use_cases/report.ts - About 55 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

            Function findHeadphones has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

              private findHeadphones() {
                const hidDevices = HID.devices();
            
                this.devices = hidDevices
                  .map((hidDevice): DeviceToHeadphone => {
            Severity: Minor
            Found in src/index.ts - About 45 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

            Severity
            Category
            Status
            Source
            Language