Showing 179 of 3,635 total issues
Function RenderAttachment
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export const RenderAttachment = ({ attachment }: { attachment: AttachmentSchema | ClientFile }) => {
const { mimetype = '' } = attachment;
const fileURL = isSerializedFile(attachment) ? prepareHTMLMediaView(attachment) : attachment.url;
- 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 SortDropdownComponent
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
const SortDropdownComponent = ({ templates, locale }: mappedProps) => {
const [dropdownOpen, setDropdownOpen] = useState(false);
const menuRef = useRef(null);
const location = useLocation();
const [searchParams] = useSearchParams();
- 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 render
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
render() {
const {
doc,
docBeingEdited,
readOnly,
- 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 setAccessLevelAndPermissionData
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
async function setAccessLevelAndPermissionData(
grantedPermissions: { [p: string]: { permission: PermissionSchema; access: AccessLevels[] } },
entitiesPermissionsData: { permissions: PermissionSchema[] | undefined; published: boolean }[],
publishedData: boolean[]
) {
- 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 uploadQueue
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private async uploadQueue(files: File[], responses: (FileType | FetchResponseError)[]) {
if (this.aborted) {
this.aborted = false;
return;
}
- 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 FiltersTable
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
const FiltersTable = () => {
const { filters: loadedFilters = [], templates: loadedTemplates } = useLoaderData() as LoaderData;
const currentFilters = useRef(loadedFilters);
const [hasChanges, setHasChanges] = useState(false);
const [disabled, setDisabled] = 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 Customisation
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
const Customisation = () => {
const { allowcustomJS, customCSS, customJS } = useLoaderData() as LoaderResponse;
const [newCSS, setNewCSS] = useState<string | undefined>(undefined);
const [newJS, setNewJS] = useState<string | undefined>(undefined);
const [showModal, setShowModal] = 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 LMap
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
const LMap = ({
markers: pointMarkers = [],
showControls = true,
zoom = 6,
layers,
- 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
Consider simplifying this complex logical expression. Open
if (aggregation.buckets && aggregationKey !== '_types') {
const missingBucket = aggregation.buckets.find(b => b.key === 'missing');
const keyFilters = ((filters || {})[aggregationKey.replace('.value', '')] || {}).values || [];
const filterNoneOrMissing =
!keyFilters.filter(v => v !== 'any').length || keyFilters.find(v => v === 'missing');
Function render
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
render() {
const { doc } = this.props;
if (!doc.get('file')) {
return 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 extractedMetadataChanged
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
const extractedMetadataChanged = async (
existingEntity: EntitySchema,
newEntity: EntitySchema,
extractors: IXExtractorType[]
) => {
- 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 applyFilesOriginalnames
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
const applyFilesOriginalnames = (req: Request) => {
if (req.files) {
(req.files as Express.Multer.File[]).forEach(file => {
const fileField = getFieldAndIndex(file.fieldname);
if (fileField) {
- 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 MediaModalComponent
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
const MediaModalComponent = ({
isOpen,
attachments = [],
selectedUrl,
entity,
- 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 contextMenuReducer
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
export default function contextMenuReducer(state = initialState, action = {}) {
if (action.type === actions.OPEN_MENU) {
return state.set('open', true);
}
- 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 applyTransformation
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
applyTransformation(property, { doc, thesauri, options, template, templates }) {
const value = doc.metadata[property.get('name')];
const showInCard = property.get('showInCard');
if (property.get('inherit')) {
- 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 label
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
label(option: Option, isSelect = true) {
const { optionsValue, optionsLabel, prefix } = this.props;
const clickEvent = isSelect ? () => {} : this.toggleOptions.bind(this, option);
return (
<>
- 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 ConfirmationModal
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
const ConfirmationModal = ({
header,
body,
onAcceptClick,
onCancelClick,
- 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 removeDuplicationFromCollection
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
async removeDuplicationFromCollection(db: Db, collectionName: string) {
const collection = db.collection<Page | Entity>(collectionName);
const cursor = collection.find({});
const seenIndices: Set<string> = new Set();
const idsToRemove: ObjectId[] = [];
- 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 prepareRelationshipsToSave
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
async prepareRelationshipsToSave(_relationships, language) {
const rels = this.arrangeRelationshipGroups(_relationships);
const relsFlat = rels.flat();
await validateConnectionSchema(relsFlat);
- 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 filterToMatch
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
const filterToMatch = (filter, path = 'metadata') => {
let match;
if (['text', 'markdown', 'generatedid'].includes(filter.type)) {
match = textFilter(filter, path);
}
- 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"