nopolabs/yabot

View on GitHub

Showing 285 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

    The class Client has 15 public methods. Consider refactoring Client to keep number of public methods under 10.
    Open

    class Client
    {
        use ConfigTrait;
        use LogTrait;
    
    
    Severity: Minor
    Found in src/Slack/Client.php by phpmd

    TooManyPublicMethods

    Since: 0.1

    A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

    By default it ignores methods starting with 'get' or 'set'.

    Example

    Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

    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

      Avoid variables with short names like $id. Configured minimum length is 3.
      Open

          public function byId($id)
      Severity: Minor
      Found in src/Slack/AbstractIdNameMap.php by phpmd

      ShortVariable

      Since: 0.2

      Detects when a field, local, or parameter has a very short name.

      Example

      class Something {
          private $q = 15; // VIOLATION - Field
          public static function main( array $as ) { // VIOLATION - Formal
              $r = 20 + $this->q; // VIOLATION - Local
              for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                  $r += $this->q;
              }
          }
      }

      Source https://phpmd.org/rules/naming.html#shortvariable

      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

              Expected 1 space after FUNCTION keyword; 0 found
              Open

                      $onRejected = $onRejected ?? function($reason) { $this->logRejection($reason); };
              Severity: Minor
              Found in src/Guzzle/Guzzle.php by phpcodesniffer

              There must be one blank line after the namespace declaration
              Open

              namespace Nopolabs\Yabot\Slack;
              Severity: Minor
              Found in src/Slack/Users.php by phpcodesniffer

              There must be one blank line after the namespace declaration
              Open

              namespace Nopolabs\Yabot\Guzzle;
              Severity: Minor
              Found in src/Guzzle/Guzzle.php by phpcodesniffer

              There must be one blank line after the namespace declaration
              Open

              namespace Nopolabs\Yabot\Slack;
              Severity: Minor
              Found in src/Slack/Client.php by phpcodesniffer

              The closing parenthesis of a multi-line function declaration must be on a new line
              Open

                      LoggerInterface $log = null)
              Severity: Minor
              Found in src/Slack/Client.php by phpcodesniffer

              Expected 1 space after FUNCTION keyword; 0 found
              Open

                          $params['patterns'] = array_map(function($pattern) use ($search, $replace) {
              Severity: Minor
              Found in src/Plugin/PluginTrait.php by phpcodesniffer

              There must be one blank line after the namespace declaration
              Open

              namespace Nopolabs\Yabot\Slack;
              Severity: Minor
              Found in src/Slack/Bots.php by phpcodesniffer

              Each PHP statement must be on a line by itself
              Open

                      $onRejected = $onRejected ?? function($reason) { $this->logRejection($reason); };
              Severity: Minor
              Found in src/Guzzle/Guzzle.php by phpcodesniffer

              Blank line found at start of control structure
              Open

                      if ($interval = $this->get('connection_monitor.interval')) {
              Severity: Minor
              Found in src/Yabot.php by phpcodesniffer

              There must be one blank line after the namespace declaration
              Open

              namespace Nopolabs\Yabot\Plugin;

              There must be one blank line after the namespace declaration
              Open

              namespace Nopolabs\Yabot\Helpers;
              Severity: Minor
              Found in src/Helpers/ConfigTrait.php by phpcodesniffer

              The closing parenthesis and the opening brace of a multi-line function declaration must be on the same line
              Open

                  {
              Severity: Minor
              Found in src/Message/Message.php by phpcodesniffer
              Severity
              Category
              Status
              Source
              Language