wow-apps/symfony-slack-bot

View on GitHub

Showing 10 of 11 total issues

Attachment has 35 functions (exceeds 20 allowed). Consider refactoring.
Open

class Attachment
{
    /** @var string */
    private $color;

Severity: Minor
Found in Entity/Attachment.php - About 4 hrs to fix

    Method sendTestMessage has 62 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function sendTestMessage()
        {
            $slackMessage = new SlackMessage(
                'Simple Symfony 3 and 4 Bundle for sending customizable messages to Slack via '
                . SlackMarkdown::link('incoming webhooks', 'https://api.slack.com/incoming-webhooks')
    Severity: Major
    Found in Command/WowappsSlackbotTestCommand.php - About 2 hrs to fix

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

              string $color = '',
              string $pretext = '',
              string $authorName = '',
              string $authorLink = '',
              string $authorIconUrl = '',
      Severity: Major
      Found in Entity/Attachment.php - About 2 hrs to fix

        Method getConfigTreeBuilder has 48 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function getConfigTreeBuilder()
            {
                $treeBuilder = new TreeBuilder();
                $rootNode = $treeBuilder->root('wow_apps_slack');
                $rootNode
        Severity: Minor
        Found in DependencyInjection/Configuration.php - About 1 hr to fix

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

                  string $text = '',
                  string $username = '',
                  string $channel = '',
                  string $iconUrl = '',
                  string $iconEmoji = '',
          Severity: Major
          Found in Entity/SlackMessage.php - About 50 mins to fix

            Function execute has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function execute(InputInterface $input, OutputInterface $output)
                {
                    /* Work with container for support of Symfony 3 early versions */
                    $this->slackBot = $this->getContainer()->get('wowapps.slackbot');
                    $this->config = $this->slackBot->getConfig();
            Severity: Minor
            Found in Command/WowappsSlackbotTestCommand.php - 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 __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                    bool   $active = false,
                    string $title = '',
                    string $text = '',
                    string $buttonOkText = self::BUTTON_DEFAULT_TEXT_OK,
                    string $buttonDismissText = self::BUTTON_DEFAULT_TEXT_DISMISS
            Severity: Minor
            Found in Entity/AttachmentActionConfirm.php - About 35 mins to fix

              Function attachmentDto has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  private static function attachmentDto(Attachment $attachment)
                  {
                      if (!in_array($attachment->getColor(), SlackColor::COLOR_MAP)) {
                          throw new SlackbotException(SlackbotException::E_INCORRECT_COLOR);
                      }
              Severity: Minor
              Found in Service/SlackMessageValidator.php - 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

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

                  private static function checkIcon(SlackMessage $message)
                  {
                      if (!empty($message->getIconUrl())) {
                          if (!preg_match(
                              '/^(?:http|https|ftp)\:\/\/(.*?)\.(.*?)\/(.*?)\.(?:jpg|jpeg|png)/i',
              Severity: Minor
              Found in Service/SlackMessageValidator.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 list has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static function list(array $list, string $listType = self::LIST_MARKER): string
                  {
                      if (empty($list)) {
                          throw new SlackbotException(SlackbotException::E_EMPTY_LIST);
                      }
              Severity: Minor
              Found in Service/SlackMarkdown.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