Lichess4545/Chesster

View on GitHub

Showing 173 of 173 total issues

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

export function parseScheduling(
    inputString: string,
    options: config.Scheduling
): SchedulingResult {
    const parts = getTokensScheduling(inputString)
Severity: Minor
Found in src/commands/scheduling.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 gameResult has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export function gameResult(
    status: GameStatus,
    winner?: GameWinner
): ResultsEnum {
    if (status === GameStatus.draw || status === GameStatus.stalemate) {
Severity: Minor
Found in src/lichess.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 schedulingReplyScheduled has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

    bot: SlackBot,
    message: LeagueCommandMessage,
    results: SchedulingResult,
    white: LeagueMember,
    black: LeagueMember,
Severity: Major
Found in src/commands/scheduling.ts - About 50 mins to fix

    Similar blocks of code found in 4 locations. Consider refactoring.
    Open

                scheduling: {
                    extrema: {
                        isoWeekday: 1,
                        hour: 11,
                        minute: 0,
    Severity: Major
    Found in config/config.js and 3 other locations - About 50 mins to fix
    config/config.js on lines 133..146
    config/config.js on lines 188..199
    config/config.js on lines 241..254

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 52.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 4 locations. Consider refactoring.
    Open

                scheduling: {
                    extrema: {
                        isoWeekday: 1,
                        hour: 22,
                        minute: 0,
    Severity: Major
    Found in config/config.js and 3 other locations - About 50 mins to fix
    config/config.js on lines 75..88
    config/config.js on lines 188..199
    config/config.js on lines 241..254

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 52.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 4 locations. Consider refactoring.
    Open

                scheduling: {
                    extrema: {
                        isoWeekday: 1,
                        hour: 17,
                        minute: 0,
    Severity: Major
    Found in config/config.js and 3 other locations - About 50 mins to fix
    config/config.js on lines 75..88
    config/config.js on lines 133..146
    config/config.js on lines 188..199

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 52.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 4 locations. Consider refactoring.
    Open

                scheduling: {
                    extrema: {
                        isoWeekday: 0,
                        hour: 0,
                        minute: 0,
    Severity: Major
    Found in config/config.js and 3 other locations - About 50 mins to fix
    config/config.js on lines 75..88
    config/config.js on lines 133..146
    config/config.js on lines 241..254

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 52.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

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

    export function unassignAlternate(
        bot: SlackBot,
        message: LeagueCommandMessage
    ) {
        const alternateOptions = message.league?.config.alternate
    Severity: Minor
    Found in src/commands/availability.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 resultFromString has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    function resultFromString(result: string | undefined): ResultsEnum {
        if (result === undefined) return ResultsEnum.UNKNOWN
        result = result.toLowerCase()
        if (result === '1-0') {
            return ResultsEnum.WHITE_WIN
    Severity: Minor
    Found in src/league.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

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    export const GameDetailsWithClockDecoder: Decoder<GameDetails> = andThen(
        BaseGameDetailsDecoder,
        (gameDetails) =>
            object(['clock', ClockDecoder], (clock) => ({ ...gameDetails, clock }))
    )
    Severity: Minor
    Found in src/lichess.ts and 1 other location - About 45 mins to fix
    src/config.ts on lines 220..227

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 50.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    export const LeagueWithAlternateDecoder: Decoder<League> = andThen(
        LeagueWithoutAlternateDecoder,
        (leagueWithoutAlternate) =>
            object(['alternate', AlternateDecoder], (alternate) => ({
                ...leagueWithoutAlternate,
    Severity: Minor
    Found in src/config.ts and 1 other location - About 45 mins to fix
    src/lichess.ts on lines 448..452

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 50.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    chesster.hears({
        type: 'command',
        patterns: [slack.appendPlayerRegex('pairing', true)],
        messageTypes: ['direct_mention', 'direct_message'],
        callback: playerInfo.playerPairings,
    Severity: Minor
    Found in src/chesster.ts and 1 other location - About 40 mins to fix
    src/chesster.ts on lines 160..165

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 49.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    chesster.hears({
        type: 'command',
        patterns: [slack.appendPlayerRegex('rating', true)],
        messageTypes: ['direct_mention', 'direct_message'],
        callback: playerInfo.playerRating,
    Severity: Minor
    Found in src/chesster.ts and 1 other location - About 40 mins to fix
    src/chesster.ts on lines 167..172

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 49.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Function replyMisunderstood has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        bot: SlackBot,
        message: CommandMessage,
        command: string,
        syntax: string,
        syntaxHints?: string
    Severity: Minor
    Found in src/commands/availability.ts - About 35 mins to fix

      Function schedulingReplyTooCloseToCutoff has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          bot: SlackBot,
          message: LeagueCommandMessage,
          schedulingOptions: config.Scheduling,
          white: LeagueMember,
          black: LeagueMember
      Severity: Minor
      Found in src/commands/scheduling.ts - About 35 mins to fix

        Function formatReplyUpdatedAvailability has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            bot: SlackBot,
            message: CommandMessage,
            playerName: string,
            available: boolean,
            roundNumber: number
        Severity: Minor
        Found in src/commands/availability.ts - About 35 mins to fix

          Function assignAlternate has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              heltourConfig: LeagueConfig,
              round: number,
              team: number,
              board: number,
              player: string
          Severity: Minor
          Found in src/heltour.ts - About 35 mins to fix

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

            export interface SlackUserListResponse extends WebAPICallResult {
                ok: boolean
                members: SlackUser[]
                cache_ts: number
                response_metadata: SlackResponseMetadata
            Severity: Minor
            Found in src/slack.ts and 1 other location - About 35 mins to fix
            src/slack.ts on lines 108..113

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 47.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

            export interface SlackChannelListResponse extends WebAPICallResult {
                ok: boolean
                channels: SlackChannel[]
                cache_ts: number
                response_metadata: SlackResponseMetadata
            Severity: Minor
            Found in src/slack.ts and 1 other location - About 35 mins to fix
            src/slack.ts on lines 67..72

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 47.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Function formatPairingResponse has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                formatPairingResponse(
                    requestingPlayer: LeagueMember,
                    details: PairingDetails
                ) {
                    let time
            Severity: Minor
            Found in src/league.ts - About 35 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