Jalle19/tvheadend-status-manager

View on GitHub

Showing 15 of 394 total issues

Function getStatusMessages has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    private function getStatusMessages($instances)
    {
        $collection = new InstanceStatusCollection();

        foreach ($instances as $instance)
Severity: Minor
Found in src/cli/Manager/StatusManager.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

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

class Configuration
{

    /**
     * @var string the database path
Severity: Minor
Found in src/cli/Configuration/Configuration.php - About 2 hrs to fix

    Method onSubscriptionSeen has 47 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function onSubscriptionSeen(SubscriptionSeenEvent $event)
        {
            $instanceName = $event->getInstance();
            $status       = $event->getSubscription();
    
    
    Severity: Minor
    Found in src/cli/Manager/PersistenceManager.php - About 1 hr to fix

      Method getStatusMessages has 46 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function getStatusMessages($instances)
          {
              $collection = new InstanceStatusCollection();
      
              foreach ($instances as $instance)
      Severity: Minor
      Found in src/cli/Manager/StatusManager.php - About 1 hr to fix

        Function Connection has 37 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        var Connection = (function() {
        
          var websocket = null;
          var accessToken = null;
          var handlers = [];
        Severity: Minor
        Found in src/client/app/js/websocket.js - About 1 hr to fix

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

              public function onMessage(ConnectionInterface $from, $msg)
              {
                  try
                  {
                      $message = MessageFactory::factory($msg);
          Severity: Minor
          Found in src/cli/Manager/AbstractClientManager.php - About 1 hr to fix

            Method execute has 33 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function execute(InputInterface $input, OutputInterface $output)
                {
                    // Parse the configuration
                    $configFile    = $input->getArgument('configFile');
                    $configuration = ConfigurationParser::parseConfiguration(new YamlReader($configFile));
            Severity: Minor
            Found in src/cli/Console/Commands/TvheadendStatusManagerCommand.php - About 1 hr to fix

              Function exports has 32 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              module.exports = function(grunt) {
                grunt.initConfig({
                  less: {
                    development: {
                      options: {
              Severity: Minor
              Found in src/client/Gruntfile.js - About 1 hr to fix

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

                    public function validate()
                    {
                        // Check that all mandatory values are defined
                        foreach (self::$mandatoryValues as $mandatoryValue)
                            if (!isset($this->_configuration[$mandatoryValue]) || ($this->_configuration[$mandatoryValue] != '0' && empty($this->_configuration[$mandatoryValue])))
                Severity: Minor
                Found in src/cli/Configuration/Validator.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 onSubscriptionStateChange has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function onSubscriptionStateChange(SubscriptionStateChangeEvent $event)
                    {
                        $instanceName = $event->getInstance();
                        $stateChange  = $event->getStateChange();
                
                
                Severity: Minor
                Found in src/cli/Manager/PersistenceManager.php - About 1 hr to fix

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

                      public function testEventHandling()
                      {
                          /* @var EventSubscriberInterface|\PHPUnit_Framework_MockObject_MockObject|InstanceStateManager $instanceStateManager */
                          $instanceStateManager = $this->getMockBuilder('\Jalle19\StatusManager\Manager\InstanceStateManager')
                                                       ->setConstructorArgs([$this->configuration, $this->logger, $this->eventDispatcher])
                  Severity: Minor
                  Found in tests/cli/Manager/InstanceStateManagerTest.php - About 1 hr to fix

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

                        public function handleMessage(AbstractMessage $message, ConnectionInterface $sender)
                        {
                            // Wrap database exceptions in the more generic RequestFailedException
                            try
                            {
                    Severity: Minor
                    Found in src/cli/Manager/StatisticsManager.php - About 1 hr to fix

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

                              $instanceName,
                              array $availableNetworks,
                              array $availableMuxes,
                              array $inputs,
                              array $subscriptions,
                      Severity: Major
                      Found in src/cli/Instance/InstanceStatus.php - About 50 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                        return new UsersRequest($payload);
                        Severity: Major
                        Found in src/cli/Message/Factory.php - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                  return false;
                          Severity: Major
                          Found in src/cli/Manager/StatisticsManager.php - About 30 mins to fix
                            Severity
                            Category
                            Status
                            Source
                            Language