huridocs/uwazi

View on GitHub

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);
Severity: Minor
Found in app/api/suggestions/pipelineStages.ts - About 25 mins to fix

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>
Severity: Minor
Found in app/react/Library/components/HiddenColumnsDropdownItem.tsx - About 25 mins to fix

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',
Severity: Minor
Found in app/api/common.v2/testing/fixturesFactory.ts - About 25 mins to fix

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;
    }
Severity: Minor
Found in app/react/Forms/components/MultiSelect.tsx - About 25 mins to fix

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);
Severity: Minor
Found in app/react/Library/actions/specs/exportActions.spec.ts - About 25 mins to fix

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,
Severity: Minor
Found in app/react/V2/Components/Forms/MultiSelect.tsx - About 25 mins to fix

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) {
Severity: Minor
Found in app/react/Markdown/markdownDatasets.js - About 25 mins to fix

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)
Severity: Minor
Found in app/api/search.v2/queryHelpers.ts - About 25 mins to fix

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);
Severity: Minor
Found in app/react/Forms/components/MediaField.tsx - About 25 mins to fix

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')) {
Severity: Minor
Found in app/api/search/metadataMatchers.js - About 25 mins to fix

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) {
Severity: Minor
Found in app/react/Library/components/SearchButton.js - About 25 mins to fix

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, ' ')}`
Severity: Minor
Found in app/api/utils/handleError.js - About 25 mins to fix

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);
Severity: Minor
Found in app/api/services/ocr/OcrManager.ts - About 25 mins to fix

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);
Severity: Minor
Found in app/react/App/DropdownMenu.tsx - About 25 mins to fix

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[]>([]);
Severity: Minor
Found in app/react/V2/Routes/Settings/CustomUploads/CustomUploads.tsx - About 25 mins to fix

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);

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({
Severity: Minor
Found in app/react/Templates/components/MetadataTemplate.tsx - About 25 mins to fix

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';
  }

Severity: Minor
Found in app/react/V2/Routes/Settings/IX/components/TableElements.tsx - About 25 mins to fix

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';
Severity: Minor
Found in app/api/auth/passport_conf.js by eslint

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';

For more information visit Source: http://eslint.org/docs/rules/

Severity
Category
Status
Source
Language