Showing 30 of 81 total issues
File wikiLove.js
has 565 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* eslint-disable no-jquery/no-global-selector */
const overlayContainer = document.createElement( 'div' );
const WikiLoveDialog = require( './WikiLoveDialog.vue' );
const Vue = require( 'vue' );
let options = {}, // options modifiable by the user
File defaultOptions.js
has 412 lines of code (exceeds 250 allowed). Consider refactoring. Open
// See https://www.mediawiki.org/wiki/Extension:WikiLove for basic documentation on configuration.
module.exports = {
defaultText:
'{| style="background-color: $5; border: 1px solid $6;"\n' +
Function showGallery
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
showGallery: function () {
let i, id, index, loadingIndex, galleryNumber, $img;
const titles = [];
const imageList = currentTypeOrSubtype.gallery.imageList.slice();
Method execute
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function execute() {
$params = $this->extractRequestParams();
// In some cases we need the wiki mark-up stripped from the subject
$strippedSubject = $this->parserFactory->getInstance()->stripSectionName( $params['subject'] );
Function openDialog
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
openDialog: function ( recipients, extraTags ) {
let type, typeId, $button;
// If a list of recipients are specified, this will override the normal
// behavior of WikiLove, which is to post on the Talk page of the
// current page. It will also disable redirecting the user after submitting.
Function doSend
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
doSend: function ( subject, wikitext, message, type, email, extraTags ) {
let targetBaseUrl, currentBaseUrl,
wikiLoveNumberAttempted = 0,
wikiLoveNumberPosted = 0;
Function validatePreviewForm
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
validatePreviewForm: function ( e ) {
let imageTitle;
e.preventDefault();
$( '#mw-wikilove-success' ).hide();
- 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 validatePreviewForm
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
validatePreviewForm: function ( e ) {
let imageTitle;
e.preventDefault();
$( '#mw-wikilove-success' ).hide();
Function rememberInputData
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
rememberInputData: function () {
if ( rememberData === null ) {
rememberData = {
header: '',
title: '',
- 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 openDialog
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
openDialog: function ( recipients, extraTags ) {
let type, typeId, $button;
// If a list of recipients are specified, this will override the normal
// behavior of WikiLove, which is to post on the Talk page of the
// current page. It will also disable redirecting the user after submitting.
- 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 updateAllDetails
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
updateAllDetails: function () {
// use remembered data for fields that can be set by the user
const currentRememberData = {
header: ( currentTypeOrSubtype.fields.indexOf( 'header' ) !== -1 ? rememberData.header : '' ),
title: ( currentTypeOrSubtype.fields.indexOf( 'title' ) !== -1 ? rememberData.title : '' ),
Function updateAllDetails
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
updateAllDetails: function () {
// use remembered data for fields that can be set by the user
const currentRememberData = {
header: ( currentTypeOrSubtype.fields.indexOf( 'header' ) !== -1 ? rememberData.header : '' ),
title: ( currentTypeOrSubtype.fields.indexOf( 'title' ) !== -1 ? rememberData.title : '' ),
- 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 showImagePreview
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
showImagePreview: function () {
let $img;
const title = $.wikiLove.normalizeFilename( currentTypeOrSubtype.image );
const loadingType = currentTypeOrSubtype;
$( '#mw-wikilove-image-preview' ).show();
Function clickType
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
clickType: function ( e ) {
let subtypeId, subtype;
const newTypeId = $( this ).data( 'typeId' );
e.preventDefault();
Function exports
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function ( grunt ) {
grunt.loadNpmTasks( 'grunt-eslint' );
grunt.loadNpmTasks( 'grunt-banana-checker' );
grunt.loadNpmTasks( 'grunt-stylelint' );
Function clickType
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
clickType: function ( e ) {
let subtypeId, subtype;
const newTypeId = $( this ).data( 'typeId' );
e.preventDefault();
- 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 getAllowedParams
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getAllowedParams() {
return [
'title' => [
ParamValidator::PARAM_TYPE => 'string',
ParamValidator::PARAM_REQUIRED => true,
Function rememberInputData
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
rememberInputData: function () {
if ( rememberData === null ) {
rememberData = {
header: '',
title: '',
Method onLoadExtensionSchemaUpdates
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function onLoadExtensionSchemaUpdates( $updater ) {
$dbType = $updater->getDB()->getType();
$path = dirname( __DIR__ ) . '/patches';
if ( $dbType === 'mysql' ) {
$updater->addExtensionTable( 'wikilove_log',
Function submitSend
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
submitSend: function ( e ) {
e.preventDefault();
$( '#mw-wikilove-success' ).hide();
$( '#mw-wikilove-dialog' ).find( '.mw-wikilove-error' ).remove();