Passed
Push — master ( 3d5c82...a8ac22 )
by Michael
02:17
created

script/plugins/Menu/MenuItems/TCellMergeMenuItemDispatcher.js   A

Complexity

Total Complexity 4
Complexity/F 2

Size

Lines of Code 22
Function Count 2

Duplication

Duplicated Lines 22
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 0
eloc 14
nc 1
dl 22
loc 22
rs 10
c 1
b 0
f 0
wmc 4
mnd 1
bc 3
fnc 2
bpm 1.5
cpm 2
noi 1

2 Functions

Rating   Name   Duplication   Size   Complexity  
A TCellMergeMenuItemDispatcher.js ➔ getMenuItem 11 11 2
A TCellMergeMenuItemDispatcher.js ➔ isAvailable 3 3 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1 View Code Duplication
import { mergeCells } from 'prosemirror-tables';
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
2
import AbstractMenuItemDispatcher from './AbstractMenuItemDispatcher';
3
import { svgIcon } from '../MDI';
4
import MenuItem from '../MenuItem';
5
6
export default class TCellMergeMenuItemDispatcher extends AbstractMenuItemDispatcher {
7
    static isAvailable(schema) {
8
        return !!schema.nodes.table;
9
    }
10
11
    static getMenuItem(schema) {
12
        if (!this.isAvailable(schema)) {
13
            throw new Error('Table not available in schema!');
14
        }
15
16
        return new MenuItem({
17
            command: mergeCells,
18
            icon: svgIcon('table-merge-cells'),
19
            label: LANG.plugins.prosemirror['label:table-cell-merge'],
0 ignored issues
show
Bug introduced by
The variable LANG seems to be never declared. If this is a global, consider adding a /** global: LANG */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
20
        });
21
    }
22
}
23