Showing 108 of 274 total issues
Function execute
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
Open
public function execute() {
// Avoid local configuration leaking to this script
if ( $this->getConfig()->get( MainConfigNames::ExtraLanguageNames ) !== [] ) {
$this->fatalError( 'You have entries in $wgExtraLanguageNames. Needs to be empty for this script.' );
}
- 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 launchULS
has 94 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function launchULS( $trigger, languagesObject, forCLS ) {
var ulsConfig = {
/**
* Language selection handler
*
Function normalizeBoundaries
has 87 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
normalizeBoundaries: function() {
assertRangeValid(this);
var sc = this.startContainer, so = this.startOffset, ec = this.endContainer, eo = this.endOffset;
File jquery.uls.core.js
has 310 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/**
* Universal Language Selector
* ULS core component.
*
* Copyright (C) 2012 Alolita Sharma, Amir Aharoni, Arun Ganesh, Brandon Harris,
Function getTextRangeBoundaryPosition
has 83 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var getTextRangeBoundaryPosition = function(textRange, wholeRangeContainerElement, isStart, isCollapsed, startInfo) {
var workingRange = textRange.duplicate();
workingRange.collapse(isStart);
var containerElement = workingRange.parentElement();
File vai-transliteration.js
has 298 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
( function ( $ ) {
'use strict';
var vaiTransliteration = {
id: 'vai-transliteration',
Function prepareLanguages
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
prepareLanguages: function () {
var $loginCta,
displaySettings = this,
SUGGESTED_LANGUAGES_NUMBER = 3,
anonsAllowed = mw.config.get( 'wgULSAnonCanChangeLanguage' ),
File jquery.webfonts.js
has 291 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/**
* jQuery Webfonts.
*
* Copyright (C) 2012 Santhosh Thottingal
*
Function initPersonalEntryPoint
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function initPersonalEntryPoint() {
var $trigger = $( '.uls-trigger' );
var clickHandler;
if ( !userCanChangeLanguage() ) {
Function showUndoTooltip
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function showUndoTooltip( previousLang, previousAutonym ) {
var trigger, popup, popupPosition,
configPosition = mw.config.get( 'wgULSPosition' ),
triggerSelector = ( configPosition === 'interlanguage' ) ?
'.uls-settings-trigger, .mw-interlanguage-selector' :
Function listen
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
listen: function () {
var imeselector = this;
imeselector.$imeSetting.on( 'click.ime', function ( e ) {
var $t = $( e.target );
File bo-ewts.js
has 273 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
( function ( $ ) {
'use strict';
var boEWTS = {
id: 'bo-ewts',
Function position
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
position: function () {
var menuWidth, menuTop, menuLeft, elementPosition,
top, left, cssTop, cssLeft, verticalRoom, overflowsOnRight,
imeSelector = this,
rtlElement = this.$element.css( 'direction' ) === 'rtl',
Function prepareMoreLanguages
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
prepareMoreLanguages: function () {
var inputSettings = this,
$languages, $moreLanguagesButton;
$languages = this.$template.find( '.uls-ui-languages' );
Function prepareLanguages
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
prepareLanguages: function () {
var inputSettings = this,
SUGGESTED_LANGUAGES_NUMBER = 3,
selectedImeLanguage = $.ime.preferences.getLanguage(),
languagesForButtons, $languages, suggestedLanguages,
Function listen
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
listen: function () {
var displaySettings = this,
$contentFontSelector = this.$template.find( '#content-font-selector' ),
$uiFontSelector = this.$template.find( '#ui-font-selector' ),
$tabButtons = displaySettings.$template.find( '.uls-display-settings-tab-switcher button' );
Function parse
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
parse: function() {
var webfonts = this,
// Fonts can be added indirectly via classes, but also with
// style attributes. For lang attributes we will use our font
// if they don't have explicit font already.
Function getCSS
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
getCSS: function( fontFamily, variant ) {
var webfonts, base,
fontFaceRule, userAgent, fontStyle, fontFormats, fullFontName,
fontconfig = this.repository.get( fontFamily );
Function execute
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
Open
public function execute() {
$base = dirname( __DIR__ );
$relpath = '../data/fontrepo/fonts';
$compiler = new FontRepoCompiler( "$base/data/fontrepo/fonts", $relpath );
- 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
Method execute
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function execute() {
$base = dirname( __DIR__ );
$relpath = '../data/fontrepo/fonts';
$compiler = new FontRepoCompiler( "$base/data/fontrepo/fonts", $relpath );