Mashape/alf-converter

View on GitHub

Showing 5 of 11 total issues

Function 1.0.0 has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

    '1.0.0': (data, serviceToken) => {
      data.har.log.entries = data.har.log.entries.map((entry, index) => {
        if (data.clientIPAddress) {
          entry.clientIPAddress = data.clientIPAddress
        }
Severity: Minor
Found in src/converter.js - About 3 hrs 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 1.0.0 has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    '1.0.0': (data, serviceToken) => {
      data.har.log.entries = data.har.log.entries.map((entry, index) => {
        if (data.clientIPAddress) {
          entry.clientIPAddress = data.clientIPAddress
        }
Severity: Major
Found in src/converter.js - About 2 hrs to fix

    Function detector has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export default function detector (data = {}) {
      return new Promise((resolve, reject) => {
        // ALF 2.0.0
        if (data.creator && data.entries && !data.har && !data.serviceToken && !data.har) {
          resolve({
    Severity: Minor
    Found in src/detector.js - About 1 hr to fix

      Function entries has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            data.har.log.entries = data.har.log.entries.map((entry, index) => {
              if (data.clientIPAddress) {
                entry.clientIPAddress = data.clientIPAddress
              }
      
      
      Severity: Minor
      Found in src/converter.js - About 1 hr to fix

        Consider simplifying this complex logical expression.
        Open

            if (data.har && data.version && data.serviceToken && data.har && (data.har.log.entries[0].clientIPAddress || data.har.log.entries[0].request.bodyCaptured)) {
              resolve({
                data: data,
                format: 'ALF',
                version: '1.1.0'
        Severity: Major
        Found in src/detector.js - About 40 mins to fix
          Severity
          Category
          Status
          Source
          Language