Showing 994 of 1,238 total issues
Function onChangesListSpecialPageStructuredFilters
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function onChangesListSpecialPageStructuredFilters( $special ): void {
$translateRcFilterDefault = $this->config->get( 'TranslateRcFilterDefault' );
$defaultFilter = $translateRcFilterDefault !== 'noaction' ?
$translateRcFilterDefault :
ChangesListStringOptionsFilterGroup::NONE;
- 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 __construct
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
Config $config,
TranslatorActivity $translatorActivity,
LanguageNameUtils $langNameUtils,
ILoadBalancer $loadBalancer,
ConfigHelper $configHelper,
Function execute
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function execute() {
$params = $this->extractRequestParams();
$target = $this->validateTargetParamater( $params );
$cache = $this->loadStatistics( $target, MessageGroupStats::FLAG_CACHE_ONLY );
- 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 form
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private function form( FormOptions $opts ): void {
$script = $this->getConfig()->get( 'Script' );
$this->setHeaders();
$out = $this->getOutput();
- 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 execute
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function execute(): void {
$this->checkUserRightsAny( self::RIGHT );
$params = $this->extractRequestParams();
$groupId = $params['groupId'];
- 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 roundTimestampToCutoff
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private static function roundTimestampToCutoff(
string $scale, int $cutoff, string $direction = 'earlier'
): int {
$dir = $direction === 'earlier' ? -1 : 1;
- 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 calculateGroup
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private static function calculateGroup( MessageGroup $group, string $languageCode ): array {
global $wgTranslateDocumentationLanguageCode;
// Calculate if missing and store in the db
$collection = $group->initCollection( $languageCode );
- 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 reloadIgnorePatterns
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public static function reloadIgnorePatterns(): void {
$validationExclusionFile = Services::getInstance()->getConfigHelper()->getValidationExclusionFile();
if ( $validationExclusionFile === false ) {
self::$ignorePatterns = [];
- 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 getIssues
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function getIssues( Message $message, string $targetLanguage ): ValidationIssues {
$issues = new ValidationIssues();
$expectedKeywords = UnicodePlural::getPluralKeywords( $targetLanguage );
// Skip validation for languages for which we do not know the plural rule
- 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 getDefinitions
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function getDefinitions() {
$groups = MessageGroups::getAllGroups();
$keys = [];
/** @var $g MessageGroup */
- 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 exports
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function ( grunt ) {
const conf = grunt.file.readJSON( 'extension.json' );
grunt.loadNpmTasks( 'grunt-eslint' );
grunt.loadNpmTasks( 'grunt-banana-checker' );
Function showShortcuts
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
showShortcuts: function () {
// Any better way?
var rtl = $( document.body ).is( '.rtl' );
var editorOffset = this.$editor.offset();
Function saveDocumentation
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
saveDocumentation: function () {
var translateEditor = this,
api = new mw.Api(),
newDocumentation = translateEditor.$editor.find( '.tux-textarea-documentation' ).val();
Function calculatePointY
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
calculatePointY: function(value, index, datasetIndex) {
var me = this;
var chart = me.chart;
var yScale = me._yScale;
var sumPos = 0;
Function hsl
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
convert.rgb.hsl = function (rgb) {
var r = rgb[0] / 255;
var g = rgb[1] / 255;
var b = rgb[2] / 255;
var min = Math.min(r, g, b);
Function proofread
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
proofread: function () {
var message = this.message,
$message = this.$message,
api = new mw.Api();
Function listen
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
listen: function () {
var statsbar = this;
statsbar.$statsBar.on( 'change', function ( event, to, from ) {
// This updates the value in mw.translate.languagestats as a reference to
// the object is returned here.
Function rgb
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
convert.hcg.rgb = function (hcg) {
var h = hcg[0] / 360;
var c = hcg[1] / 100;
var g = hcg[2] / 100;
Function handleEvent
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
handleEvent: function(e) {
var me = this;
var opts = me.options;
var type = e.type === 'mouseup' ? 'click' : e.type;
var hoveredItem;
Method getArrayDiff
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getArrayDiff( array $old, array $new ): array {
$values = [];
$record = static function ( $groups ) use ( &$values ) {
foreach ( $groups as $group ) {
$values[$group] = true;