Showing 436 of 912 total issues
Function initialize
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.ui.MWLinkAnnotationInspector.prototype.initialize = function () {
// Properties
this.allowProtocolInInternal = false;
this.internalAnnotationInput = this.createInternalAnnotationInput();
this.externalAnnotationInput = this.createExternalAnnotationInput();
Function OoUiOutlineControlsWidget
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.ui.MWTransclusionOutlineControlsWidget = function OoUiOutlineControlsWidget() {
// Parent constructor
ve.ui.MWTransclusionOutlineControlsWidget.super.call( this );
// Mixin constructors
File ve.ui.MWCategoryWidget.js
has 265 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*!
* VisualEditor UserInterface MWCategoryWidget class.
*
* @copyright See AUTHORS.txt
* @license The MIT License (MIT); see LICENSE.txt
Function escapeParameter
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.dm.MWTransclusionNode.static.escapeParameter = function ( param ) {
let input = param,
output = '',
inNowiki = false,
bracketStack = 0,
Method onResourceLoaderGetConfigVars
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function onResourceLoaderGetConfigVars( array &$vars, $skin, Config $config ): void {
$coreConfig = RequestContext::getMain()->getConfig();
$services = MediaWikiServices::getInstance();
$veConfig = $services->getConfigFactory()->makeConfig( 'visualeditor' );
$extensionRegistry = ExtensionRegistry::getInstance();
Consider simplifying this complex logical expression. Open
if (
$isAvailable &&
$config->get( 'VisualEditorUseSingleEditTab' ) &&
(
$userOptionsLookup->getOption( $user, 'visualeditor-tabs' ) === 'prefer-ve' ||
Function saveFail
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.init.mw.ArticleTarget.prototype.saveFail = function ( doc, saveData, code, data ) {
this.pageDeletedWarning = false;
let handled = false;
// Handle empty response
Function VeUiMWWikitextSurface
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.ui.MWWikitextSurface = function VeUiMWWikitextSurface() {
// Parent constructor
ve.ui.MWWikitextSurface.super.apply( this, arguments );
// Initialization
Function restoreEditSection
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.init.mw.ArticleTarget.prototype.restoreEditSection = function () {
const section = this.section !== null ? this.section : this.visibleSection;
const surface = this.getSurface();
const mode = surface.getMode();
Function wrapLine
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
ve.ui.MWWikitextAction.prototype.wrapLine = function ( before, after, placeholder, unwrapOffsetsCallback ) {
let originalFragment = this.surface.getModel().getFragment( null, false, true /* excludeInsertions */ );
const selectedNodes = originalFragment.getLeafNodes();
let unwrapped = false;
- 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 swapPanel
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
ve.ui.MWSaveDialog.prototype.swapPanel = function ( panel, noFocus ) {
if ( ( [ 'save', 'review', 'preview', 'conflict' ].indexOf( panel ) ) === -1 ) {
throw new Error( 'Unknown saveDialog panel: ' + panel );
}
- 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 VeUiMWTemplatePage
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
ve.ui.MWTemplatePage = function VeUiMWTemplatePage( template, name, config ) {
const link = template.getTemplateDataQueryTitle();
// Configuration initialization
config = ve.extendObject( {
- 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 onSkinEditSectionLinks
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public function onSkinEditSectionLinks( $skin, $title, $section,
$tooltip, &$result, $lang
) {
$services = MediaWikiServices::getInstance();
$userOptionsLookup = $services->getUserOptionsLookup();
- 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 build
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.ui.MWTocWidget.prototype.build = function () {
const $newTocList = $( '<ul>' ),
nodes = this.doc.getNodesByType( 'mwHeading', true ),
surfaceView = this.surface.getView(),
documentView = surfaceView.getDocument(),
Function prepareCacheKey
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.init.mw.ArticleTarget.prototype.prepareCacheKey = function ( doc ) {
const start = ve.now();
if ( this.getSurface().getMode() === 'source' ) {
return;
File ve.init.mw.CollabTarget.init.js
has 258 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*!
* VisualEditor MediaWiki CollabTarget init.
*
* @copyright See AUTHORS.txt
* @license The MIT License (MIT); see LICENSE.txt
File ve.init.mw.MobileArticleTarget.js
has 257 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*!
* VisualEditor MediaWiki Initialization MobileArticleTarget class.
*
* @copyright See AUTHORS.txt
* @license The MIT License (MIT); see LICENSE.txt
Function getSetupProcess
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.ui.MWTemplateDialog.prototype.getSetupProcess = function ( data ) {
data = data || {};
return ve.ui.MWTemplateDialog.super.prototype.getSetupProcess.call( this, data )
.next( () => {
let promise;
Function VeUiMWMediaInfoFieldWidget
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
ve.ui.MWMediaInfoFieldWidget = function VeUiMWMediaInfoFieldWidget( content, config ) {
// Configuration initialization
config = config || {};
// Parent constructor
Function onReviewModeButtonSelectSelect
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
function onReviewModeButtonSelectSelect( item ) {
let oldPageName, newPageName;
if ( mw.config.get( 'wgCanonicalSpecialPageName' ) !== 'ComparePages' ) {
oldPageName = newPageName = mw.config.get( 'wgRelevantPageName' );
} else {