Showing 179 of 3,635 total issues
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 getOrCreate
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
static getOrCreate(name: string, type: string) {
let task = this.taskInstances[name];
if (!task || ['done', 'failed'].includes(task.status.state)) {
const TaskClass = this.taskClasses[type];
if (!TaskClass) {
- 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 getFieldError
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const getFieldError = (field: 'username' | 'password' | 'email', type?: string) => {
if (field === 'username') {
switch (type) {
case 'required':
return 'Username is required';
- 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 OCRStatus
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const OCRStatus = ({ file, ocrIsToggled, locale, loadDocument }: ComponentProps) => {
if (!ocrIsToggled) return null;
const [ocrStatus, setOcrStatus] = useState({ status: 'loading', lastUpdated: Date.now() });
- 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 dndSortHandler
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const dndSortHandler = <T extends TableRow<T>>({
currentState,
dataIds,
activeId,
overId,
- 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 IXSuggestionsLoader
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
(headers?: IncomingHttpHeaders): LoaderFunction =>
async ({ params: { extractorId }, request }) => {
if (!extractorId) throw new Error('extractorId is required');
const searchParams = new URLSearchParams(request.url.split('?')[1]);
const filter: any = { extractorId };
- 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 RelationshipTypes
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const RelationshipTypes = () => {
const relationshipTypes = useLoaderData() as Relationships[];
const revalidator = useRevalidator();
const [isSidepanelOpen, setIsSidepanelOpen] = 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 MenuForm
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const MenuForm = ({ closePanel, submit, linkToEdit, links = [] }: MenuFormProps) => {
const groups = useRef<OptionSchema[]>([
{ label: t('System', 'No Group', 'No Group', false), value: '', key: '-' },
]);
- 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 UserFormSidepanel
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const UserFormSidepanel = ({
showSidepanel,
setShowSidepanel,
setSelected,
selectedUser,
- 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 EditThesaurus
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const EditThesaurus = () => {
const navigate = useNavigate();
const thesaurus = useLoaderData() as ClientThesaurus;
const templates = useAtomValue(templatesAtom);
const [showNavigationModal, setShowNavigationModal] = 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 TwoFactorSetup
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const TwoFactorSetup = ({ closePanel, isOpen }: TwoFactorSetupProps) => {
const [token, setToken] = useState('');
const [_secret, setSecret] = useState('');
const [_otpauth, setOtpauth] = useState('');
const setNotifications = useSetAtom(notificationAtom);
- 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 (entity && entity.template) {
entity.metadata = entity.metadata || {};
const template = _templates.find(t => t._id.toString() === entity.template.toString());
const relationshipProperties = template.properties.filter(p => p.type === 'relationship');
Consider simplifying this complex logical expression. Open
if (
labeledValue ||
(propertyIsSelect(propertyType) && currentValue) ||
(propertyIsMultiValued(propertyType) &&
Array.isArray(currentValue) &&
Consider simplifying this complex logical expression. Open
if (!scriptIsPresent.current) {
const script = document.createElement('script');
const hasUserMatomo = Boolean(id && url);
const hasGlobalMatomo = Boolean(globalUrl && globalId);
Consider simplifying this complex logical expression. Open
if (
doc &&
doc.sharedId &&
doc.language &&
doc._id &&
Function getThesauriTranslations
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const getThesauriTranslations = async (db: Db) => {
const translationsCollection = db.collection<Translation>('translationsV2');
const translationsCursor = translationsCollection.find({ 'context.type': 'Thesaurus' });
while (await translationsCursor.hasNext()) {
const translation = await translationsCursor.next();
- 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 permissionsFilters
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export const permissionsFilters = (query: SearchQuery) => {
const user = permissionsContext.getUserInContext();
const publishedFilter = query.filter?.hasOwnProperty('published');
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 render
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
render() {
const {
model,
template,
templateOptions,
- 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 filterIsEmpty
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function filterIsEmpty(value) {
if (value && value.values && !value.values.length) {
return 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 singleUpload
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
(type?: FileType['type'], tmpStorage: multer.StorageEngine = defaultStorage) =>
async (req: Request, res: Response, next: NextFunction) => {
try {
await new Promise<void>((resolve, reject) => {
multer({ storage: tmpStorage }).single('file')(req, res, err => {
- 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"