uu-cubitt/commands

View on GitHub

Showing 37 of 37 total issues

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

export class SetModelPropertyCommand extends SetPropertyCommand {
    /**
     * @param id The RFC4122 v4 compliant ID of this command.
     * @param requestId The RFC4122 v4 compliant ID of the request that created this command.
     * @param sessionId The RFC4122 v4 compliant ID of the session that created this command.
Severity: Major
Found in src/commands/SetModelPropertyCommand.ts and 3 other locations - About 2 hrs to fix
src/commands/SetConnectorPropertyCommand.ts on lines 9..28
src/commands/SetEdgePropertyCommand.ts on lines 9..28
src/commands/SetNodePropertyCommand.ts on lines 9..28

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

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

export class DeleteConnectorPropertyCommand extends DeletePropertyCommand {
    /**
     * @param id The RFC4122 v4 compliant ID of this command.
     * @param requestId The RFC4122 v4 compliant ID of the request that created this command.
     * @param sessionId The RFC4122 v4 compliant ID of the session that created this command.
Severity: Major
Found in src/commands/DeleteConnectorPropertyCommand.ts and 3 other locations - About 2 hrs to fix
src/commands/DeleteEdgePropertyCommand.ts on lines 9..26
src/commands/DeleteModelPropertyCommand.ts on lines 9..26
src/commands/DeleteNodePropertyCommand.ts on lines 9..27

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

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

export class DeleteModelPropertyCommand extends DeletePropertyCommand {
    /**
     * @param id The RFC4122 v4 compliant ID of this command.
     * @param requestId The RFC4122 v4 compliant ID of the request that created this command.
     * @param sessionId The RFC4122 v4 compliant ID of the session that created this command.
Severity: Major
Found in src/commands/DeleteModelPropertyCommand.ts and 3 other locations - About 2 hrs to fix
src/commands/DeleteConnectorPropertyCommand.ts on lines 9..26
src/commands/DeleteEdgePropertyCommand.ts on lines 9..26
src/commands/DeleteNodePropertyCommand.ts on lines 9..27

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

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

export class DeleteNodePropertyCommand extends DeletePropertyCommand {
    /**
     * @param id The RFC4122 v4 compliant ID of this command.
     * @param requestId The RFC4122 v4 compliant ID of the request that created this command.
     * @param sessionId The RFC4122 v4 compliant ID of the session that created this command.
Severity: Major
Found in src/commands/DeleteNodePropertyCommand.ts and 3 other locations - About 2 hrs to fix
src/commands/DeleteConnectorPropertyCommand.ts on lines 9..26
src/commands/DeleteEdgePropertyCommand.ts on lines 9..26
src/commands/DeleteModelPropertyCommand.ts on lines 9..26

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

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

export class DeleteEdgePropertyCommand extends DeletePropertyCommand {
    /**
     * @param id The RFC4122 v4 compliant ID of this command.
     * @param requestId The RFC4122 v4 compliant ID of the request that created this command.
     * @param sessionId The RFC4122 v4 compliant ID of the session that created this command.
Severity: Major
Found in src/commands/DeleteEdgePropertyCommand.ts and 3 other locations - About 2 hrs to fix
src/commands/DeleteConnectorPropertyCommand.ts on lines 9..26
src/commands/DeleteModelPropertyCommand.ts on lines 9..26
src/commands/DeleteNodePropertyCommand.ts on lines 9..27

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

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

export class DeleteModelCommand extends DeleteCommand {
    /**
     * @param id The RFC4122 v4 compliant ID of this command.
     * @param requestId The RFC4122 v4 compliant ID of the request that created this command.
     * @param sessionId The RFC4122 v4 compliant ID of the session that created this command.
Severity: Major
Found in src/commands/DeleteModelCommand.ts and 3 other locations - About 2 hrs to fix
src/commands/DeleteConnectorCommand.ts on lines 9..24
src/commands/DeleteEdgeCommand.ts on lines 9..24
src/commands/DeleteNodeCommand.ts on lines 9..24

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

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

export class DeleteNodeCommand extends DeleteCommand {
    /**
     * @param id The RFC4122 v4 compliant ID of this command.
     * @param requestId The RFC4122 v4 compliant ID of the request that created this command.
     * @param sessionId The RFC4122 v4 compliant ID of the session that created this command.
Severity: Major
Found in src/commands/DeleteNodeCommand.ts and 3 other locations - About 2 hrs to fix
src/commands/DeleteConnectorCommand.ts on lines 9..24
src/commands/DeleteEdgeCommand.ts on lines 9..24
src/commands/DeleteModelCommand.ts on lines 9..25

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

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

export class DeleteConnectorCommand extends DeleteCommand {
    /**
     * @param id The RFC4122 v4 compliant ID of this command.
     * @param requestId The RFC4122 v4 compliant ID of the request that created this command.
     * @param sessionId The RFC4122 v4 compliant ID of the session that created this command.
Severity: Major
Found in src/commands/DeleteConnectorCommand.ts and 3 other locations - About 2 hrs to fix
src/commands/DeleteEdgeCommand.ts on lines 9..24
src/commands/DeleteModelCommand.ts on lines 9..25
src/commands/DeleteNodeCommand.ts on lines 9..24

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

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

export class DeleteEdgeCommand extends DeleteCommand {
    /**
     * @param id The RFC4122 v4 compliant ID of this command.
     * @param requestId The RFC4122 v4 compliant ID of the request that created this command.
     * @param sessionId The RFC4122 v4 compliant ID of the session that created this command.
Severity: Major
Found in src/commands/DeleteEdgeCommand.ts and 3 other locations - About 2 hrs to fix
src/commands/DeleteConnectorCommand.ts on lines 9..24
src/commands/DeleteModelCommand.ts on lines 9..25
src/commands/DeleteNodeCommand.ts on lines 9..24

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

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

    public static parse(jsonObject: Object): Command {
        if (typeof(jsonObject) === "undefined" || jsonObject === null) {
            throw new Error("COMMAND ERROR: Empty object cannot be parsed.");
        }
        let typeString: string = jsonObject["type"];
Severity: Minor
Found in src/CommandFactory.ts - About 1 hr to fix

    Function getCommandType has 36 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected static getCommandType(type: string): CommandType {
            switch (type) {
                case "AddConnectorCommand":
                    return CommandType.AddConnector;
                case "AddEdgeCommand":
    Severity: Minor
    Found in src/CommandFactory.ts - About 1 hr to fix

      Function validateObject has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          protected static validateObject(object: Object, keysWithType: Common.Dictionary<ValidationType>): void {
              for (let key in keysWithType) {
                  let type: ValidationType = keysWithType[key];
                  let val: any = object[key];
                  if (typeof(val) === "undefined") {
      Severity: Minor
      Found in src/CommandFactory.ts - About 1 hr 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

          constructor(
              id: Common.Guid,
              requestId: Common.Guid,
              sessionId: Common.Guid,
              type: CommandType,
      Severity: Minor
      Found in src/commands/SetPropertyCommand.ts and 1 other location - About 35 mins to fix
      src/commands/AddCommand.ts on lines 33..46

      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

          constructor(
              id: Common.Guid,
              requestId: Common.Guid,
              sessionId: Common.Guid,
              type: CommandType,
      Severity: Minor
      Found in src/commands/AddCommand.ts and 1 other location - About 35 mins to fix
      src/commands/SetPropertyCommand.ts on lines 33..46

      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

      Line length
      Open

      The commands provide all basic graph operations, such as addition and removal of nodes, edges, models and connectors.
      Severity: Info
      Found in README.md by markdownlint

      MD013 - Line length

      Tags: line_length

      Aliases: line-length Parameters: linelength, codeblocks, tables (number; default 80, boolean; default true)

      This rule is triggered when there are lines that are longer than the configured line length (default: 80 characters). To fix this, split the line up into multiple lines.

      This rule has an exception where there is no whitespace beyond the configured line length. This allows you to still include items such as long URLs without being forced to break them in the middle.

      You also have the option to exclude this rule for code blocks and tables. To do this, set the code_blocks and/or tables parameters to false.

      Code blocks are included in this rule by default since it is often a requirement for document readability, and tentatively compatible with code rules. Still, some languages do not lend themselves to short lines.

      Line length
      Open

      This library contains the commands available for editing the Cubitt Graph, they are handled by the command handler.
      Severity: Info
      Found in README.md by markdownlint

      MD013 - Line length

      Tags: line_length

      Aliases: line-length Parameters: linelength, codeblocks, tables (number; default 80, boolean; default true)

      This rule is triggered when there are lines that are longer than the configured line length (default: 80 characters). To fix this, split the line up into multiple lines.

      This rule has an exception where there is no whitespace beyond the configured line length. This allows you to still include items such as long URLs without being forced to break them in the middle.

      You also have the option to exclude this rule for code blocks and tables. To do this, set the code_blocks and/or tables parameters to false.

      Code blocks are included in this rule by default since it is often a requirement for document readability, and tentatively compatible with code rules. Still, some languages do not lend themselves to short lines.

      Line length
      Open

      For more information about the CQRS implementation of the Cubitt Graph, please take a look [here](https://uu-cubitt.github.io/).
      Severity: Info
      Found in README.md by markdownlint

      MD013 - Line length

      Tags: line_length

      Aliases: line-length Parameters: linelength, codeblocks, tables (number; default 80, boolean; default true)

      This rule is triggered when there are lines that are longer than the configured line length (default: 80 characters). To fix this, split the line up into multiple lines.

      This rule has an exception where there is no whitespace beyond the configured line length. This allows you to still include items such as long URLs without being forced to break them in the middle.

      You also have the option to exclude this rule for code blocks and tables. To do this, set the code_blocks and/or tables parameters to false.

      Code blocks are included in this rule by default since it is often a requirement for document readability, and tentatively compatible with code rules. Still, some languages do not lend themselves to short lines.

      Severity
      Category
      Status
      Source
      Language