prey/prey-node-client

View on GitHub
lib/agent/providers/network/linux.js

Summary

Maintainability
B
4 hrs
Test Coverage

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

exports.get_access_points_list = function(callback, attempt) {

  get_first_wireless_interface(function(err, wifi_device) {
    if (err || !wifi_device)
      return callback(new Error(err || 'No wireless adapter found.'));
Severity: Minor
Found in lib/agent/providers/network/linux.js - 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 get_active_access_point has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

exports.get_active_access_point = function(callback) {
  // There's not enough information using the command related to the current AP, so we need to consult the AP list.
  // TODO: Optimize the AP list command usage.
  exports.get_active_access_point_mac((err, ap_mac) => {
    if (err || !ap_mac) return callback(err || new Error('No active access point found.'));
Severity: Minor
Found in lib/agent/providers/network/linux.js - 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 parse_access_points_list has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

exports.parse_access_points_list = function(output) {

  return output.split(/Cell \d\d - /).splice(1).map(function(block) {
    var parsed = {};

Severity: Minor
Found in lib/agent/providers/network/linux.js - 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 parse_access_points_list has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

exports.parse_access_points_list = function(output) {

  return output.split(/Cell \d\d - /).splice(1).map(function(block) {
    var parsed = {};

Severity: Minor
Found in lib/agent/providers/network/linux.js - About 1 hr to fix

    There are no issues that match your filters.

    Category
    Status