Showing 35 of 35 total issues
File EmojiList.java
has 474 lines of code (exceeds 250 allowed). Consider refactoring. Open
package ru.shemplo.chat.neerc.gfx.panes;
import javafx.application.Platform;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
Identical blocks of code found in 2 locations. Consider refactoring. Open
SceneComponent.USERS_V.<VBox> safe (holder.getScene ()).ifPresent (line -> {
Platform.runLater (line.getChildren ()::clear);
final UsersService usersService = holder.getManager ().getUsersService ();
List <Button> buttons = usersService.getUsers ().stream ().sorted (UE_COMPARATOR)
- 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 252.
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
SceneComponent.USERS_H.<HBox> safe (holder.getScene ())
.ifPresent (line -> {
Platform.runLater (line.getChildren ()::clear);
final UsersService usersService = holder.getManager ().getUsersService ();
- 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 252.
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 MainSceneHolder.java
has 309 lines of code (exceeds 250 allowed). Consider refactoring. Open
package ru.shemplo.chat.neerc.gfx.scenes;
import static java.time.ZoneOffset.*;
import static ru.shemplo.chat.neerc.enities.MessageEntity.MessageAccess.*;
Method _makeDefaultMessage
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
private void _makeDefaultMessage (Pane container, MessageEntity message) {
String tmpBody = message.getBody (), ident = "(\\w|_|-)+";
final Pattern emojiPattern
= Pattern.compile (String.format (":%s:", ident));
final Insets insets = new Insets (0, 8, 0, 0);
Method changeStatusByClicking
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
private void changeStatusByClicking () {
RequestIQ requestIQ = null;
if (type.equals (CONFIRM)) {
requestIQ = new TaskStatusIQ (taskID,
taskStatus.equals (SUCCESS) ? NONE: SUCCESS, "");
- 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 route
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
public void route (Message message) {
if (message.getBody () == null) { return; }
final String from = message.getFrom ().asUnescapedString (),
Method onUsersUpdated
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
public void onUsersUpdated () {
SceneComponent.USERS_H.<HBox> safe (holder.getScene ())
.ifPresent (line -> {
Platform.runLater (line.getChildren ()::clear);
Method mergeTasks
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
public synchronized void mergeTasks (Collection <TaskEntity> tasks) {
boolean numberOfTasksChanged = this.tasks.size () != tasks.size ();
List <String> keys = new ArrayList <> (this.tasks.keySet ());
Set <String> keep = new HashSet <> (tasks.stream ()
. map (TaskEntity::getId)
Method makeDefaultButtons
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
private final void makeDefaultButtons () {
Button reconnect = SceneComponent.RECONNECT_BUTTON.get (scene);
reconnect.setOnAction (__ -> {
new Thread (manager.getSharedContext ().getClientAdapter ()::performReconnection)
. start (); // Not to block GUI thread
Method updateItem
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
protected void updateItem (MessageEntity item, boolean empty) {
super.updateItem (item, empty || item == null);
if (empty || item == null) {
setGraphic (null);
Method makeDefaultTabs
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
private final void makeDefaultTabs () {
DetachableTab publicChatTab = new DetachableTab ("public");
openedTabs.put (publicChatTab.getText (), publicChatTab);
final Conversation publicConversation
= new Conversation (this, publicChatTab.getText ());
Method onUserChangedPresence
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
public void onUserChangedPresence (String user, OnlineStatus status) {
Image image = Stream.of (status)
. map (OnlineStatus::name)
. map (String::toLowerCase)
Identical blocks of code found in 2 locations. Consider refactoring. Open
SceneComponent.USERS_H.<HBox> safe (holder.getScene ())
.ifPresent (line -> {
Platform.runLater (() -> {
line.getChildren ().stream ()
.map (o -> (Button) o)
- 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 74.
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
Optional <Method> callMethod = ROUTE_METHODS.get (routeAnnotation).stream ()
. map (m -> Pair.mp (m, m.getAnnotation (routeAnnotation)))
. filter (p -> namespace.matches (p.S.namespace ()))
. filter (p -> author.matches (p.S.author ()))
. filter (p -> room.matches (p.S.room ()))
- 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 74.
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
Optional <Method> callMethod = ROUTE_METHODS.get (routeAnnotation).stream ()
. map (m -> Pair.mp (m, m.getAnnotation (routeAnnotation)))
. filter (p -> type.equals (p.S.meessageType ()))
. filter (p -> name.matches (p.S.name ()))
. filter (p -> namespace.matches (p.S.namespace ()))
- 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 74.
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
SceneComponent.USERS_V.<VBox> safe (holder.getScene ())
.ifPresent (line -> {
Platform.runLater (() -> {
line.getChildren ().stream ()
.map (o -> (Button) o)
- 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 74.
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
@Override
public AbsCustomIQ parse (XmlPullParser parser, int initialDepth) throws Exception {
AbsCustomIQ iq = null;
switch (parser.getNamespace ().split ("#") [1]) {
case "users": iq = new UsersListIQ (); break;
- 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 73.
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
@Override
public AbsCustomExtensionElement parse (XmlPullParser parser, int initialDepth) throws Exception {
AbsCustomExtensionElement elementExtension = null;
switch (parser.getNamespace ().split ("#") [1]) {
- 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 73.
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
usersScrollVertical.setOnScroll (se -> {
double hValue = usersScrollVertical.getVvalue (), delta = se.getDeltaY () * 1.5;
VBox users = SceneComponent.USERS_V.get (scene);
usersScrollVertical.setVvalue (hValue - delta / users.getWidth ());
});
- 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 62.
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