kalidea/kaligraphi

View on GitHub

Showing 148 of 148 total issues

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

    return this.overlay.position()
      .flexibleConnectedTo(this.elementRef)
      .withFlexibleDimensions(false)
      .withGrowAfterOpen(false)
      .withLockedPosition(true)
projects/kalidea/kaligraphi/src/lib/04-overlay/kal-menu/kal-menu-trigger-for.directive.ts on lines 94..104

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

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

    return this.overlay
      .position()
      .flexibleConnectedTo(this.elementRef)
      .withPush(true)
      .withFlexibleDimensions(false)
projects/kalidea/kaligraphi/src/lib/04-overlay/kal-loader/kal-loading.directive.ts on lines 107..111

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

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

  handleKeydown(event: KeyboardEvent) {
    const keyCode = event.keyCode;

    switch (keyCode) {
      case ESCAPE:

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

  selectTabHeader(tab: KalTabComponent, tabIndex: number, params = {emitEvent: true}) {
    if (!tab.disabled) {
      this.selectedTabIndex = tabIndex;
      this.keyManager.setActiveItem(this.selectedIndex);

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

  private updateOptionsList(expression = '') {
    if (this.autocompleteComponent) {
      let optionsList = this._optionsList;
      if ((expression || '').trim() !== '') {
        try {

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

  @HostListener('mouseleave')
  @HostListener('touchleave')
  hideTooltip(): void {
    if (this.overlayRef) {
      const instance: KalTooltipComponent = this.componentRef.instance;

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

  private static getDate(rawDate: KalDateType, format = 'dd/MM/yyyy'): Dayjs {
    let date: Dayjs;

    if (rawDate instanceof Date) {
      date = dayjs(rawDate);
Severity: Minor
Found in projects/kalidea/kaligraphi/src/lib/02-form/kal-datepicker/kal-date.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

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

  set selectionMode(value: KalListSelectionMode) {

    switch (value) {
      case KalListSelectionMode.Multiple:
      case KalListSelectionMode.None:

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

  get triggerValue(): string {
    if (!this.selection || this.selection.length === 0) {
      return null;
    }

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

  select(value: any, withNotify = false): void {
    if (this.isMultiple && value instanceof Array) {
      const multipleOptions = this.options.filter((item) => value.indexOf(item.value) >= 0);
      this.multipleOptionSelected(multipleOptions, withNotify);
    } else {

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

  @Memoize({
    resolver(targetHeight, positionsList) {
      return targetHeight + positionsList.sort().join('');
    }
  })

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

  set checked(value: boolean) {
    const isChecked = coerceBooleanProperty(value);

    if (this.isChecked !== isChecked) {

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

asterisks in jsdoc must be aligned
Open

 export class DumbComponent implements OnDestroy {

Rule: jsdoc-format

Enforces basic format rules for JSDoc comments.

The following rules are enforced for JSDoc comments (comments starting with /**):

  • each line contains an asterisk and asterisks must be aligned
  • each asterisk must be followed by either a space or a newline (except for the first and the last)
  • the only characters before the asterisk on each line must be whitespace characters
  • one line comments must start with /** and end with */
  • multiline comments don't allow text after /** in the first line (with option "check-multiline-start")
Rationale

Helps maintain a consistent, readable style for JSDoc comments.

Config

You can optionally specify the option "check-multiline-start" to enforce the first line of a multiline JSDoc comment to be empty.

Examples
"jsdoc-format": true
"jsdoc-format": true,check-multiline-start
Schema
{
  "type": "array",
  "minItems": 0,
  "maxItems": 1,
  "items": {
    "type": "string",
    "enum": [
      "check-multiline-start"
    ]
  }
}

For more information see this page.

A maximum of 1 class per file is allowed.
Open

@Component({
  selector: 'kal-tooltip',
  template: `
    <div
      [kalTheme]="theme"

Rule: max-classes-per-file

A file may not contain more than the specified number of classes

Rationale

Ensures that files have a single responsibility so that that classes each exist in their own files

Config

The one required argument is an integer indicating the maximum number of classes that can appear in a file. An optional argument "exclude-class-expressions" can be provided to exclude class expressions from the overall class count.

Examples
"max-classes-per-file": true,1
"max-classes-per-file": true,5,exclude-class-expressions
Schema
{
  "type": "array",
  "items": [
    {
      "type": "number",
      "minimum": 1
    },
    {
      "type": "string",
      "enum": [
        "exclude-class-expressions"
      ]
    }
  ],
  "additionalItems": false,
  "minLength": 1,
  "maxLength": 2
}

For more information see this page.

Expected property shorthand in object literal ('{exports}').
Open

  exports: exports,

Rule: object-literal-shorthand

Enforces/disallows use of ES6 object literal shorthand.

Notes
  • Has Fix

Config

"always" assumed to be default option, thus with no options provided the rule enforces object literal methods and properties shorthands. With "never" option provided, any shorthand object literal syntax causes an error.

The rule can be configured in a more granular way. With {"property": "never"} provided (which is equivalent to {"property": "never", "method": "always"}), the rule only flags property shorthand assignments, and respectively with {"method": "never"} (equivalent to {"property": "always", "method": "never"}), the rule fails only on method shorthands.

Examples
"object-literal-shorthand": true
"object-literal-shorthand": true,never
"object-literal-shorthand": true,[object Object]
Schema
{
  "oneOf": [
    {
      "type": "string",
      "enum": [
        "never"
      ]
    },
    {
      "type": "object",
      "properties": {
        "property": {
          "type": "string",
          "enum": [
            "never"
          ]
        },
        "method": {
          "type": "string",
          "enum": [
            "never"
          ]
        }
      },
      "minProperties": 1,
      "maxProperties": 2
    }
  ]
}

For more information see this page.

Don't use 'Function' as a type. Avoid using the Function type. Prefer a specific function type, like () => void.
Open

  on(eventName: string, callback: Function): void;

Rule: ban-types

Bans specific types from being used. Does not ban the corresponding runtime objects from being used.

Notes
  • TypeScript Only

Config

A list of ["regex", "optional explanation here"], which bans types that match regex

Examples
"ban-types": true,Object,Use {} instead.,String
Schema
{
  "type": "list",
  "listType": {
    "type": "array",
    "items": {
      "type": "string"
    },
    "minLength": 1,
    "maxLength": 2
  }
}

For more information see this page.

Expected property shorthand in object literal ('{exports}').
Open

  exports: exports,

Rule: object-literal-shorthand

Enforces/disallows use of ES6 object literal shorthand.

Notes
  • Has Fix

Config

"always" assumed to be default option, thus with no options provided the rule enforces object literal methods and properties shorthands. With "never" option provided, any shorthand object literal syntax causes an error.

The rule can be configured in a more granular way. With {"property": "never"} provided (which is equivalent to {"property": "never", "method": "always"}), the rule only flags property shorthand assignments, and respectively with {"method": "never"} (equivalent to {"property": "always", "method": "never"}), the rule fails only on method shorthands.

Examples
"object-literal-shorthand": true
"object-literal-shorthand": true,never
"object-literal-shorthand": true,[object Object]
Schema
{
  "oneOf": [
    {
      "type": "string",
      "enum": [
        "never"
      ]
    },
    {
      "type": "object",
      "properties": {
        "property": {
          "type": "string",
          "enum": [
            "never"
          ]
        },
        "method": {
          "type": "string",
          "enum": [
            "never"
          ]
        }
      },
      "minProperties": 1,
      "maxProperties": 2
    }
  ]
}

For more information see this page.

jsdoc is not formatted correctly on this line
Open

/** Evergreen browsers require these. **/
Severity: Minor
Found in src/polyfills.ts by tslint

Rule: jsdoc-format

Enforces basic format rules for JSDoc comments.

The following rules are enforced for JSDoc comments (comments starting with /**):

  • each line contains an asterisk and asterisks must be aligned
  • each asterisk must be followed by either a space or a newline (except for the first and the last)
  • the only characters before the asterisk on each line must be whitespace characters
  • one line comments must start with /** and end with */
  • multiline comments don't allow text after /** in the first line (with option "check-multiline-start")
Rationale

Helps maintain a consistent, readable style for JSDoc comments.

Config

You can optionally specify the option "check-multiline-start" to enforce the first line of a multiline JSDoc comment to be empty.

Examples
"jsdoc-format": true
"jsdoc-format": true,check-multiline-start
Schema
{
  "type": "array",
  "minItems": 0,
  "maxItems": 1,
  "items": {
    "type": "string",
    "enum": [
      "check-multiline-start"
    ]
  }
}

For more information see this page.

asterisks in jsdoc must be aligned
Open


Rule: jsdoc-format

Enforces basic format rules for JSDoc comments.

The following rules are enforced for JSDoc comments (comments starting with /**):

  • each line contains an asterisk and asterisks must be aligned
  • each asterisk must be followed by either a space or a newline (except for the first and the last)
  • the only characters before the asterisk on each line must be whitespace characters
  • one line comments must start with /** and end with */
  • multiline comments don't allow text after /** in the first line (with option "check-multiline-start")
Rationale

Helps maintain a consistent, readable style for JSDoc comments.

Config

You can optionally specify the option "check-multiline-start" to enforce the first line of a multiline JSDoc comment to be empty.

Examples
"jsdoc-format": true
"jsdoc-format": true,check-multiline-start
Schema
{
  "type": "array",
  "minItems": 0,
  "maxItems": 1,
  "items": {
    "type": "string",
    "enum": [
      "check-multiline-start"
    ]
  }
}

For more information see this page.

jsdoc is not formatted correctly on this line
Open

 ```

Rule: jsdoc-format

Enforces basic format rules for JSDoc comments.

The following rules are enforced for JSDoc comments (comments starting with /**):

  • each line contains an asterisk and asterisks must be aligned
  • each asterisk must be followed by either a space or a newline (except for the first and the last)
  • the only characters before the asterisk on each line must be whitespace characters
  • one line comments must start with /** and end with */
  • multiline comments don't allow text after /** in the first line (with option "check-multiline-start")
Rationale

Helps maintain a consistent, readable style for JSDoc comments.

Config

You can optionally specify the option "check-multiline-start" to enforce the first line of a multiline JSDoc comment to be empty.

Examples
"jsdoc-format": true
"jsdoc-format": true,check-multiline-start
Schema
{
  "type": "array",
  "minItems": 0,
  "maxItems": 1,
  "items": {
    "type": "string",
    "enum": [
      "check-multiline-start"
    ]
  }
}

For more information see this page.

Severity
Category
Status
Source
Language