huridocs/uwazi

View on GitHub

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,
Severity: Minor
Found in app/react/V2/Routes/Settings/Thesauri/ThesaurusForm.tsx - About 55 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 updateLinks has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

const updateLinks = (
  formData: Link & { select?: string },
  currentLinks?: Link[],
  parentId?: string
) => {
Severity: Minor
Found in app/react/V2/Routes/Settings/MenuConfig/components/MenuForm.tsx - About 55 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 8 (exceeds 5 allowed). Consider refactoring.
Open

  render() {
    const { reference } = this.props;
    let itemClass = '';
    const disabled = this.props.targetDoc && typeof reference.reference === 'undefined';

Severity: Minor
Found in app/react/Viewer/components/Connection.js - About 45 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 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({
Severity: Minor
Found in app/react/V2/CustomHooks/useApiCaller.tsx - About 45 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 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;
Severity: Minor
Found in app/api/entities/entities.js - About 45 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 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
Severity: Minor
Found in app/react/Markdown/markdownDatasets.js - About 45 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 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[]
Severity: Minor
Found in app/react/Review/OneUpReview.tsx - About 45 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 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)) {
Severity: Minor
Found in app/api/entities.v2/model/Entity.ts - About 45 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

Avoid deeply nested control flow statements.
Open

          if (!openTokens) {
            if (
              str.slice(
                matchStartIndex - escapeCode.length - opener.length,
                matchStartIndex - opener.length
Severity: Major
Found in app/react/utils/markdownEscapedValues.js - About 45 mins to fix

    Function i18NMenuComponent has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    const i18NMenuComponent = ({
      languages: languageMap,
      i18nmode,
      user,
      locale,
    Severity: Minor
    Found in app/react/I18N/components/I18NMenu.tsx - About 45 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 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 }),
        ]);
    Severity: Minor
    Found in app/api/users/users.js - About 45 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 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);
    
    
    Severity: Minor
    Found in app/api/relationships/relationships.js - About 45 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 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':
    Severity: Minor
    Found in app/react/Markdown/components/EntitySection.tsx - About 45 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 getUpdatedNames has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    function getUpdatedNames(
      {
        prop,
        filterBy,
      }: {
    Severity: Minor
    Found in app/api/templates/utils.ts - About 45 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 Table has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    const Table = <T extends TableRow<T>>({
      columns,
      data,
      onChange,
      dnd,
    Severity: Minor
    Found in app/react/V2/Components/UI/Table/Table.tsx - About 45 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 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[] => {
    Severity: Minor
    Found in app/react/V2/Components/PDFViewer/functions/handleTextSelection.ts - About 45 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 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;
    Severity: Minor
    Found in app/react/Viewer/components/PageReferences.tsx - About 45 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 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
    Severity: Minor
    Found in app/api/search/search.js - About 45 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 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())) {
    Severity: Minor
    Found in app/api/topicclassification/api.ts - About 45 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 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(
    Severity: Minor
    Found in app/api/topicclassification/api.ts - About 45 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

    Severity
    Category
    Status
    Source
    Language