Showing 66 of 66 total issues
Function script
has 252 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function script (manager: CallbackManager) {
// First register legacy calls.
legacy(manager);
manager.register({
Function script
has 232 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function script (manager: CallbackManager) {
legacy(manager);
manager.register({
callback: 'LibXmlRpc_Rankings',
Function legacy
has 172 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function legacy (manager: CallbackManager) {
/**
* PLAYER EVENTS
*/
Similar blocks of code found in 2 locations. Consider refactoring. Open
this.ui.global({
title: this.title,
header: this.header,
body: this.body.slice(this.range.start, this.range.stop),
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 167.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
return this.ui.global({
title: this.title,
header: this.header,
body: this.body.slice(this.range.start, this.range.stop),
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 167.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
File ManiaPlanetCallbacks.ts
has 429 lines of code (exceeds 250 allowed). Consider refactoring. Open
/**
* ManiaPlanet Generic Callbacks
*
* Maps generic mp callbacks into events.
*/
Function script
has 154 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function script (manager: CallbackManager) {
legacy(manager);
// Common Trackmania
Identical blocks of code found in 2 locations. Consider refactoring. Open
private handle (player, command, params, data) {
if (player.level >= command.level) {
return this.events.emit(command.command, this.app.gameFacade.players.list[data.login], params, data);
}
this.app.server.send().chat('Error, you are not allowed to use this command!', {destination: data.login}).exec();
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 113.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Identical blocks of code found in 2 locations. Consider refactoring. Open
private handleAdmin (player, command, params, data) {
if (player.level >= command.level) {
return this.events.emit(command.command, this.app.gameFacade.players.list[data.login], params, data);
}
this.app.server.send().chat('Error, you are not allowed to use this command!', {destination: data.login}).exec();
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 113.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Function loadPlugins
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
public async loadPlugins() {
// Register for Mode Changes and Script Changes
this.app.server.on('mode.change', (transition) => { this.onGameChange('mode', transition); });
this.app.log.debug('Loading plugins from configuration...');
- 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 parse
has 89 lines of code (exceeds 25 allowed). Consider refactoring. Open
public parse () {
this.width = 210;
this.totalWidth = 0;
this.page = 0; // Current Page NR.
Function loadPluginModels
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
private async loadPluginModels (plugin: any, id: string, sequelize: Sequelize) {
if (plugin.directory) {
var modelDirectory = path.normalize(plugin.directory + '/models/');
var exists = await fs.exists(modelDirectory);
if (! exists) {
- 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 sendInterface
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
public async sendInterface (ui: Interface, force: boolean, updateLogins: string[]) {
var data = {}; // Holds all global data.
var players = []; // Holds login.
var send = '';
- 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
File ListView.ts
has 263 lines of code (exceeds 250 allowed). Consider refactoring. Open
/**
* List View
*/
import {EventEmitter} from 'events';
Similar blocks of code found in 2 locations. Consider refactoring. Open
let info = {
login: data.Login,
nickName: data.NickName,
playerId: data.PlayerId,
teamId: data.TeamId,
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 81.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
return {
login: info.Login,
nickName: info.NickName,
playerId: info.PlayerId,
teamId: info.TeamId,
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 81.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Function sendInterface
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
public async sendInterface (ui: Interface, force: boolean, updateLogins: string[]) {
var data = {}; // Holds all global data.
var players = []; // Holds login.
var send = '';
Function _createAlert
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
_createAlert(type, title, message, players, size, buttonText, iconstyle, iconsubstyle) {
if (typeof players === 'string') {
players = [players];
}
buttonText.yes = buttonText.yes || 'Yes';
Function constructor
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor (facade: Database.Facade) {
this.app = facade.app;
let config = facade.config.config.config.db;
this.sequelize = null;
Function connect
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public async connect(login: string, nickname: string, info?: PlayerInfo | boolean | any,
emit?: boolean): Promise<Player> {
info = info || {};
emit = emit || 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"