diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ebedbfcd7..d41cc202a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -36,7 +36,7 @@ repos: exclude: ^legacy/public(?!/js/airtime) - repo: https://github.com/asottile/pyupgrade - rev: v3.9.0 + rev: v3.10.1 hooks: - id: pyupgrade args: [--py38-plus] diff --git a/analyzer/setup.py b/analyzer/setup.py index 84fbef517..a5dac92ff 100644 --- a/analyzer/setup.py +++ b/analyzer/setup.py @@ -31,7 +31,7 @@ setup( "types-requests>=2.31.0,<2.32", ], "sentry": [ - "sentry-sdk>=1.15.0,<1.29", + "sentry-sdk>=1.15.0,<1.30", ], }, zip_safe=False, diff --git a/api/setup.py b/api/setup.py index 3bf084a87..26438ce89 100644 --- a/api/setup.py +++ b/api/setup.py @@ -41,14 +41,14 @@ setup( "django-coverage-plugin>=3.0.0,<3.2", "django-stubs>=1.14.0,<4.3", "djangorestframework-stubs>=1.8.0,<3.15", - "model_bakery>=1.10.1,<1.13", + "model_bakery>=1.10.1,<1.14", "psycopg[binary]>=3.1.8,<3.2", "pylint-django>=2.5.3,<2.6", "pytest-django>=4.5.2,<4.6", "requests-mock>=1.10.0,<1.12", ], "sentry": [ - "sentry-sdk[django]>=1.15.0,<1.29", + "sentry-sdk[django]>=1.15.0,<1.30", ], }, ) diff --git a/legacy/application/check.php b/legacy/application/check.php index 1269109fd..7f8ba5b75 100644 --- a/legacy/application/check.php +++ b/legacy/application/check.php @@ -40,6 +40,7 @@ function checkPhpDependencies() function checkDatabaseDependencies() { global $extensions; + // Check the PHP extension list for the Postgres db extensions return in_array('pdo_pgsql', $extensions) && in_array('pgsql', $extensions); diff --git a/legacy/application/common/CeleryManager.php b/legacy/application/common/CeleryManager.php index 3a4fa785a..70406667d 100644 --- a/legacy/application/common/CeleryManager.php +++ b/legacy/application/common/CeleryManager.php @@ -98,6 +98,7 @@ class CeleryManager throw new CeleryTimeoutException('Celery task ' . $task->getDbName() . ' with ID ' . $task->getDbTaskId() . ' timed out'); } + // The message hasn't timed out, but it's still false, which means it hasn't been // sent back from Celery yet. throw new CeleryException('Waiting on Celery task ' . $task->getDbName() . ' with ID ' . $task->getDbTaskId()); diff --git a/legacy/application/common/HTTPHelper.php b/legacy/application/common/HTTPHelper.php index 1db6eed4b..3047685cc 100644 --- a/legacy/application/common/HTTPHelper.php +++ b/legacy/application/common/HTTPHelper.php @@ -52,10 +52,9 @@ class Application_Common_HTTPHelper class ZendActionHttpException extends Exception { /** - * @param int $statusCode - * @param string $message - * @param int $code - * @param Exception $previous + * @param int $statusCode + * @param string $message + * @param int $code * * @throws Zend_Controller_Response_Exception */ diff --git a/legacy/application/controllers/WebstreamController.php b/legacy/application/controllers/WebstreamController.php index a823511bf..a7ec0698e 100644 --- a/legacy/application/controllers/WebstreamController.php +++ b/legacy/application/controllers/WebstreamController.php @@ -116,9 +116,11 @@ class WebstreamController extends Zend_Controller_Action /*we are updating a playlist. Ensure that if the user is a host/dj, that he has the correct permission.*/ $user = Application_Model_User::getCurrentUser(); + // only allow when webstream belongs to the DJ return $webstream->getDbCreatorId() == $user->getId(); } + /*we are creating a new stream. Don't need to check whether the DJ/Host owns the stream*/ return true; diff --git a/legacy/application/models/ListenerStat.php b/legacy/application/models/ListenerStat.php index 96713ffc7..ec19fb4f6 100644 --- a/legacy/application/models/ListenerStat.php +++ b/legacy/application/models/ListenerStat.php @@ -125,6 +125,7 @@ SQL; foreach ($data as $show_id) { $all_show_data = array_merge(self::getShowDataPointsWithinRange($p_start, $p_end, $show_id['show_id']), $all_show_data); } + /* option to sort by number of listeners currently commented out usort($all_show_data, function($a, $b) { return $a['average_number_of_listeners'] - $b['average_number_of_listeners']; diff --git a/legacy/application/models/Show.php b/legacy/application/models/Show.php index 8efef314d..50a6c2451 100644 --- a/legacy/application/models/Show.php +++ b/legacy/application/models/Show.php @@ -1209,6 +1209,7 @@ SQL; $row = intval($date->format('w')) % count($palette); $foo = $date->format('H'); $col = intval(intval($date->format('H')) / 24.0 * count($palette[0])); + // $color = $palette[$hashValue % sizeof($palette)]; return $palette[$row][$col]; } diff --git a/legacy/application/models/User.php b/legacy/application/models/User.php index aac98773e..2326a1414 100644 --- a/legacy/application/models/User.php +++ b/legacy/application/models/User.php @@ -227,6 +227,7 @@ class Application_Model_User public function getOwnedFiles() { $user = $this->_userInstance; + // do we need a find call at the end here? return $user->getCcFilessRelatedByDbOwnerId(); } diff --git a/legacy/application/services/ShowFormService.php b/legacy/application/services/ShowFormService.php index ba207389c..3935a4189 100644 --- a/legacy/application/services/ShowFormService.php +++ b/legacy/application/services/ShowFormService.php @@ -401,6 +401,7 @@ class Application_Service_ShowFormService Logging::error('Failed to read image: ' . $path); $imageData = null; } + // return the data URI - data:{mime};base64,{data} return ($imageData === null || $imageData === '') ? '' : 'data: ' . mime_content_type($path) . ';base64,' . $imageData; diff --git a/legacy/tools/composer.json b/legacy/tools/composer.json index a7bc871cb..8f7076440 100644 --- a/legacy/tools/composer.json +++ b/legacy/tools/composer.json @@ -1,6 +1,6 @@ { "require": { "php": "^7.4", - "friendsofphp/php-cs-fixer": "<3.22.1" + "friendsofphp/php-cs-fixer": "<3.23.1" } } diff --git a/playout/setup.py b/playout/setup.py index 27b2815ec..dd39527b2 100644 --- a/playout/setup.py +++ b/playout/setup.py @@ -42,7 +42,7 @@ setup( "types-requests>=2.31.0,<2.32", ], "sentry": [ - "sentry-sdk>=1.15.0,<1.29", + "sentry-sdk>=1.15.0,<1.30", ], }, zip_safe=False, diff --git a/tools/python-requirements.txt b/tools/python-requirements.txt index 1248311a4..3b0445af3 100644 --- a/tools/python-requirements.txt +++ b/tools/python-requirements.txt @@ -1,8 +1,8 @@ bandit>=1.7.4,<1.8 black>=23.1.0,<24.0 -flake8>=6.0.0,<6.1 +flake8>=6.0.0,<6.2 isort>=5.12.0,<5.13 -mypy==1.4.1 +mypy==1.5.0 pylint>=2.16.1,<2.18 pytest-cov>=4.0.0,<4.2 pytest-xdist>=3.1.0,<3.4 diff --git a/worker/setup.py b/worker/setup.py index 399b165bd..c534e1fb4 100644 --- a/worker/setup.py +++ b/worker/setup.py @@ -26,7 +26,7 @@ setup( "types-requests>=2.31.0,<2.32", ], "sentry": [ - "sentry-sdk>=1.15.0,<1.29", + "sentry-sdk>=1.15.0,<1.30", ], }, zip_safe=False,