Showing 24 of 67 total issues
File theme.js
has 539 lines of code (exceeds 250 allowed). Consider refactoring. Open
/**
* Uses preset bootstrap as a basis
* https://github.com/system-ui/theme-ui/blob/develop/packages/preset-bootstrap/src/index.ts
*/
File index.js
has 520 lines of code (exceeds 250 allowed). Consider refactoring. Open
const punctuationStripper = require('../punctuationStripper')
module.exports = (item) => {
const currentSource = dataLookUp[item.sourceSystem.toLowerCase()]
return Object.entries(currentSource).map(([id, data]) => {
File makeMetadataArray.js
has 491 lines of code (exceeds 250 allowed). Consider refactoring. Open
const punctuationStripper = require('./punctuationStripper')
module.exports = (standardJson) => {
const currentSource = dataLookUp[standardJson.sourceSystem.toLowerCase()]
return Object.entries(currentSource).map(([id, data]) => {
File makeMetadataArray.js
has 489 lines of code (exceeds 250 allowed). Consider refactoring. Open
const path = require('path')
const punctuationStripper = require(path.join(__dirname, 'punctuationStripper'))
module.exports = (standardJson) => {
const currentSource = dataLookUp[standardJson.sourceSystem.toLowerCase()]
Function SeoContent
has 118 lines of code (exceeds 50 allowed). Consider refactoring. Open
export const SeoContent = (props) => {
const {
thumbnail,
title,
author,
Function exports
has 109 lines of code (exceeds 50 allowed). Consider refactoring. Open
module.exports = (itemId, website, childrenNextToken) => {
return `{
getItem(id: "${itemId}", websiteId: "${website}") {
TYPE
access
File api.js
has 266 lines of code (exceeds 250 allowed). Consider refactoring. Open
import typy from 'typy'
import { encode, decode } from 'js-base64'
export const savePortfolioUser = ({ user, loginReducer }) => {
const query = JSON.stringify({
Function TombstoneMetadata
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
const TombstoneMetadata = ({ marbleItem }) => {
const creators = filterForLabledField(marbleItem, 'Creator')
const dates = filterForLabledField(marbleItem, 'Date')
const campusLocations = filterForLabledField(marbleItem, 'Campus Location')
const uriValue = filterForLabledField(marbleItem, 'URI Value')
- 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 12 (exceeds 5 allowed). Consider refactoring. Open
module.exports = (item) => {
if (item) {
// some fields may not be null when there is no defaultImage so check the two we care about
if (item.defaultImage && item.defaultImage.mediaServer && item.defaultImage.mediaResourceId) {
const iiifImage = getIiif(item.defaultImage)
- 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 SchemaJsonLd
has 60 lines of code (exceeds 50 allowed). Consider refactoring. Open
export const SchemaJsonLd = (props) => {
const {
thumbnail,
pathname,
title,
Function HitResult
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
const HitResult = ({ hit, referal, loginReducer }) => {
const {
name,
creator,
date,
- 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 sourceNodes
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
exports.sourceNodes = async (
gatsbyInternal,
pluginOptions,
) => {
const { url, key, website, itemList, useFixtures = false, updateFixtures = false, debug = false } = pluginOptions
- 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 52 lines of code (exceeds 50 allowed). Consider refactoring. Open
module.exports = (parent, child) => {
const mergedObject = {
sequence: 0,
}
Function exports
has 51 lines of code (exceeds 50 allowed). Consider refactoring. Open
module.exports = async (item, pluginOptions) => {
const { timePeriodCutoff } = pluginOptions
const dateData = realDatesFromCatalogedDates(item.createdDate, timePeriodCutoff)
const creators = getCreators(item)
const themes = getKeywordsFromSubjects(item)
Function crawlStandardJson
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
const crawlStandardJson = (standardJson, collection, parent, gatsbyInternal) => {
const { actions, createNodeId, createContentDigest } = gatsbyInternal
const { createNode, createParentChildLink } = actions
const nodeId = createNodeId(standardJson.id)
if (standardJson.level && standardJson.level.toLowerCase() === 'file') {
- 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 NDBrandLayout
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const NDBrandLayout = ({ location, variant, children, pageHeader, siteFooter, titleOverride }) => {
const { menusJson } = useStaticQuery(query)
const menu = typy(menusJson, 'items').safeArray
const [showMenu, setShowMenu] = useState(false)
- 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 findImage
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export const findImage = (images, marbleItem, thumbnail = false) => {
// the default image if it exists
let returnImage = findDefaultImage(marbleItem, thumbnail)
// check the child images if default image returned null and was assigned a "no image" image
- 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 AlternateImage
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export const AlternateImage = ({
allMarbleFile,
marbleItem,
index,
max,
- 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 getArrayNeighbors
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const getArrayNeighbors = (arr, index, numberBeforeAndAfter) => {
const length = arr.length
// If array is shorter than requested number of siblings, return original array minus the item at the current index
if (length <= (2 * numberBeforeAndAfter) + 1) {
return arr.filter((item, 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
Avoid too many return
statements within this function. Open
return 'Rare Books & Special Collections'