Showing 112 of 206 total issues
File index.js
has 1514 lines of code (exceeds 250 allowed). Consider refactoring. Open
export const petStoreOas3Def = `openapi: 3.0.3
info:
title: Swagger Petstore - OpenAPI 3.0
description: |-
This is a sample Pet Store Server based on the OpenAPI 3.0 specification. You can find out more about
Function render
has 142 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
let { specSelectors, getComponent } = this.props
const Modal = getComponent("TopbarModal")
const Dropdown = getComponent("InsertDropdown")
Function checkForErrors
has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring. Open
export const checkForErrors = (formData) => {
let errors = false
// Invalid object was provided.
if (!OrderedMap.isOrderedMap(formData) && !Map.isMap(formData)) {
- 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 getLineNumberForPath
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
export function getLineNumberForPath(yaml, path) {
// Type check
if (typeof yaml !== "string") {
throw new TypeError("yaml should be a string")
- 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
File selectors.js
has 386 lines of code (exceeds 250 allowed). Consider refactoring. Open
import flatten from "lodash/flatten"
export const isVendorExt = (state,node) => node.path.some(a => a.indexOf("x-") === 0)
export const isDefinition = (state,node) => node.path[0] == "definitions" && node.path.length == 2
export const isTag = (state, node) => node.path[0] === "tags" && node.path.length === 2
Function pathForPosition
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
export function pathForPosition(yaml, position) {
// Type check
if (typeof yaml !== "string") {
throw new TypeError("yaml should be a string")
- 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 validateParameterFormDataConsumesType
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
export const validateParameterFormDataConsumesType = () => system => {
return system.validateSelectors
.allPathItems()
.then(nodes => {
return nodes.reduce((acc, node) => {
- 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 validateOAS3RefsForRequestBodiesReferenceRequestBodyPositions
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
export const validateOAS3RefsForRequestBodiesReferenceRequestBodyPositions = () => sys => {
return sys.validateSelectors
.allOAS3RequestBodies()
.then(nodes => {
return nodes.reduce((acc, node) => {
- 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
File Topbar.jsx
has 313 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React from "react"
import PropTypes from "prop-types"
import Swagger from "swagger-client"
import URL from "url"
import DropdownMenu from "./DropdownMenu"
File oas3-objects.js
has 286 lines of code (exceeds 250 allowed). Consider refactoring. Open
// Adapted from OAS 3.0.0-rc2
// comma dangles in this file = cleaner diffs
/*eslint comma-dangle: ["error", "always-multiline"]*/
Function render
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
let { getComponent, specSelectors, topbarActions } = this.props
const Link = getComponent("Link")
const TopbarInsert = getComponent("TopbarInsert")
const ImportFileMenuItem = getComponent("ImportFileMenuItem")
Function positionRangeForPath
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
export function positionRangeForPath(yaml, path) {
// Type check
if (typeof yaml !== "string") {
throw new TypeError("yaml should be a string")
- 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 pathForPosition
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function pathForPosition(yaml, position) {
// Type check
if (typeof yaml !== "string") {
throw new TypeError("yaml should be a string")
File topbar-insert.jsx
has 274 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React, { Component } from "react"
import PropTypes from "prop-types"
import { pathForm, pathObject } from "./forms/form-objects/path-object"
import { operationForm, operationObject } from "./forms/form-objects/operation-object"
Topbar
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
export default class Topbar extends React.Component {
constructor(props, context) {
super(props, context)
this.state = {
Function positionRangeForPath
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function positionRangeForPath(yaml, path) {
// Type check
if (typeof yaml !== "string") {
throw new TypeError("yaml should be a string")
Function checkForErrors
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const checkForErrors = (formData) => {
let errors = false
// Invalid object was provided.
if (!OrderedMap.isOrderedMap(formData) && !Map.isMap(formData)) {
Function validate2And3MinAndMax
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
export const validate2And3MinAndMax = () => (system) => {
return system.validateSelectors
.allSchemas()
.then(nodes => {
return nodes.reduce((acc, node) => {
- 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 condenseErrors
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function condenseErrors(errors) {
if (!Array.isArray(errors)) {
return []
}
Function render
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
let addedOption = <span />
const addButton = <a role="button" className="d-inline-block float-right" onClick={this.showAddField} onKeyDown={this.onEnterKeyPress} tabIndex={0}>Add</a>
if (this.props.isValidAddition) {
if (this.state.showAddOption) {