librenms/librenms

View on GitHub

Showing 1,511 of 31,793 total issues

Avoid too many return statements within this method.
Open

                return '';
Severity: Major
Found in LibreNMS/OS/Shared/Cisco.php - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

                    return 'UdpTimestamp';
    Severity: Major
    Found in LibreNMS/OS/Junos.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                  return 'IP-20C';
      Severity: Major
      Found in LibreNMS/OS/Ceraos.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                return $ports;
        Severity: Major
        Found in LibreNMS/OS/Traits/BridgeMib.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                              return true;
          Severity: Major
          Found in LibreNMS/OS/Traits/BridgeMib.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                                    return;
            Severity: Major
            Found in LibreNMS/Validations/User.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                      return new ValidationResult(trans('validation.validations.poller.CheckPythonWrapper.no_pollers'), $status);
              Severity: Major
              Found in LibreNMS/Validations/Poller/CheckPythonWrapper.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                        return ValidationResult::fail(trans('validation.validations.poller.CheckDispatcherService.fail'));
                Severity: Major
                Found in LibreNMS/Validations/Poller/CheckDispatcherService.php - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                                  return Result(scan_ip, hostname, Outcome.ERROR, output)
                  Severity: Major
                  Found in snmp-scan.py - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                        return Result(scan_ip, hostname, Outcome.UNDEFINED, output)
                    Severity: Major
                    Found in snmp-scan.py - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                              return Result(scan_ip, hostname, Outcome.TERMINATED, "Terminated")
                      Severity: Major
                      Found in snmp-scan.py - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                        return Result(scan_ip, hostname, Outcome.KNOWN, output)
                        Severity: Major
                        Found in snmp-scan.py - About 30 mins to fix

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

                          function get_port_stats_by_port_hostname(Illuminate\Http\Request $request)
                          {
                              $ifName = $request->route('ifname');
                          
                              // handle %2f in paths and pass to get_graph_by_port_hostname if needed
                          Severity: Minor
                          Found in includes/html/api_functions.inc.php - 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 dbHandleException has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                          function dbHandleException(QueryException $exception)
                          {
                              $message = $exception->getMessage();
                          
                              if ($exception->getCode() == 2002) {
                          Severity: Minor
                          Found in includes/dbFacile.php - 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 add_device has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                          function add_device(Illuminate\Http\Request $request)
                          {
                              // This will add a device using the data passed encoded with json
                              $data = $request->json()->all();
                          
                          
                          Severity: Minor
                          Found in includes/html/api_functions.inc.php - 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 dbUpdate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                          function dbUpdate($data, $table, $where = null, $parameters = [])
                          {
                              // need field name and placeholder value
                              // but how merge these field placeholders with actual $parameters array for the WHERE clause
                              $sql = 'UPDATE `' . $table . '` set ';
                          Severity: Minor
                          Found in includes/dbFacile.php - 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 list_vrf has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                          function list_vrf(Illuminate\Http\Request $request)
                          {
                              $sql = '';
                              $sql_params = [];
                              $hostname = $request->get('hostname');
                          Severity: Minor
                          Found in includes/html/api_functions.inc.php - 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 update_device_group_remove_devices has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                          function update_device_group_remove_devices(Illuminate\Http\Request $request)
                          {
                              $data = json_decode($request->getContent(), true);
                              if (json_last_error() || ! is_array($data)) {
                                  return api_error(400, "We couldn't parse the provided json. " . json_last_error_msg());
                          Severity: Minor
                          Found in includes/html/api_functions.inc.php - 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 rename_device has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                          function rename_device(Illuminate\Http\Request $request)
                          {
                              $hostname = $request->route('hostname');
                              $device_id = ctype_digit($hostname) ? $hostname : getidbyname($hostname);
                              $new_hostname = $request->route('new_hostname');
                          Severity: Minor
                          Found in includes/html/api_functions.inc.php - 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 update_device_group_add_devices has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                          function update_device_group_add_devices(Illuminate\Http\Request $request)
                          {
                              $data = json_decode($request->getContent(), true);
                              if (json_last_error() || ! is_array($data)) {
                                  return api_error(400, "We couldn't parse the provided json. " . json_last_error_msg());
                          Severity: Minor
                          Found in includes/html/api_functions.inc.php - 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