BookStackApp/BookStack

View on GitHub
resources/js/wysiwyg/ui/defaults/buttons/tables.ts

Summary

Maintainability
F
1 wk
Test Coverage

File tables.ts has 370 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import {EditorBasicButtonDefinition, EditorButtonDefinition} from "../../framework/buttons";
import tableIcon from "@icons/editor/table.svg";
import deleteIcon from "@icons/editor/table-delete.svg";
import deleteColumnIcon from "@icons/editor/table-delete-column.svg";
import deleteRowIcon from "@icons/editor/table-delete-row.svg";
Severity: Minor
Found in resources/js/wysiwyg/ui/defaults/buttons/tables.ts - About 4 hrs to fix

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

    export const resizeTableToContents: EditorButtonDefinition = {
        label: 'Resize to contents',
        format: 'long',
        action(context: EditorUiContext) {
            context.editor.update(() => {
    Severity: Major
    Found in resources/js/wysiwyg/ui/defaults/buttons/tables.ts and 1 other location - About 4 hrs to fix
    resources/js/wysiwyg/ui/defaults/buttons/tables.ts on lines 66..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 131.

    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 clearTableFormatting: EditorButtonDefinition = {
        label: 'Clear table formatting',
        format: 'long',
        action(context: EditorUiContext) {
            context.editor.update(() => {
    Severity: Major
    Found in resources/js/wysiwyg/ui/defaults/buttons/tables.ts and 1 other location - About 4 hrs to fix
    resources/js/wysiwyg/ui/defaults/buttons/tables.ts on lines 86..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 131.

    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 const pasteRowAfter: EditorButtonDefinition = {
        label: 'Paste row after',
        format: 'long',
        action(context: EditorUiContext) {
            context.editor.update(() => {
    Severity: Major
    Found in resources/js/wysiwyg/ui/defaults/buttons/tables.ts and 3 other locations - About 4 hrs to fix
    resources/js/wysiwyg/ui/defaults/buttons/tables.ts on lines 213..227
    resources/js/wysiwyg/ui/defaults/buttons/tables.ts on lines 277..291
    resources/js/wysiwyg/ui/defaults/buttons/tables.ts on lines 293..307

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

    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 const pasteColumnBefore: EditorButtonDefinition = {
        label: 'Paste column before',
        format: 'long',
        action(context: EditorUiContext) {
            context.editor.update(() => {
    Severity: Major
    Found in resources/js/wysiwyg/ui/defaults/buttons/tables.ts and 3 other locations - About 4 hrs to fix
    resources/js/wysiwyg/ui/defaults/buttons/tables.ts on lines 213..227
    resources/js/wysiwyg/ui/defaults/buttons/tables.ts on lines 229..243
    resources/js/wysiwyg/ui/defaults/buttons/tables.ts on lines 293..307

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

    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 const pasteColumnAfter: EditorButtonDefinition = {
        label: 'Paste column after',
        format: 'long',
        action(context: EditorUiContext) {
            context.editor.update(() => {
    Severity: Major
    Found in resources/js/wysiwyg/ui/defaults/buttons/tables.ts and 3 other locations - About 4 hrs to fix
    resources/js/wysiwyg/ui/defaults/buttons/tables.ts on lines 213..227
    resources/js/wysiwyg/ui/defaults/buttons/tables.ts on lines 229..243
    resources/js/wysiwyg/ui/defaults/buttons/tables.ts on lines 277..291

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

    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 const pasteRowBefore: EditorButtonDefinition = {
        label: 'Paste row before',
        format: 'long',
        action(context: EditorUiContext) {
            context.editor.update(() => {
    Severity: Major
    Found in resources/js/wysiwyg/ui/defaults/buttons/tables.ts and 3 other locations - About 4 hrs to fix
    resources/js/wysiwyg/ui/defaults/buttons/tables.ts on lines 229..243
    resources/js/wysiwyg/ui/defaults/buttons/tables.ts on lines 277..291
    resources/js/wysiwyg/ui/defaults/buttons/tables.ts on lines 293..307

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

    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 copyColumn: EditorButtonDefinition = {
        label: 'Copy column',
        format: 'long',
        action(context: EditorUiContext) {
            context.editor.getEditorState().read(() => {
    Severity: Major
    Found in resources/js/wysiwyg/ui/defaults/buttons/tables.ts and 1 other location - About 3 hrs to fix
    resources/js/wysiwyg/ui/defaults/buttons/tables.ts on lines 197..211

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

    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 copyRow: EditorButtonDefinition = {
        label: 'Copy row',
        format: 'long',
        action(context: EditorUiContext) {
            context.editor.getEditorState().read(() => {
    Severity: Major
    Found in resources/js/wysiwyg/ui/defaults/buttons/tables.ts and 1 other location - About 3 hrs to fix
    resources/js/wysiwyg/ui/defaults/buttons/tables.ts on lines 261..275

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

    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 cutRow: EditorButtonDefinition = {
        label: 'Cut row',
        format: 'long',
        action(context: EditorUiContext) {
            context.editor.update(() => {
    Severity: Major
    Found in resources/js/wysiwyg/ui/defaults/buttons/tables.ts and 1 other location - About 3 hrs to fix
    resources/js/wysiwyg/ui/defaults/buttons/tables.ts on lines 245..259

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

    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 cutColumn: EditorButtonDefinition = {
        label: 'Cut column',
        format: 'long',
        action(context: EditorUiContext) {
            context.editor.update(() => {
    Severity: Major
    Found in resources/js/wysiwyg/ui/defaults/buttons/tables.ts and 1 other location - About 3 hrs to fix
    resources/js/wysiwyg/ui/defaults/buttons/tables.ts on lines 181..195

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

    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 insertColumnBefore: EditorButtonDefinition = {
        label: 'Insert column before',
        icon: insertColumnBeforeIcon,
        action(context: EditorUiContext) {
            context.editor.update(() => {
    Severity: Major
    Found in resources/js/wysiwyg/ui/defaults/buttons/tables.ts and 1 other location - About 2 hrs to fix
    resources/js/wysiwyg/ui/defaults/buttons/tables.ts on lines 322..333

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

    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 insertColumnAfter: EditorButtonDefinition = {
        label: 'Insert column after',
        icon: insertColumnAfterIcon,
        action(context: EditorUiContext) {
            context.editor.update(() => {
    Severity: Major
    Found in resources/js/wysiwyg/ui/defaults/buttons/tables.ts and 1 other location - About 2 hrs to fix
    resources/js/wysiwyg/ui/defaults/buttons/tables.ts on lines 309..320

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

    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 insertRowAbove: EditorButtonDefinition = {
        label: 'Insert row before',
        icon: insertRowAboveIcon,
        action(context: EditorUiContext) {
            context.editor.update(() => {
    Severity: Major
    Found in resources/js/wysiwyg/ui/defaults/buttons/tables.ts and 1 other location - About 2 hrs to fix
    resources/js/wysiwyg/ui/defaults/buttons/tables.ts on lines 142..152

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

    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 insertRowBelow: EditorButtonDefinition = {
        label: 'Insert row after',
        icon: insertRowBelowIcon,
        action(context: EditorUiContext) {
            context.editor.update(() => {
    Severity: Major
    Found in resources/js/wysiwyg/ui/defaults/buttons/tables.ts and 1 other location - About 2 hrs to fix
    resources/js/wysiwyg/ui/defaults/buttons/tables.ts on lines 130..140

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

    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

    There are no issues that match your filters.

    Category
    Status