Showing 64 of 64 total issues
Function oauthScopes
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
oauthScopes(element, items) {
const {
Member: MemberElement,
Array: ArrayElement,
String: StringElement,
Function pushHeaderObject
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function pushHeaderObject(key, header, payload, parser) {
let value = '';
if (header.type === 'array') {
// TODO: Support collectionFormat once arrays are supported
Function typeForSchema
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
typeForSchema(schema) {
if (schema.$ref) {
// Peek into the reference, if we're calling typeForSchema from the
// allOf case below then we will need to know the destination type
const ref = lookupReference(schema.$ref, this.root);
- 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 useResourceGroups
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
useResourceGroups() {
const tags = [];
if (this.swagger.paths) {
_.forEach(this.swagger.paths, (path) => {
Function generateValidationDescriptions
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
generateValidationDescriptions(schema) {
const validations = {
// String
pattern: value => `Matches regex pattern: \`${value}\``,
maxLength: value => `Length of string must be less than, or equal to ${value}`,
Function generateObject
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
generateObject(schema) {
const {
Object: ObjectElement,
} = this.minim.elements;
- 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
Avoid deeply nested control flow statements. Open
if (!newNode && piece > 0 && node.value[piece - 1]) {
// Element in sequence does not exist. It could have been empty
// Let's provide the end of previous element
start = node.value[piece - 1].end_mark;
end = start;
Avoid deeply nested control flow statements. Open
if (!pieces.length) {
// This is the last item!
start = subNode[0].start_mark;
end = subNode[1].end_mark;
}
Function parse
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
parse(done) {
const {
Category, ParseResult, SourceMap,
} = this.minim.elements;
const swaggerParser = new SwaggerParser();
- 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 pushHeader
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
export function pushHeader(key, value, payload, parser, fragment) {
Function pushHeader
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export function pushHeader(key, value, payload, parser, fragment) {
const { Member: MemberElement } = parser.minim.elements;
let header;
createHeaders(payload, parser);
- 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 pushHeaderObject
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export function pushHeaderObject(key, header, payload, parser) {
let value = '';
if (header.type === 'array') {
// TODO: Support collectionFormat once arrays are supported
- 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 generateArray
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
generateArray(schema) {
const { Array: ArrayElement } = this.minim.elements;
const element = new ArrayElement();
if (schema.items) {
- 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 bodyFromSchema
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export function bodyFromSchema(schema, payload, parser, contentType = 'application/json') {
const dereferencedSchema = dereference(schema, schema);
const { Asset } = parser.minim.elements;
let asset = null;
- 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 updateResourceGroup
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
updateResourceGroup(name) {
const { Category, Copy } = this.minim.elements;
if (name) {
this.group = this.api.find(el => el.element === 'category' && el.classes.contains('resourceGroup') && el.title.toValue() === name).first;
- 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 lookupReference
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export function lookupReference(reference, root, depth) {
const parts = reference.split('/').reverse();
if (parts.pop() !== '#') {
throw new Error('Schema reference must start with document root (#)');
- 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
Avoid too many return
statements within this function. Open
return result;
Avoid too many return
statements within this function. Open
return done(exception, this.result);
Avoid too many return
statements within this function. Open
return _.forEach(paths, (pathValue, href) => {
nextTick(() => {
this.handleSwaggerPath(pathValue, href);
pendingPaths -= 1;
Avoid too many return
statements within this function. Open
return example;