Showing 5 of 11 total issues
Function 1.0.0
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
Open
'1.0.0': (data, serviceToken) => {
data.har.log.entries = data.har.log.entries.map((entry, index) => {
if (data.clientIPAddress) {
entry.clientIPAddress = data.clientIPAddress
}
- Read upRead up
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
Open
'1.0.0': (data, serviceToken) => {
data.har.log.entries = data.har.log.entries.map((entry, index) => {
if (data.clientIPAddress) {
entry.clientIPAddress = data.clientIPAddress
}
Function detector
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
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({
Function entries
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
data.har.log.entries = data.har.log.entries.map((entry, index) => {
if (data.clientIPAddress) {
entry.clientIPAddress = data.clientIPAddress
}
Consider simplifying this complex logical expression. Open
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'