| Total Complexity | 3 |
| Complexity/F | 1.5 |
| Lines of Code | 58 |
| Function Count | 2 |
| Duplicated Lines | 50 |
| Ratio | 86.21 % |
| Changes | 0 | ||
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 | /** |
||
| 4 | (function (factory) { |
||
| 5 | if (typeof define === 'function' && define.amd) { |
||
|
|
|||
| 6 | // AMD. Register as an anonymous module. |
||
| 7 | define('bootstrap.wysihtml5.en-US', ['jquery', 'bootstrap.wysihtml5'], factory); |
||
| 8 | } else { |
||
| 9 | // Browser globals |
||
| 10 | factory(jQuery); |
||
| 11 | } |
||
| 12 | View Code Duplication | }(function ($) { |
|
| 13 | $.fn.wysihtml5.locale.en = $.fn.wysihtml5.locale['en-US'] = { |
||
| 14 | font_styles: { |
||
| 15 | normal: 'Normal text', |
||
| 16 | h1: 'Heading 1', |
||
| 17 | h2: 'Heading 2', |
||
| 18 | h3: 'Heading 3', |
||
| 19 | h4: 'Heading 4', |
||
| 20 | h5: 'Heading 5', |
||
| 21 | h6: 'Heading 6' |
||
| 22 | }, |
||
| 23 | emphasis: { |
||
| 24 | bold: 'Bold', |
||
| 25 | italic: 'Italic', |
||
| 26 | underline: 'Underline', |
||
| 27 | small: 'Small' |
||
| 28 | }, |
||
| 29 | lists: { |
||
| 30 | unordered: 'Unordered list', |
||
| 31 | ordered: 'Ordered list', |
||
| 32 | outdent: 'Outdent', |
||
| 33 | indent: 'Indent' |
||
| 34 | }, |
||
| 35 | link: { |
||
| 36 | insert: 'Insert link', |
||
| 37 | cancel: 'Cancel', |
||
| 38 | target: 'Open link in new window' |
||
| 39 | }, |
||
| 40 | image: { |
||
| 41 | insert: 'Insert image', |
||
| 42 | cancel: 'Cancel' |
||
| 43 | }, |
||
| 44 | html: { |
||
| 45 | edit: 'Edit HTML' |
||
| 46 | }, |
||
| 47 | colours: { |
||
| 48 | black: 'Black', |
||
| 49 | silver: 'Silver', |
||
| 50 | gray: 'Grey', |
||
| 51 | maroon: 'Maroon', |
||
| 52 | red: 'Red', |
||
| 53 | purple: 'Purple', |
||
| 54 | green: 'Green', |
||
| 55 | olive: 'Olive', |
||
| 56 | navy: 'Navy', |
||
| 57 | blue: 'Blue', |
||
| 58 | orange: 'Orange' |
||
| 59 | } |
||
| 60 | }; |
||
| 61 | })); |
||
| 62 |
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.