nopolabs/yabot-plugins

View on GitHub

Showing 8 of 8 total issues

Resources has 21 functions (exceeds 20 allowed). Consider refactoring.
Open

class Resources implements ResourcesInterface
{
    use StorageTrait;
    use LoopTrait;
    use SlackTrait;
Severity: Minor
Found in src/Reservations/Resources.php - About 2 hrs to fix

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

        public function __construct(
            LoggerInterface $logger,
            ResourcesInterface $resources,
            array $config = [])
        {
    Severity: Minor
    Found in src/Reservations/ReservationsPlugin.php - About 1 hr to fix

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

          public function __construct(
              LoggerInterface $logger,
              Guzzle $guzzle,
              array $config = [])
          {
      Severity: Minor
      Found in src/Giphy/GiphyService.php - About 1 hr to fix

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

            protected function releaseReservation(Message $msg, $key, bool $please = false) : array
            {
                $results = [];
                $resource = $this->resources->getResource($key);
        
        
        Severity: Minor
        Found in src/Reservations/ReservationsPlugin.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 nyt has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function nyt(Message $msg, array $matches)
            {
                $n = $matches['n'] ? $matches['n'] : 1;
                $url = $this->get('url');
        
        
        Severity: Minor
        Found in src/Examples/NytPlugin.php - About 1 hr to fix

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

                  Client $slack,
                  StorageInterface $storage,
                  LoopInterface $eventLoop,
                  LoggerInterface $logger,
                  array $config)
          Severity: Minor
          Found in src/Reservations/Resources.php - About 35 mins to fix

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

                    LoggerInterface $logger,
                    Client $slack,
                    HttpServer $http,
                    TextClient $textClient,
                    array $config)
            Severity: Minor
            Found in src/Sms/TextPlugin.php - About 35 mins to fix

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

                  protected function placeReservation(Message $msg, $key, DateTime $until = null) : array
                  {
                      $results = [];
                      $resource = $this->resources->getResource($key);
              
              
              Severity: Minor
              Found in src/Reservations/ReservationsPlugin.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