open-learning-exchange/planet

View on GitHub

Showing 44 of 280 total issues

Function generatePDF has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  generatePDF() {
    const formattedBirthDate = format(new Date(this.user.birthDate), 'MMM d, y, h:mm:ss a');
    let contentArray = [
      {
        text: `${`${this.user.firstName}'s achievements`}`,
Severity: Minor
Found in src/app/users/users-achievements/users-achievements.component.ts - 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 chat has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

export async function chat(data: any, stream?: boolean, callback?: (response: string) => void): Promise<{
  completionText: string;
  couchSaveResponse: DocumentInsertResponse;
} | undefined> {
  const { content, ...dbData } = data;
Severity: Minor
Found in chatapi/src/services/chat.service.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 findDocuments has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

export function findDocuments(selectors, fields: any = 0, sort: any = 0, limit = 1000, skip = 0) {
Severity: Minor
Found in src/app/shared/mangoQueries.ts - About 35 mins to fix

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

    export async function aiChatNonStream(
      messages: ChatMessage[],
      aiProvider: AIProvider
    ): Promise<string> {
      const provider = providers[aiProvider.name];
    Severity: Minor
    Found in chatapi/src/utils/chat-helpers.utils.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

    Severity
    Category
    Status
    Source
    Language