opf/openproject

View on GitHub
frontend/src/app/shared/components/searchable-project-list/searchable-project-list.service.ts

Summary

Maintainability
C
1 day
Test Coverage

Function selectPreviousResult has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

  private selectPreviousResult(activeID:ID|null, allProjects:IProjectData[]):void {
    if (activeID === null) {
      return;
    }

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 selectNextResult has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

  private selectNextResult(activeID:ID|null, allProjects:IProjectData[]):void {
    if (activeID === null) {
      return;
    }

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 selectPreviousResult has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  private selectPreviousResult(activeID:ID|null, allProjects:IProjectData[]):void {
    if (activeID === null) {
      return;
    }

    Function selectNextResult has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      private selectNextResult(activeID:ID|null, allProjects:IProjectData[]):void {
        if (activeID === null) {
          return;
        }
    
    

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

        public resetActiveResult(projects:IProjectData[]):void {
          const findFirstNonDisabledID = (projects:IProjectData[]):ID|null => {
            for (let i = 0; i < projects.length; i++) {
              if (!projects[i].disabled) {
                return projects[i].id;

      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 too many return statements within this function.
      Open

            return null;

        Avoid too many return statements within this function.
        Open

              return null;

          There are no issues that match your filters.

          Category
          Status