Showing 179 of 3,635 total issues
Function ThesaurusForm
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
const ThesaurusForm = ({
thesaurus,
thesaurusValues,
form,
edit,
- 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 updateLinks
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
const updateLinks = (
formData: Link & { select?: string },
currentLinks?: Link[],
parentId?: 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 render
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
render() {
const { reference } = this.props;
let itemClass = '';
const disabled = this.props.targetDoc && typeof reference.reference === 'undefined';
- 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 useApiCaller
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const useApiCaller = () => {
const setNotifications = useSetAtom(notificationAtom);
const handleSuccess = async (res: Response, successMessageComponent: React.ReactNode) => {
setNotifications({
- 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 save
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
async save(_doc, { user, language }, options = {}) {
const { updateRelationships = true, index = true, includeDocuments = true } = options;
await validateEntity(_doc);
await saveSelections(_doc);
const doc = _doc;
- 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 buildInitialOneUpState
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function buildInitialOneUpState(
documentsRequest: RequestParams<{ filters: any }>,
numDocuments: number,
thesauri: ThesaurusSchema[],
templates: TemplateSchema[]
- 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 setPropertyValue
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
setPropertyValue(property: Property, value: string) {
if (property.type === 'text' || property.type === 'markdown') {
const isTitleProperty = property instanceof CommonProperty && property.name === 'title';
const { metadata } = this;
if (!(property instanceof CommonProperty)) {
- 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 i18NMenuComponent
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const i18NMenuComponent = ({
languages: languageMap,
i18nmode,
user,
locale,
- 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 newUser
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
async newUser(user, domain) {
const [userNameMatch, emailMatch] = await Promise.all([
model.get({ username: user.username }),
model.get({ email: user.email }),
]);
- 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
Function getPropertyValue
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const getPropertyValue = (property: any, metadataProperty: any) => {
switch (property.type) {
case 'multiselect':
case 'multidaterange':
case 'nested':
- 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 getUpdatedNames
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function getUpdatedNames(
{
prop,
filterBy,
}: {
- 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 Table
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const Table = <T extends TableRow<T>>({
columns,
data,
onChange,
dnd,
- 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 updateFileSelection
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const updateFileSelection = (
property: { name: string; id?: string },
currentSelections?: ExtractedMetadataSchema[],
newSelection?: TextSelection
): ExtractedMetadataSchema[] => {
- 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 groupByRectangle
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
references =>
references.reduce((groups, reference) => {
if (!groups) return [];
if (reference?.get('template') || !reference) return groups;
- 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 groupAndLimitBuckets
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const groupAndLimitBuckets = (buckets, dictionary, _limit) => {
const aggregationBucketsByKey = objectIndex(
buckets,
b => b.key,
b => b
- 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 sendSample
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
async function sendSample(
model: string,
request: ClassifyRequest
): Promise<ClassifyResponse | null> {
if (!(await IsTopicClassificationReachable())) {
- 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"