Skip to content

Commit

Permalink
Refactoring nits
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalchevrel committed Sep 11, 2024
1 parent 635a1b1 commit f15c0cb
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 23 deletions.
4 changes: 2 additions & 2 deletions app/classes/ReleaseInsights/Json.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}

Expand Down
2 changes: 1 addition & 1 deletion app/controllers/404.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

http_response_code(404);

(new ReleaseInsights\Template(
(new Template(
'regular.html.twig',
[
'page_title' => '404: Page Not Found',
Expand Down
4 changes: 0 additions & 4 deletions app/models/api/release_schedule.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
2 changes: 1 addition & 1 deletion app/models/api/wellness_days.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

use ReleaseInsights\{Release};

return (new ReleaseInsights\Data())->getWellnessDays();
return (new ReleaseInsights\Data())->getWellnessDays();
6 changes: 3 additions & 3 deletions app/models/nightly.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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']
Expand All @@ -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'] ?? [];
Expand Down
18 changes: 9 additions & 9 deletions app/models/past_release.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
Expand Down Expand Up @@ -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;
}
Expand All @@ -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(
Expand Down Expand Up @@ -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'
Expand All @@ -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'
Expand Down
4 changes: 2 additions & 2 deletions app/models/release_owners.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
Expand Down
6 changes: 5 additions & 1 deletion tests/Architecture/ArchitectureTest.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
<?php
arch()
->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');
Expand Down

0 comments on commit f15c0cb

Please sign in to comment.