Showing 3,439 of 3,635 total issues
Function translateCustomFilter
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const translateCustomFilter = (customFilter: SuggestionCustomFilter) => {
const orFilters = [];
if (customFilter.labeled) orFilters.push(filterFragments.labeled);
if (customFilter.nonLabeled) orFilters.push(filterFragments.nonLabeled);
if (customFilter.match) orFilters.push(filterFragments.match);
- 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 ValueItem
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
(hiddenColumns: PropertySchema[], isOpen: boolean, closeFunction: () => void) => () => (
<span className="columns-hint" onClick={closeFunction}>
{isOpen ? <Icon icon="times" /> : <Icon icon="bars" rotation={90} />}
{hiddenColumns.length ? `${hiddenColumns.length} ` : ''}
<Translate>{hiddenColumns.length ? 'columns hidden' : 'Hide columns'}</Translate>
- 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 nestedTranslationContextDBO
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
(idMapper: idMapperFunction) =>
(label?: string, type?: TranslationDBO['context']['type']): TranslationDBO['context'] => ({
id: label ? idMapper(label).toString() : 'System',
type: label ? type || 'Thesaurus' : 'Uwazi UI',
label: label || 'User Interface',
- 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 sortOnlyAggregates
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
sortOnlyAggregates(options: Option[]) {
const { optionsLabel } = this.props;
if (!options.length || typeof options[0].results === 'undefined') {
return options;
}
- 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 mockSuperAgent
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const mockSuperAgent = (response?: any, err?: any) => {
// eslint-disable-next-line @typescript-eslint/promise-function-async
jest.spyOn(mockUpload, 'catch').mockImplementation(cb => {
if (!cb) throw new Error('mock upload catch cb is not a function');
if (err) cb(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"
Further reading
Function MultiSelect
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const MultiSelect = ({
label,
options,
disabled,
hasErrors,
- 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 parseDatasets
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const parseDatasets = markdown => {
const result = {};
const parser = new HTMLParser(
{
onopentag(name, attribs) {
- 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 extractSearchParams
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
async function extractSearchParams(query: SearchQuery) {
const templates = await templatesModel.get();
const uniqueProperties = (propertiesHelper.allUniqueProperties(templates) as PropertySchema[])
.map(prop =>
['text', 'markdown', 'generatedid'].includes(prop.type)
- 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 prepareValue
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const prepareValue = (
value: MediaFieldProps['value'],
localAttachments: MediaFieldProps['localAttachments']
) => {
const valueString = getValue(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 multiselectFilter
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const multiselectFilter = (filter, path = 'metadata') => {
const filterValue = filter.value;
const { values = [] } = filterValue;
let match;
if (values.includes('any')) {
- 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 6 (exceeds 5 allowed). Consider refactoring. Open
render() {
let toggle = this.props.open ? this.props.hideFilters : this.props.showFilters;
let activeClass = this.props.open ? ' is-active' : '';
if (this.props.open && this.props.metadataPanelIsOpen) {
- 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 fallbackPrettifier
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const fallbackPrettifier = (error, req) => {
const url = req.originalUrl ? `\nurl: ${req.originalUrl}` : '';
const body =
req.body && Object.keys(req.body).length
? `\nbody: ${JSON.stringify(req.body, 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 processResults
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const processResults = async (message: ResultsMessage): Promise<void> => {
await tenants.run(async () => {
try {
const [originalFile] = await files.get({ filename: message.params!.filename });
const [record] = await getForSourceFile(originalFile);
- 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 DropdownMenu
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const DropdownMenu = ({ link, position, hideMobileMenu }: DropdownMenuProps) => {
const [showing, setShowing] = useState(false);
const dropdownRef = useRef(null);
const onClickOutside = useCallback(() => {
setShowing(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 CustomUploads
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const CustomUploads = () => {
const files = useLoaderData() as CustomUpload[];
const setNotifications = useSetAtom(notificationAtom);
const revalidator = useRevalidator();
const [selectedRows, setSelectedRows] = useState<CustomUpload[]>([]);
- 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 EditFileSidepanel
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const EditFileSidepanel = ({ showSidepanel, closeSidepanel, file }: EditFileSidepanelProps) => {
const { name, extension } = getFileNameAndExtension(file?.originalname);
const revalidator = useRevalidator();
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
Function confirmAndSaveTemplate
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
confirmAndSaveTemplate(
template: TemplateSchema,
confirmationKey: 'templateConflict' | 'largeNumberOfEntities'
) {
return this.props.mainContext.confirm({
- 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 statusColor
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const statusColor = (suggestion: TableSuggestion): Color => {
if (!suggestion.isChild && (!suggestion.suggestedValue || suggestion.suggestedValue === '')) {
return 'red';
}
- 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
Definition for rule 'node/no-restricted-import' was not found. Open
import passport from 'passport';
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Definition for rule 'node/no-restricted-import' was not found. Open
import db from 'api/utils/testing_db';
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/