Showing 108 of 274 total issues
Function prepareInputmethods
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
prepareInputmethods: function ( language ) {
var index, inputSettings, $imeListContainer, defaultInputmethod,
imes, selected, imeId, $imeListTitle;
imes = $.ime.languages[ language ];
Function autofill
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
autofill: function ( langCode, languageName ) {
var autonym, userInput, suggestion;
if ( !this.$suggestion.length ) {
return;
Function createBoundaryTextRange
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
var createBoundaryTextRange = function(boundaryPosition, isStart) {
var boundaryNode, boundaryParent, boundaryOffset = boundaryPosition.offset;
var doc = dom.getDocument(boundaryPosition.node);
var workingNode, childNodes, workingRange = getBody(doc).createTextRange();
var nodeIsDataNode = isCharacterDataNode(boundaryPosition.node);
Method levenshteinDistance
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function levenshteinDistance( $str1, $str2 ) {
if ( $str1 === $str2 ) {
return 0;
}
$length1 = mb_strlen( $str1, 'UTF-8' );
Function createLanguageFilter
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
createLanguageFilter: function () {
var lcd, languagesCount,
columnsOptions = {
wide: 4,
medium: 2,
Function append
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
append: function ( langCode, regionCode ) {
var i, regions;
if ( !$.uls.data.languages[ langCode ] ) {
// Language is unknown or not in the list of languages for this context.
Consider simplifying this complex logical expression. Open
if (comparison == -1 && boundaryNode && isCharacterDataNode(boundaryNode)) {
// This is a character data node (text, comment, cdata). The working range is collapsed at the start of
// the node containing the text range's boundary, so we move the end of the working range to the
// boundary point and measure the length of its text to get the boundary's offset within the node.
workingRange.setEndPoint(isStart ? "EndToStart" : "EndToEnd", textRange);
Function appendLanguages
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function appendLanguages( &$languages, $fontLanguages, $fontname ) {
foreach ( $fontLanguages as $rcode ) {
$code = str_replace( '*', '', $rcode );
if ( !isset( $languages[$code] ) ) {
- Read upRead up
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 onBeforePageDisplay
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function onBeforePageDisplay( $out, $skin ): void {
$unsupportedSkins = [ 'minerva', 'apioutput' ];
if ( in_array( $skin->getSkinName(), $unsupportedSkins, true ) ) {
return;
}
- Read upRead up
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
Avoid deeply nested control flow statements. Open
if (ec == sibling) {
ec = sc;
eo += sc.length;
}
Avoid deeply nested control flow statements. Open
if (addRangeBackwardToNative) {
addRangeBackwardToNative(sel, originalSelectionRanges[i]);
} else {
api.warn("Rangy initialization: original selection was backwards but selection has been restored forwards because the browser does not support Selection.extend");
sel.addRange(originalSelectionRanges[i]);
Avoid deeply nested control flow statements. Open
if (selectionSupportsMultipleRanges) {
previousRangeCount = this.rangeCount;
} else {
this.removeAllRanges();
previousRangeCount = 0;
Avoid deeply nested control flow statements. Open
if (controlRange.length) {
doc = getDocument( controlRange.item(0) );
}
Avoid deeply nested control flow statements. Open
for (var i = 0, len = sel.rangeCount; i < len; ++i) {
sel._ranges[i] = new api.WrappedRange(sel.nativeSelection.getRangeAt(i));
}
Avoid deeply nested control flow statements. Open
if (this.rangeCount == previousRangeCount + 1) {
// The range was added successfully
// Check whether the range that we added to the selection is reflected in the last range extracted from
// the selection
Avoid deeply nested control flow statements. Open
if ( previousInputMethods[ 0 ] ) {
this.selectIM( previousInputMethods[ 0 ] );
} else {
// Provide the default input method in this case.
firstInputmethod =
Function onSkinAfterPortlet
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function onSkinAfterPortlet( $skin, $name, &$content ) {
if ( $name !== 'lang' ) {
return;
}
- Read upRead up
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 updateBoundaries
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function updateBoundaries(range, startContainer, startOffset, endContainer, endOffset) {
Function getTextRangeBoundaryPosition
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
var getTextRangeBoundaryPosition = function(textRange, wholeRangeContainerElement, isStart, isCollapsed, startInfo) {
Function updateNativeRange
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function updateNativeRange(range, startContainer, startOffset, endContainer, endOffset) {