iniquitybbs/iniquity

View on GitHub

Showing 45 of 45 total issues

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

export class Update implements yargs.CommandModule {
    public command = "server [action]"
    public describe = "Control your iniquity bbs server."

    public builder = (yargs: yargs.Argv) => {
Severity: Major
Found in packages/iniquity/src/commands/update.ts and 1 other location - About 3 days to fix
packages/iniquity/src/commands/server.ts on lines 61..162

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 664.

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 class Server implements yargs.CommandModule {
    public command = "server [action]"
    public describe = "Control your iniquity bbs server."

    public builder = (yargs: yargs.Argv) => {
Severity: Major
Found in packages/iniquity/src/commands/server.ts and 1 other location - About 3 days to fix
packages/iniquity/src/commands/update.ts on lines 61..162

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 664.

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

File index.ts has 867 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * Iniquity Core
 * @module Core
 * @summary This is the Iniquity core bbs library. It's the foundation of any Iniquity application.
 * @example
Severity: Major
Found in packages/core/src/index.ts - About 2 days to fix

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

            this.data.observe("message", () => {
                const box = { width: 40, height: 5 }
    
                const frame = this.frame({
                    x: (this.terminfo.x - box.width) / 2,
    Severity: Major
    Found in packages/core/src/modules/answer.ts and 1 other location - About 1 day to fix
    packages/core/src/modules/wfc.ts on lines 19..35

    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 195.

    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

            this.data.observe("message", () => {
                const box = { width: 40, height: 5 }
    
                const frame = this.frame({
                    x: (this.terminfo.x - box.width) / 2,
    Severity: Major
    Found in packages/core/src/modules/wfc.ts and 1 other location - About 1 day to fix
    packages/core/src/modules/answer.ts on lines 24..40

    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 195.

    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

                if (argv.template === "eternity") {
                    copyfiles([path.join(__dirname, "../../../../templates/src/eternity/*"), "."], { up: true, all: true }, (err) => {})
                    copyfiles([path.join(__dirname, "../../../../templates/src/eternity/.iniquity/*"), ".iniquity"], { up: true, all: true }, (err) => {})
                    copyfiles([path.join(__dirname, "../../../../templates/src/eternity/.vscode/*"), ".vscode"], { up: true, all: true }, (err) => {})
                    copyfiles([path.join(__dirname, "../../../../templates/src/euphoria/assets/*"), "assets"], { up: true, all: true }, (err) => {})
    Severity: Major
    Found in packages/iniquity/src/commands/init.ts and 1 other location - About 6 hrs to fix
    packages/iniquity/src/commands/init.ts on lines 86..91

    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 167.

    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

                if (argv.template === "euphoria") {
                    copyfiles([path.join(__dirname, "../../../../templates/src/euphoria/*"), "."], { up: true, all: true }, (err) => {})
                    copyfiles([path.join(__dirname, "../../../../templates/src/euphoria/.iniquity/*"), ".iniquity"], { up: true, all: true }, (err) => {})
                    copyfiles([path.join(__dirname, "../../../../templates/src/euphoria/.vscode/*"), ".vscode"], { up: true, all: true }, (err) => {})
                    copyfiles([path.join(__dirname, "../../../../templates/src/euphoria/assets/*"), "assets"], { up: true, all: true }, (err) => {})
    Severity: Major
    Found in packages/iniquity/src/commands/init.ts and 1 other location - About 6 hrs to fix
    packages/iniquity/src/commands/init.ts on lines 79..84

    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 167.

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

    export const Promise = function (
        this: any,
        executor: {
            (resolve: any, reject: any): void
            (resolve: any, reject: any): void
    Severity: Minor
    Found in packages/core/src/pollyfills.ts - About 2 hrs 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 color has 71 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    String.prototype.color = function (color: string): string {
        switch (color) {
            // 16 colors...
            case "black":
                return "\u001b[30m" + this
    Severity: Major
    Found in packages/core/src/index.ts - About 2 hrs to fix

      Function render has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

          render(options?: IQArtworkRenderOptions): IQArtworkRenderFunctions {
              if (options?.clearScreenBefore === true) console.putmsg("@POFF@@CLS@@PON@".color("reset"))
      
              const basepath = options?.basepath ?? this.basepath
              const filename = options?.filename ?? this.filename ?? new Error("I need to know what file to display!")
      Severity: Minor
      Found in packages/core/src/index.ts - About 2 hrs 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

      Identical blocks of code found in 3 locations. Consider refactoring.
      Open

              return {
                  pause(options?: IQPauseOptions): void {
                      pause(options)
                  },
                  wait(options?: IQWaitOptions): void {
      Severity: Major
      Found in packages/core/src/index.ts and 2 other locations - About 2 hrs to fix
      packages/core/src/index.ts on lines 428..438
      packages/core/src/index.ts on lines 1155..1165

      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 86.

      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

          function resolve(value: any) {
              if (_this.state !== "pending") return
      
              _this.state = "resolved"
              _this.value = value
      Severity: Major
      Found in packages/core/src/pollyfills.ts and 1 other location - About 2 hrs to fix
      packages/core/src/pollyfills.ts on lines 58..65

      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 86.

      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

      Identical blocks of code found in 3 locations. Consider refactoring.
      Open

          return {
              pause(options?: IQPauseOptions): void {
                  pause(options)
              },
              wait(options?: IQWaitOptions): void {
      Severity: Major
      Found in packages/core/src/index.ts and 2 other locations - About 2 hrs to fix
      packages/core/src/index.ts on lines 400..410
      packages/core/src/index.ts on lines 428..438

      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 86.

      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

          function reject(reason: any) {
              if (_this.state !== "pending") return
      
              _this.state = "rejected"
              _this.value = reason
      Severity: Major
      Found in packages/core/src/pollyfills.ts and 1 other location - About 2 hrs to fix
      packages/core/src/pollyfills.ts on lines 45..52

      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 86.

      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

      Identical blocks of code found in 3 locations. Consider refactoring.
      Open

              return {
                  pause(options?: IQPauseOptions): void {
                      pause(options)
                  },
                  wait(options?: IQWaitOptions): void {
      Severity: Major
      Found in packages/core/src/index.ts and 2 other locations - About 2 hrs to fix
      packages/core/src/index.ts on lines 400..410
      packages/core/src/index.ts on lines 1155..1165

      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 86.

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

          render(options?: IQArtworkRenderOptions): IQArtworkRenderFunctions {
              if (options?.clearScreenBefore === true) console.putmsg("@POFF@@CLS@@PON@".color("reset"))
      
              const basepath = options?.basepath ?? this.basepath
              const filename = options?.filename ?? this.filename ?? new Error("I need to know what file to display!")
      Severity: Major
      Found in packages/core/src/index.ts - About 2 hrs to fix

        Function start has 58 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            @IQModuleRuntime({
                debug: true
            })
            start() {
                /** Observe changes to "message" and react */
        Severity: Major
        Found in packages/core/src/modules/answer.ts - About 2 hrs to fix

          Function handler has 58 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public handler(argv: yargs.Arguments) {
                  if (argv.install || argv.watch) {
                      if (fs.existsSync(".iniquity")) {
                          process.chdir(".iniquity")
          
          
          Severity: Major
          Found in packages/iniquity/src/commands/update.ts - About 2 hrs to fix

            Function handler has 58 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public handler(argv: yargs.Arguments) {
                    if (argv.install || argv.watch) {
                        if (fs.existsSync(".iniquity")) {
                            process.chdir(".iniquity")
            
            
            Severity: Major
            Found in packages/iniquity/src/commands/server.ts - About 2 hrs to fix

              Function start has 57 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  @IQ.Decorators.ModuleRuntime({ debug: true })
                  start() {
                      this.data.observe("message", () => {
                          const box = { width: 40, height: 5 }
              
              
              Severity: Major
              Found in packages/core/src/modules/wfc.ts - About 2 hrs to fix
                Severity
                Category
                Status
                Source
                Language