huridocs/uwazi

View on GitHub

Showing 170 of 3,578 total issues

Function Table has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const Table = <T,>({
  columns,
  data,
  title,
  footer,
Severity: Minor
Found in app/react/V2/Components/UI/Table/Table.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 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 extendSelect has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const extendSelect = select => {
  if (!select) {
    return select;
  }
  if (typeof select === 'string') {
Severity: Minor
Found in app/api/entities/entities.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 referencesReducer has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export default function referencesReducer(state = initialState, action = {}) {
  if (action.type === types.SET_REFERENCES) {
    return Immutable.fromJS(action.references);
  }

Severity: Minor
Found in app/react/Viewer/reducers/referencesReducer.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 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 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 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 ProtectedRoute has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const ProtectedRoute = ({
  children,
  onlyAdmin,
}: {
  children: ReactElement;
Severity: Minor
Found in app/react/ProtectedRoute.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 ImportButton has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const ImportButton = ({
  onSuccess,
  onFailure,
  thesaurus,
}: {
Severity: Minor
Found in app/react/V2/Routes/Settings/Thesauri/components/ImportButton.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 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

Severity
Category
Status
Source
Language