wikimedia/mediawiki-extensions-VisualEditor

View on GitHub

Showing 436 of 912 total issues

Method transformHTML has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

        PageIdentity $page,
        Bcp47Code $targetLanguage,
        string $html,
        ?int $oldid,
        ?string $etag
Severity: Minor
Found in includes/ParsoidClient.php - About 35 mins to fix

    Function updateTitle has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    ve.ui.MWTemplateDialog.prototype.updateTitle = function () {
        let title = ve.msg( 'visualeditor-dialog-transclusion-loading' );
    
        if ( this.transclusionModel.isSingleTemplate() ) {
            const part = this.transclusionModel.getParts()[ 0 ];
    Severity: Minor
    Found in modules/ve-mw/ui/dialogs/ve.ui.MWTemplateDialog.js - About 35 mins to fix

    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 setUserConfig has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    ve.init.mw.Platform.prototype.setUserConfig = function ( keyOrValueMap, value ) {
        // T214963: Don't try to set user preferences for logged-out users, it doesn't work
        if ( !mw.user.isNamed() ) {
            return false;
        }
    Severity: Minor
    Found in modules/ve-mw/init/ve.init.mw.Platform.js - About 35 mins to fix

    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 onSaveDialogPreview has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    ve.init.mw.ArticleTarget.prototype.onSaveDialogPreview = function () {
        const api = this.getContentApi();
    
        if ( !this.saveDialog.$previewViewer.children().length ) {
            this.emit( 'savePreview' );
    Severity: Minor
    Found in modules/ve-mw/init/targets/ve.init.mw.ArticleTarget.js - About 35 mins to fix

    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 toggleWrapSelection has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    ve.ui.MWWikitextAction.prototype.toggleWrapSelection = function ( before, after, placeholder, expandOffsetsCallback, unwrapOffsetsCallback ) {
        const originalFragment = this.surface.getModel().getFragment( null, false, true /* excludeInsertions */ );
    
        let fragment = originalFragment;
        let textBefore, textAfter;
    Severity: Minor
    Found in modules/ve-mw/ui/actions/ve.ui.MWWikitextAction.js - About 35 mins to fix

    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 VeInitMwArticleTarget has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    ve.init.mw.ArticleTarget = function VeInitMwArticleTarget( config ) {
        config = config || {};
        config.toolbarConfig = ve.extendObject( {
            shadow: true,
            actions: true,
    Severity: Minor
    Found in modules/ve-mw/init/targets/ve.init.mw.ArticleTarget.js - About 35 mins to fix

    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 prepareCacheKey has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    ve.init.mw.ArticleTarget.prototype.prepareCacheKey = function ( doc ) {
        const start = ve.now();
    
        if ( this.getSurface().getMode() === 'source' ) {
            return;
    Severity: Minor
    Found in modules/ve-mw/init/targets/ve.init.mw.ArticleTarget.js - About 35 mins to fix

    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 updateReviewMode has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    ve.ui.MWSaveDialog.prototype.updateReviewMode = function () {
        if ( !this.hasDiff ) {
            return;
        }
    
    
    Severity: Minor
    Found in modules/ve-mw/ui/dialogs/ve.ui.MWSaveDialog.js - About 35 mins to fix

    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 onToggle has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    ve.ui.MWCategoryPopupWidget.prototype.onToggle = function ( show ) {
        if ( show ) {
            return;
        }
        const newSortkey = this.sortKeyInput.$input.val();
    Severity: Minor
    Found in modules/ve-mw/ui/widgets/ve.ui.MWCategoryPopupWidget.js - About 35 mins to fix

    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 serialize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    ve.dm.MWTemplateModel.prototype.serialize = function () {
        const origData = this.originalData || {},
            origParams = origData.params || {},
            template = { target: this.target, params: {} },
            spec = this.spec,
    Severity: Minor
    Found in modules/ve-mw/dm/models/ve.dm.MWTemplateModel.js - About 35 mins to fix

    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 onParameterAddedToTemplateModel has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    ve.ui.MWTransclusionOutlineTemplateWidget.prototype.onParameterAddedToTemplateModel = function ( param ) {
        const paramName = param.getName();
        // The placeholder (currently) doesn't get a corresponding item in the sidebar
        if ( !paramName ) {
            return;
    Severity: Minor
    Found in modules/ve-mw/ui/widgets/ve.ui.MWTransclusionOutlineTemplateWidget.js - About 35 mins to fix

    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 isDefaultAligned has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    ve.dm.MWImageModel.prototype.isDefaultAligned = function ( imageType, align ) {
        const alignment = align || this.getAlignment(),
            defaultAlignment = ( this.parentDoc.getDir() === 'rtl' ) ? 'left' : 'right';
    
        imageType = imageType || this.getType();
    Severity: Minor
    Found in modules/ve-mw/dm/models/ve.dm.MWImageModel.js - About 35 mins to fix

    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 initialize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    ve.ui.MWGalleryDialog.prototype.initialize = function () {
        // Parent method
        ve.ui.MWGalleryDialog.super.prototype.initialize.call( this );
    
        // States
    Severity: Minor
    Found in modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js - About 35 mins to fix

    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 toggleSearchPanel has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    ve.ui.MWGalleryDialog.prototype.toggleSearchPanel = function ( visible ) {
        visible = visible !== undefined ? visible : !this.searchPanelVisible;
    
        // If currently visible panel is an edit panel, save the input values for the highlighted item
        if ( !this.searchPanelVisible ) {
    Severity: Minor
    Found in modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js - About 35 mins to fix

    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 isHighlightedItemModified has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    ve.ui.MWGalleryDialog.prototype.isHighlightedItemModified = function () {
        if ( this.highlightedItem ) {
            if ( this.highlightedAltTextInput.getValue() !== this.highlightedItem.altText ) {
                return true;
            }
    Severity: Minor
    Found in modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js - About 35 mins to fix

    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 getValidationErrors has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    ve.ui.MWAddParameterPage.prototype.getValidationErrors = function ( name ) {
        if ( !name ) {
            return [];
        }
    
    
    Severity: Minor
    Found in modules/ve-mw/ui/pages/ve.ui.MWAddParameterPage.js - About 35 mins to fix

    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 getUpdatedAttributes has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    ve.dm.MWImageModel.prototype.getUpdatedAttributes = function () {
        const origAttrs = this.getOriginalImageAttributes();
    
        let currentDimensions;
        // Adjust default dimensions if size is set to default
    Severity: Minor
    Found in modules/ve-mw/dm/models/ve.dm.MWImageModel.js - About 35 mins to fix

    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 setup has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    ve.ui.MWAdvancedSettingsPage.prototype.setup = function ( fragment, config ) {
        this.fragment = fragment;
    
        // Indexing items
        const indexingField = this.indexing.getField();
    Severity: Minor
    Found in modules/ve-mw/ui/pages/ve.ui.MWAdvancedSettingsPage.js - About 35 mins to fix

    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 getTablesorterHeaderCells has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    ve.ce.MWTableNode.prototype.getTablesorterHeaderCells = function () {
        const matrix = this.model.getMatrix();
    
        let longestRow = [];
        let longestRowLength = 0;
    Severity: Minor
    Found in modules/ve-mw/ce/nodes/ve.ce.MWTableNode.js - About 35 mins to fix

    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 canBeShown has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    mw.editcheck.BaseEditCheck.prototype.canBeShown = function () {
        // all checks are only in the main namespace for now
        if ( mw.config.get( 'wgNamespaceNumber' ) !== mw.config.get( 'wgNamespaceIds' )[ '' ] ) {
            return false;
        }
    Severity: Minor
    Found in editcheck/modules/BaseEditCheck.js - About 35 mins to fix

    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

    Severity
    Category
    Status
    Source
    Language