Battle-Cattle/BCUK-Bot-3

View on GitHub

Showing 12 of 140 total issues

File SFXManagerView.java has 267 lines of code (exceeds 250 allowed). Consider refactoring.
Open

package com.expiredminotaur.bcukbot.web.view.commands;

import com.expiredminotaur.bcukbot.Role;
import com.expiredminotaur.bcukbot.sql.sfx.SFX;
import com.expiredminotaur.bcukbot.sql.sfx.SFXCategory;

JustGivingSettings has 21 methods (exceeds 20 allowed). Consider refactoring.
Open

public class JustGivingSettings
{
    @Transient
    private static final String fileName = "justgiving.json";
    private Boolean autoCheckEnabled = false;

Method loadAndPlay has 50 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public void loadAndPlay(MessageCreateEvent event, final String trackUrl)
    {
        playerManager.loadItemOrdered(player, trackUrl, new AudioLoadResultHandler()
        {
            @Override

Method loadAndPlayPriority has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public void loadAndPlayPriority(final String trackUrl)
    {
        playerManager.loadItemOrdered(player, trackUrl, new AudioLoadResultHandler()
        {
            @Override

Method updateData has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private void updateData(String data)
    {
        this.data = data;
        JsonElement jsonTree = JsonParser.parseString(data);
        if (jsonTree.isJsonObject())

Method update has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public void update(Group group, Stream newStream)
    {
        if (stream == null)
        {
            stream = newStream;
Severity: Minor
Found in src/main/java/com/expiredminotaur/bcukbot/twitch/streams/StreamData.java - About 45 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

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

    private void correctAnswerPost(MessageChannel channel, Questions.Question question, ReactionEmoji.Unicode emoji, String answer, List<User> correct)
Severity: Minor
Found in src/main/java/com/expiredminotaur/bcukbot/fun/trivia/TriviaGame.java - About 35 mins to fix

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

    private void update(Message message, EmbedCreateSpec embed, Outcome outcome, String[] display, int i)
Severity: Minor
Found in src/main/java/com/expiredminotaur/bcukbot/fun/slot/SlotGame.java - About 35 mins to fix

Method addMinecraftWhitelist has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private String addMinecraftWhitelist(Long discordID, String username)
    {
        NameWithUUID newUser = UuidApi.nameToUUID(username);
        if (newUser != null)
        {

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

    public boolean checkBannedPhrases(TwitchCommandEvent event)
    {
        if (TwitchPermissions.subPlus(event))
            return false;
        else
Severity: Minor
Found in src/main/java/com/expiredminotaur/bcukbot/twitch/BanHandler.java - 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

Method play has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public void play(String cmd)
    {
        long time = System.currentTimeMillis();
        if (time - lastSFX > settings.getSfxDelay() * 1000L)
        {
Severity: Minor
Found in src/main/java/com/expiredminotaur/bcukbot/discord/music/SFXHandler.java - About 25 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

Method onChannelMessage has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private void onChannelMessage(ChannelMessageEvent event)
    {
        TwitchCommandEvent cEvent = new TwitchCommandEvent(event);
        if (!banHandler.checkBannedPhrases(cEvent))
        {
Severity: Minor
Found in src/main/java/com/expiredminotaur/bcukbot/twitch/TwitchBot.java - About 25 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