Mechazawa/minidrone-js

View on GitHub

Showing 6 of 15 total issues

DroneCommand has 23 functions (exceeds 20 allowed). Consider refactoring.
Open

class DroneCommand {
  /**
   * Creates a new DroneCommand instance
   * @param {object} project - Project node from the xml spec
   * @param {object} class_ - Class node from the xml spec
Severity: Minor
Found in src/DroneCommand.js - About 2 hrs to fix

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

      _setupPeripheral() {
        this.peripheral.discoverAllServicesAndCharacteristics((err, services, characteristics) => {
          if (err) {
            throw err;
          }
    Severity: Minor
    Found in src/DroneConnection.js - About 1 hr to fix

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

        _handleIncoming(channelUuid, buffer) {
          const channel = receiveUuids.findForValue(channelUuid);
          let callback;
      
          switch (channel) {
      Severity: Minor
      Found in src/DroneConnection.js - About 1 hr to fix

        Function parseBuffer has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          parseBuffer(buffer) {
            const command = this._getCommandFromBuffer(buffer);
        
            let bufferOffset = 4;
        
        
        Severity: Minor
        Found in src/CommandParser.js - 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

        Function _handleIncoming has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          _handleIncoming(channelUuid, buffer) {
            const channel = receiveUuids.findForValue(channelUuid);
            let callback;
        
            switch (channel) {
        Severity: Minor
        Found in src/DroneConnection.js - About 25 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 getCommand has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          getCommand(projectName, className, commandName, commandArguments = {}) {
            const cacheToken = [projectName, className, commandName].join('-');
        
            if (typeof this._commandCache[cacheToken] === 'undefined') {
              // Find project
        Severity: Minor
        Found in src/CommandParser.js - About 25 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