diff --git a/app/classes/ReleaseInsights/Json.php b/app/classes/ReleaseInsights/Json.php index e949311..d52b15a 100644 --- a/app/classes/ReleaseInsights/Json.php +++ b/app/classes/ReleaseInsights/Json.php @@ -60,10 +60,10 @@ public function outputError(): string public function render(): void { if (array_key_exists('error', $this->data)) { - print_r($this->outputError()); + echo $this->outputError(); } else { $this->jsonp = $_GET['callback'] ?? false; - print_r($this->output()); + echo $this->output(); } } diff --git a/app/controllers/404.php b/app/controllers/404.php index f34e3e1..5e9c4b7 100644 --- a/app/controllers/404.php +++ b/app/controllers/404.php @@ -8,7 +8,7 @@ http_response_code(404); -(new ReleaseInsights\Template( +(new Template( 'regular.html.twig', [ 'page_title' => '404: Page Not Found', diff --git a/app/models/api/release_schedule.php b/app/models/api/release_schedule.php index d17c187..c4d958a 100644 --- a/app/models/api/release_schedule.php +++ b/app/models/api/release_schedule.php @@ -9,8 +9,4 @@ $requested_version = Version::get(); } -if ((int) $requested_version < BETA) { - // return ['error' => 'API only works with future release.']; -} - return (new Release($requested_version))->getSchedule(); diff --git a/app/models/api/wellness_days.php b/app/models/api/wellness_days.php index e9c3b4e..85e9a5f 100644 --- a/app/models/api/wellness_days.php +++ b/app/models/api/wellness_days.php @@ -4,4 +4,4 @@ use ReleaseInsights\{Release}; -return (new ReleaseInsights\Data())->getWellnessDays(); +return (new ReleaseInsights\Data())->getWellnessDays(); diff --git a/app/models/nightly.php b/app/models/nightly.php index 5f5dfa0..9c2a94b 100644 --- a/app/models/nightly.php +++ b/app/models/nightly.php @@ -3,7 +3,7 @@ declare(strict_types=1); use BzKarma\Scoring; -use ReleaseInsights\{Bugzilla as Bz, Json, URL, Utils}; +use ReleaseInsights\{Bugzilla, Json, URL, Utils}; /* We need previous and next days for navigation and changelog @@ -115,7 +115,7 @@ $bug_list_karma_details = []; foreach ($nightly_pairs as $dataset) { - $bugs = Bz::getBugsFromHgWeb( + $bugs = Bugzilla::getBugsFromHgWeb( URL::Mercurial->value . 'mozilla-central/json-pushes?fromchange=' . $dataset['prev_changeset'] @@ -136,7 +136,7 @@ continue; } - $url = Bz::getBugListLink($bugs); + $url = Bugzilla::getBugListLink($bugs); // Bugzilla REST API https://wiki.mozilla.org/Bugzilla:REST_API $bug_list_details = Json::load(URL::Bugzilla->value . 'rest/bug?include_fields=id,summary,priority,severity,keywords,product,component,type,duplicates,regressions,cf_webcompat_priority,cf_performance_impact,cf_tracking_firefox' . NIGHTLY . ',cf_tracking_firefox' . BETA . ',cf_tracking_firefox' . RELEASE . ',cf_status_firefox' . NIGHTLY . ',cf_status_firefox' . BETA . ',cf_status_firefox' . RELEASE . ',cc,see_also&bug_id=' . implode('%2C', $bugs))['bugs'] ?? []; diff --git a/app/models/past_release.php b/app/models/past_release.php index b981916..cb3a5cf 100644 --- a/app/models/past_release.php +++ b/app/models/past_release.php @@ -2,7 +2,7 @@ declare(strict_types=1); -use ReleaseInsights\{Bugzilla as Bz, Data, Json, Nightly, Release, URL, Utils, Version}; +use ReleaseInsights\{Bugzilla, Data, Json, Nightly, Release, URL, Version}; // Historical data from Product Details $firefox_releases = Json::load(URL::ProductDetails->value . 'firefox.json')['releases']; @@ -65,10 +65,10 @@ } if ($requested_version !== 53 && $requested_version > 46) { - $beta_uplifts = Bz::getBugsFromHgWeb($beta_changelog, true, -1); + $beta_uplifts = Bugzilla::getBugsFromHgWeb($beta_changelog, true, -1); $beta_changelog = str_replace('json-pushes', 'pushloghtml', $beta_changelog); - $beta_uplifts_url = Bz::getBugListLink($beta_uplifts['total']); - $beta_backouts_url = Bz::getBugListLink($beta_uplifts['backouts']); + $beta_uplifts_url = Bugzilla::getBugListLink($beta_uplifts['total']); + $beta_backouts_url = Bugzilla::getBugListLink($beta_uplifts['backouts']); if ($beta_uplifts['no_data']) { $beta_uplifts = false; } @@ -92,11 +92,11 @@ ); } -$rc_uplifts = Bz::getBugsFromHgWeb($rc_changelog, true, -1); +$rc_uplifts = Bugzilla::getBugsFromHgWeb($rc_changelog, true, -1); $rc_changelog = str_replace('json-pushes', 'pushloghtml', $rc_changelog); -$rc_uplifts_url = Bz::getBugListLink($rc_uplifts['total']); -$rc_backouts_url = Bz::getBugListLink($rc_uplifts['backouts']); +$rc_uplifts_url = Bugzilla::getBugListLink($rc_uplifts['total']); +$rc_backouts_url = Bugzilla::getBugListLink($rc_uplifts['backouts']); // Number of Beta builds $beta_count = count((array) array_filter( @@ -142,7 +142,7 @@ 126 was the big merge to mercurial for Firefox Android. We start from the commit after this merge */ - $nightly_fixes = Bz::getBugsFromHgWeb( + $nightly_fixes = Bugzilla::getBugsFromHgWeb( URL::Mercurial->value . 'mozilla-central/json-pushes' . '?fromchange=d14f32147b8133ced41921f303d0c9f22e2d4d8a' @@ -152,7 +152,7 @@ -1 ); } else { - $nightly_fixes = Bz::getBugsFromHgWeb( + $nightly_fixes = Bugzilla::getBugsFromHgWeb( URL::Mercurial->value .'mozilla-central/json-pushes' . '?fromchange=FIREFOX_NIGHTLY_' . ((int) $requested_version - 1) . '_END' diff --git a/app/models/release_owners.php b/app/models/release_owners.php index e03f5bd..ca4232b 100644 --- a/app/models/release_owners.php +++ b/app/models/release_owners.php @@ -2,11 +2,11 @@ declare(strict_types=1); -$release_owners = (new ReleaseInsights\Data())->getOwners(); +use ReleaseInsights\Data; // We need to remove the releases still in planning $releases = array_filter( - $release_owners, + (new Data())->getOwners(), fn ($k) => $k <= RELEASE, ARRAY_FILTER_USE_KEY ); diff --git a/tests/Architecture/ArchitectureTest.php b/tests/Architecture/ArchitectureTest.php index c4476f2..f65bf24 100644 --- a/tests/Architecture/ArchitectureTest.php +++ b/tests/Architecture/ArchitectureTest.php @@ -1,6 +1,10 @@ preset() + ->php() + ->ignoring(['debug_backtrace', 'die']); -test('Classes don\'t have stray debug calls') +test("Classes don't have stray debug calls") ->expect(['dd', 'dump', 'var_dump', 'error_log', 'ReleaseInsights\Debug']) ->not->toBeUsed() ->ignoring('ReleaseInsights\Performance');