Showing 170 of 3,578 total issues
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
Function FiltersSidepanel
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
const FiltersSidepanel = ({
showSidepanel,
setShowSidepanel,
onSave,
availableTemplates,
- 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
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 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 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"
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 getFilesForTraining
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
async function getFilesForTraining(templates: ObjectIdSchema[], property: string) {
const propertyType = await getPropertyType(templates, property);
const entities = await entitiesModel.getUnrestricted(
entityForTrainingQuery(templates, property, propertyType),
`sharedId metadata.${property} language`
- 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 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 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 MenuConfig
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
const MenuConfig = () => {
const links = useLoaderData() as ClientSettingsLinkSchema[];
const [isSidepanelOpen, setIsSidepanelOpen] = useState(false);
const setNotifications = useSetAtom(notificationAtom);
const revalidator = useRevalidator();
- 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 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 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 limitRelationshipResults
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const limitRelationshipResults = (results, entitySharedId, hubsLimit) => {
const hubs = conformRelationships(results.rows, entitySharedId).toJS();
results.totalHubs = hubs.length;
results.requestedHubs = Number(hubsLimit);
- 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 (!openTokens) {
if (
str.slice(
matchStartIndex - escapeCode.length - opener.length,
matchStartIndex - opener.length
Function validateHeader
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const validateHeader = async (file: ImportFile, options: ValidateHeaderOptions) => {
const headerOptions = options.required_headers || options.column_number;
if (!headerOptions) return;
const header = await peekHeaders(await file.readStream());
- 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 requestDatasets
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const requestDatasets = (datasets, requestParams) =>
Promise.all(
Object.keys(datasets).map(name => {
if (datasets[name].query) {
return api
- 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 startTraining
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export async function startTraining(thesaurus: ThesaurusSchema) {
if (!(await IsTopicClassificationReachable())) {
throw new Error(`Topic Classification server is unreachable (waited ${RPC_DEADLINE_MS} ms)`);
}
const flattenValues = thesaurus.values!.reduce(
- 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"