JABirchall/NimdaTS3

View on GitHub

Showing 41 of 41 total issues

Function onMessage has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
Open

    public function onMessage(Event $event)
    {
        $data = $event->getData();
        $mode = $this->parseMessageMode(@$data['targetmode']);
        if (@$data['invokername'] == $this->name || @$data['invokeruid'] == 'serveradmin') {
Severity: Minor
Found in app/TeamSpeak3Bot.php - About 6 hrs 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

File TeamSpeak3Bot.php has 384 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Created by PhpStorm.
 * User: Admin
 * Date: 25/07/2016
Severity: Minor
Found in app/TeamSpeak3Bot.php - About 5 hrs to fix

    TeamSpeak3Bot has 24 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class TeamSpeak3Bot
    {
        /**
         * @var string
         */
    Severity: Minor
    Found in app/TeamSpeak3Bot.php - About 2 hrs to fix

      Function isTriggered has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

          public function isTriggered()
          {
              if (!isset($this->info['text'])) {
                  $this->sendUsage();
      
      
      Severity: Minor
      Found in plugins/Quotes.php - About 2 hrs 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 isTriggered has 59 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function isTriggered()
          {
              if (!isset($this->info['text'])) {
                  $this->sendUsage();
      
      
      Severity: Major
      Found in plugins/Quotes.php - About 2 hrs to fix

        Method isTriggered has 52 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function isTriggered()
            {
                if (!isset($this->info['text'])) {
                    $this->sendOutput($this->CONFIG['usage']);
        
        
        Severity: Major
        Found in plugins/GlobalBan.php - About 2 hrs to fix

          Function loadPlugin has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

              private function loadPlugin($configFile)
              {
                  $config = $this->parseConfigFile($configFile);
                  $config['configFile'] = $configFile;
          
          
          Severity: Minor
          Found in app/TeamSpeak3Bot.php - About 1 hr 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 isTriggered has 46 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function isTriggered()
              {
                  if($this->CONFIG['enabled'] === false) {
                      return;
                  }
          Severity: Minor
          Found in plugins/GlobalBanList.php - About 1 hr to fix

            Function onEvent has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

                public function onEvent(Event $event)
                {
                    $data = $event->getData();
                    if (@$data['client_type'] == 1) {
                        return;
            Severity: Minor
            Found in app/TeamSpeak3Bot.php - About 1 hr 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 notify has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function notify()
                {
                    foreach ($this->teamSpeak3Bot->node->clientList() as $client) {
                        if ($client["client_type"] == 1) {
                            continue;
            Severity: Minor
            Found in plugins/ChannelGroupNotifications.php - About 1 hr 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 loadPlugin has 43 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private function loadPlugin($configFile)
                {
                    $config = $this->parseConfigFile($configFile);
                    $config['configFile'] = $configFile;
            
            
            Severity: Minor
            Found in app/TeamSpeak3Bot.php - About 1 hr to fix

              Method onMessage has 40 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function onMessage(Event $event)
                  {
                      $data = $event->getData();
                      $mode = $this->parseMessageMode(@$data['targetmode']);
                      if (@$data['invokername'] == $this->name || @$data['invokeruid'] == 'serveradmin') {
              Severity: Minor
              Found in app/TeamSpeak3Bot.php - About 1 hr to fix

                Method __construct has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function __construct($config, $teamSpeak3Bot)
                    {
                        $this->time = Carbon::now();
                        $this->nextRunTime = Carbon::now();
                        $this->teamSpeak3Bot = $teamSpeak3Bot;
                Severity: Minor
                Found in app/Timer.php - About 1 hr to fix

                  Function isTriggered has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function isTriggered()
                      {
                          if (!isset($this->info['text'])) {
                              $this->sendOutput($this->CONFIG['usage']);
                  
                  
                  Severity: Minor
                  Found in plugins/Kick.php - About 1 hr 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 isTriggered has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function isTriggered()
                      {
                          if (!isset($this->info['text'])) {
                              $this->sendOutput($this->CONFIG['usage']);
                  
                  
                  Severity: Minor
                  Found in plugins/GlobalBan.php - About 1 hr 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 isTriggered has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function isTriggered()
                      {
                          if($this->CONFIG['enabled'] === false) {
                              return;
                          }
                  Severity: Minor
                  Found in plugins/GlobalBanList.php - About 1 hr 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 isTriggered has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function isTriggered()
                      {
                          if (empty($this->CONFIG['email'])) {
                              $this->sendOutput("[%s] No email entry in configuration, API requires an email for registration.", __CLASS__);
                              return;
                  Severity: Minor
                  Found in plugins/AntiProxy.php - About 1 hr to fix

                    Function __construct has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function __construct($config, $teamSpeak3Bot)
                        {
                            $this->time = Carbon::now();
                            $this->nextRunTime = Carbon::now();
                            $this->teamSpeak3Bot = $teamSpeak3Bot;
                    Severity: Minor
                    Found in app/Timer.php - About 1 hr 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 27 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function __construct($username, $password, $host = '127.0.0.1', $port = 10011, $name = 'Nimda', $serverPort = 9987, $timeout = 10)
                        {
                            $this->carbon = new Carbon;
                    
                           if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN' && posix_getuid() === 0 && !Self::$config['ignoreWarnings']) {
                    Severity: Minor
                    Found in app/TeamSpeak3Bot.php - About 1 hr to fix

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

                          public function __construct($config, $teamSpeak3Bot)
                          {
                      
                              $this->teamSpeak3Bot = $teamSpeak3Bot;
                              foreach ($config as $name => $value) {
                      Severity: Minor
                      Found in app/Plugin.php - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language