Showing 15 of 19 total issues
Function exports
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
module.exports = info => {
const res = [];
if (info !== null && typeof info === 'object') {
if ('title' in info) {
res.push(`# ${info.title}`);
- 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 dataTypeResolver
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
const dataTypeResolver = schema => {
if (schema.getAllOf()) {
return schema.getAllOf()
.map(subSchema => dataTypeResolver(subSchema))
.filter(type => type !== '')
- 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 exports
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = (parameters, pathParameters, globalParameters = {}) => {
const res = [];
res.push('##### Parameters\n');
res.push('| Name | Located in | Description | Required | Schema |');
res.push('| ---- | ---------- | ----------- | -------- | ---- |');
Function exports
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = security => {
const res = [];
let maxLength = 0;
security.map(rules => {
Object.keys(rules).map(key => {
Function constructor
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
constructor(schema = null) {
if (schema !== null) {
if ('type' in schema) {
this.setType(schema.type);
}
- 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 exports
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = (path, data, parameters) => {
const res = [];
let pathParameters = null;
if (path && data) {
Function dataTypeResolver
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
const dataTypeResolver = schema => {
if (schema.getAllOf()) {
return schema.getAllOf()
.map(subSchema => dataTypeResolver(subSchema))
.filter(type => type !== '')
Function exports
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = securityDefinitions => {
// Base block
const res = [];
Object.keys(securityDefinitions).map(type => {
res.push(`**${type}** \n`);
Function exports
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = responses => {
const res = [];
// Check if schema somewhere
const schemas = Object.keys(responses).reduce(
(acc, response) => acc || 'schema' in responses[response],
Function exports
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
module.exports = (needle, haystack) => {
if (haystack === undefined || haystack === null) return false;
if (haystack.length) {
for (let i = 0; i < haystack.length; i++) {
if (needle === haystack[i]) {
- 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 exports
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
module.exports = license => {
const res = [];
if ('url' in license || 'name' in license) {
res.push('**License:** ');
if ('url' in license && 'name' in license) {
- 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 `[ ${subType} ]`;
Avoid too many return
statements within this function. Open
return '';
Avoid too many return
statements within this function. Open
return `${schema.getType()} (${schema.getFormat()})`;
Avoid too many return
statements within this function. Open
return schema.getType();