nopolabs/yabot

View on GitHub

Showing 10 of 286 total issues

Client has 32 functions (exceeds 20 allowed). Consider refactoring.
Open

class Client
{
    use ConfigTrait;
    use LogTrait;

Severity: Minor
Found in src/Slack/Client.php - About 4 hrs to fix

    Method __construct has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

            string $name,
            $isBot,
            array $channels,
            array $users,
            array $patterns,
    Severity: Major
    Found in src/Plugin/MethodMatcher.php - About 50 mins to fix

      Method __construct has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              LoggerInterface $logger,
              LoopInterface $eventLoop,
              Client $slackClient,
              MessageFactory $messageFactory,
              PluginManager $pluginManager,
      Severity: Minor
      Found in src/Yabot.php - About 45 mins to fix

        Method __construct has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

                RealTimeClient $realTimeClient,
                Users $users,
                Bots $bots,
                Channels $channels,
                array $config = [],
        Severity: Minor
        Found in src/Slack/Client.php - About 45 mins to fix

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

                  string $pluginId,
                  bool $isBot = null,
                  array $channels,
                  array $users,
                  LoggerInterface $logger = null)
          Severity: Minor
          Found in src/Plugin/PluginMatcher.php - About 35 mins to fix

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

                    Client $slackClient,
                    array $data,
                    string $formattedText,
                    User $user = null,
                    Channel $channel)
            Severity: Minor
            Found in src/Message/Message.php - About 35 mins to fix

              Avoid too many return statements within this method.
              Open

                      return $this->matchPatterns($message);
              Severity: Major
              Found in src/Helpers/MatcherTrait.php - About 30 mins to fix

                Function updatePrefixes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected function updatePrefixes($authedUsername)
                    {
                        $updatedPriorityMap = [];
                        foreach ($this->getPriorityMap() as $priority => $prefixMap) {
                            $updatedPrefixMap = [];
                Severity: Minor
                Found in src/Plugin/PluginManager.php - 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

                Function dispatchToPrefixes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected function dispatchToPrefixes(array $prefixMap, Message $message, string $text)
                    {
                        foreach ($prefixMap as $prefix => $plugins) {
                            if ($matches = $this->matchesPrefix($prefix, $text)) {
                                $this->debug("Dispatching prefix '$prefix'");
                Severity: Minor
                Found in src/Plugin/PluginManager.php - 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

                Function methodMatch has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected function methodMatch(Message $message)
                    {
                        foreach ($this->getMethodMatchers() as $methodMatcher) {
                            /** @var MethodMatcher $methodMatcher */
                            if ($matches = $methodMatcher->matches($message)) {
                Severity: Minor
                Found in src/Plugin/PluginTrait.php - 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