Skip to content

Commit

Permalink
nit: Run pint through app
Browse files Browse the repository at this point in the history
  • Loading branch information
octfx committed Sep 14, 2024
1 parent 88eeba6 commit 4ad6e1b
Show file tree
Hide file tree
Showing 469 changed files with 2,315 additions and 4,087 deletions.
6 changes: 3 additions & 3 deletions app/Console/Commands/AbstractQueueCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ abstract class AbstractQueueCommand extends Command
protected $bar;

/**
* @inheritDoc
* {@inheritDoc}
*/
public function info($string, $verbosity = null): void
{
Expand All @@ -30,7 +30,7 @@ public function info($string, $verbosity = null): void
}

/**
* @inheritDoc
* {@inheritDoc}
*/
public function error($string, $verbosity = null): void
{
Expand All @@ -44,7 +44,7 @@ public function error($string, $verbosity = null): void
/**
* Creates a progressbar if output is not null
*
* @param int $size Progressbar size
* @param int $size Progressbar size
*/
public function createProgressBar(int $size): void
{
Expand Down
8 changes: 4 additions & 4 deletions app/Console/Commands/PopulateData.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ public function handle()
}
$this->bar->advance();

if (!$this->option('skipCommLinks')) {
if (! $this->option('skipCommLinks')) {
$this->info('Downloading and importing all missing Comm-Links.');
Artisan::call('comm-links:schedule');
}
$this->bar->advance();

if (!$this->option('skipGalactapedia')) {
if (! $this->option('skipGalactapedia')) {
$this->info('Downloading and importing all Galactapedia articles.');
Artisan::call('galactapedia:import-categories');
Artisan::call('galactapedia:import-articles');
Expand All @@ -52,13 +52,13 @@ public function handle()
Artisan::call('ship-matrix:download --import');
$this->bar->advance();

if (!$this->option('skipStarmap')) {
if (! $this->option('skipStarmap')) {
$this->info('Downloading and importing starmap.');
Artisan::call('starmap:download --import');
}
$this->bar->advance();

if (!$this->option('skipScUnpacked')) {
if (! $this->option('skipScUnpacked')) {
$this->info('Importing all Star Citizen Items.');
Artisan::call('sc:import-items');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ abstract class AbstractCommLinkCommand extends AbstractQueueCommand
*/
protected function parseOffset(): int
{
$offset = (int)$this->argument('offset');
$offset = (int) $this->argument('offset');

if ($offset <= 0) {
return self::FIRST_COMM_LINK_ID;
Expand Down
8 changes: 3 additions & 5 deletions app/Console/Commands/Rsi/CommLink/CommLinkSchedule.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,12 @@ class CommLinkSchedule extends Command
*
* @var string
*/
protected $description = 'Download missing Comm-Links. Parse the download, create metadata and hashes. ' .
'If a DeepL API key is set, Comm-Links will be translated. ' .
'If a MediaWiki Account is configured, Wiki Comm-Link pages will be created';
protected $description = 'Download missing Comm-Links. Parse the download, create metadata and hashes. '.
'If a DeepL API key is set, Comm-Links will be translated. '.
'If a MediaWiki Account is configured, Wiki Comm-Link pages will be created';

/**
* Execute the console command.
*
* @return int
*/
public function handle(): int
{
Expand Down
13 changes: 3 additions & 10 deletions app/Console/Commands/Rsi/CommLink/Download/DownloadCommLink.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,10 @@ class DownloadCommLink extends CommLinkCommand
*/
protected $description = 'Download Comm-Links with given IDs';

/**
* @var Dispatcher
*/
private Dispatcher $dispatcher;

/**
* Create a new command instance.
*
* @param Dispatcher $dispatcher
*/
public function __construct(Dispatcher $dispatcher)
{
Expand All @@ -53,8 +48,6 @@ public function __construct(Dispatcher $dispatcher)

/**
* Execute the console command.
*
* @return int
*/
public function handle(): int
{
Expand All @@ -65,7 +58,7 @@ static function ($id) {
)
->filter(
static function ($id) {
return (int)$id >= self::FIRST_COMM_LINK_ID;
return (int) $id >= self::FIRST_COMM_LINK_ID;
}
)
->tap(
Expand Down Expand Up @@ -103,7 +96,7 @@ private function dispatchImportJob(): void
{
$this->info("\nImporting Comm-Links");
$this->dispatcher->dispatch(new ImportCommLinks(30));
$this->dispatcher->dispatch(new CreateImageMetadata());
$this->dispatcher->dispatch(new CreateImageHashes());
$this->dispatcher->dispatch(new CreateImageMetadata);
$this->dispatcher->dispatch(new CreateImageHashes);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

/**
* Command Wrapper for Download Comm-Link Job
*
* @see DownloadCommLinkImagesJob
* @see DownloadCommLinkImage
*/
Expand All @@ -31,8 +32,6 @@ class DownloadCommLinkImages extends Command

/**
* Execute the console command.
*
* @return int
*/
public function handle(): int
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,11 @@ class ReDownloadCommLinks extends Command
*
* @var string
*/
protected $description = 'Re-Download all Database Comm-Links and parse them.' .
'Pass "--skip=false" to not skip already downloaded Comm-Links.';
protected $description = 'Re-Download all Database Comm-Links and parse them.'.
'Pass "--skip=false" to not skip already downloaded Comm-Links.';

/**
* Execute the console command.
*
* @return int
*/
public function handle(): int
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function handle(): int
->whereNull('base_image_id')
//->whereRelation('metadata', 'size', '>=', 250 * 1024)
->with([
'metadata' => fn($query) => $query->orderBy('size', 'DESC'),
'metadata' => fn ($query) => $query->orderBy('size', 'DESC'),
]);

if ($this->option('recent') === true) {
Expand Down
4 changes: 0 additions & 4 deletions app/Console/Commands/Rsi/CommLink/Image/CreateImageHashes.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ class CreateImageHashes extends QueueCommand

/**
* Execute the console command.
*
* @return int
*/
public function handle(): int
{
Expand Down Expand Up @@ -59,8 +57,6 @@ function (Image $image) {
/**
* The images to create hashes for
* Image needs to have an attached comm link and metadata
*
* @return Builder
*/
private function getImages(): Builder
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ class CreateImageMetadata extends QueueCommand

/**
* Execute the console command.
*
* @return int
*/
public function handle(): int
{
Expand Down
3 changes: 0 additions & 3 deletions app/Console/Commands/Rsi/CommLink/Image/SyncImageIds.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
namespace App\Console\Commands\Rsi\CommLink\Image;

use App\Console\Commands\Rsi\CommLink\AbstractCommLinkCommand as CommLinkCommand;
use Illuminate\Bus\Dispatcher;

class SyncImageIds extends CommLinkCommand
{
Expand All @@ -25,8 +24,6 @@ class SyncImageIds extends CommLinkCommand

/**
* Execute the console command.
*
* @return int
*/
public function handle(): int
{
Expand Down
7 changes: 3 additions & 4 deletions app/Console/Commands/Rsi/CommLink/ImportCommLink.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,12 @@ class ImportCommLink extends Command

/**
* Execute the console command.
*
* @return int
*/
public function handle(): int
{
if ($this->option('all') === true) {
ImportCommLinksJob::dispatch(-1);

return Command::SUCCESS;
}

Expand All @@ -47,14 +46,14 @@ public function handle(): int
return Command::FAILURE;
}

$id = (int)$this->argument('id');
$id = (int) $this->argument('id');

try {
$commLink = CommLink::query()->where('cig_id', $id)->firstOrFail();
} catch (ModelNotFoundException $e) {
return Artisan::call('comm-links:download', [
'id' => $id,
'--import' => true
'--import' => true,
]);
}

Expand Down
5 changes: 1 addition & 4 deletions app/Console/Commands/Rsi/CommLink/TranslateCommLinks.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,12 @@ class TranslateCommLinks extends CommLinkCommand

/**
* Execute the console command.
*
* @return int
*/
public function handle(): int
{
$this->info('Dispatching Comm-Link Translation');

$modifiedTime = (int)$this->argument('modifiedTime');
$modifiedTime = (int) $this->argument('modifiedTime');

if ($modifiedTime > 0) {
$this->info("Including Comm-Links that were created in the last '{$modifiedTime}' minutes");
Expand All @@ -44,7 +42,6 @@ public function handle(): int
}

TranslateCommLinksJob::dispatch($this->filterDirectories('comm_links', $modifiedTime)->toArray());
;

return CommLinkCommand::SUCCESS;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ class CreateCommLinkWikiPages extends Command

/**
* Execute the console command.
*
* @return int
*/
public function handle(): int
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ class CreateCommLinkWikiTranslationPages extends Command

/**
* Execute the console command.
*
* @return int
*/
public function handle(): int
{
Expand Down
4 changes: 1 addition & 3 deletions app/Console/Commands/SC/ImportClothing.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,14 @@ class ImportClothing extends AbstractQueueCommand

/**
* Execute the console command.
*
* @return int
*/
public function handle(): int
{
return $this->call(
'sc:import-items',
[
'--skipVehicles',
'--type' => 'Char_Clothing_Torso_1,Char_Clothing_Legs,Char_Clothing_Torso_0,Char_Clothing_Feet,Char_Clothing_Hat,Char_Armor_Backpack,Char_Clothing_Hands,Char_Armor_Helmet,Char_Armor_Arms,Char_Armor_Torso,Char_Armor_Legs,Char_Armor_Undersuit,Char_Clothing_Torso_2,Char_Clothing_Backpack'
'--type' => 'Char_Clothing_Torso_1,Char_Clothing_Legs,Char_Clothing_Torso_0,Char_Clothing_Feet,Char_Clothing_Hat,Char_Armor_Backpack,Char_Clothing_Hands,Char_Armor_Helmet,Char_Armor_Arms,Char_Armor_Torso,Char_Armor_Legs,Char_Armor_Undersuit,Char_Clothing_Torso_2,Char_Clothing_Backpack',
]
);
}
Expand Down
3 changes: 1 addition & 2 deletions app/Console/Commands/SC/ImportItems.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use App\Console\Commands\AbstractQueueCommand;
use App\Jobs\SC\Import\ItemSpecificationCreator;
use App\Services\Parser\SC\Item;
use App\Services\Parser\SC\Labels;
use App\Services\Parser\SC\Manufacturers;
use Illuminate\Console\Command;
use Illuminate\Contracts\Filesystem\FileNotFoundException;
Expand Down Expand Up @@ -46,7 +45,7 @@ class ImportItems extends AbstractQueueCommand
*/
public function handle(): int
{
$manufacturers = (new Manufacturers())->getData();
$manufacturers = (new Manufacturers)->getData();

$files = File::allFiles(scdata('items')) + Storage::allFiles(scdata('ships'));

Expand Down
4 changes: 1 addition & 3 deletions app/Console/Commands/SC/ImportPersonalWeapons.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,14 @@ class ImportPersonalWeapons extends AbstractQueueCommand

/**
* Execute the console command.
*
* @return int
*/
public function handle(): int
{
return $this->call(
'sc:import-items',
[
'--skipVehicles',
'--type' => 'WeaponPersonal'
'--type' => 'WeaponPersonal',
]
);
}
Expand Down
3 changes: 1 addition & 2 deletions app/Console/Commands/SC/ImportShops.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,13 @@ class ImportShops extends AbstractQueueCommand

/**
* Execute the console command.
*
* @return int
*/
public function handle(): int
{
$this->info('Importing Shops');
ShopItems::dispatch();
$this->info('Done');

return Command::SUCCESS;
}
}
4 changes: 1 addition & 3 deletions app/Console/Commands/SC/ImportVehicleItems.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,14 @@ class ImportVehicleItems extends AbstractQueueCommand

/**
* Execute the console command.
*
* @return int
*/
public function handle(): int
{
return $this->call(
'sc:import-items',
[
'--skipVehicles',
'--type' => 'Armor,Battery,BombLauncher,Cooler,CoolerController,EMP,ExternalFuelTank,FlightController,FuelIntake,FuelTank,MainThruster,ManneuverThruster,Missile,MissileController,MissileLauncher,Paints,PowerPlant,QuantumDrive,QuantumFuelTank,QuantumInterdictionGenerator,Radar,SelfDestruct,Shield,ShieldController,ToolArm,Turret,TurretBase,UtilityTurret,WeaponDefensive,WeaponGun,WeaponMining,WeaponMount,WheeledController'
'--type' => 'Armor,Battery,BombLauncher,Cooler,CoolerController,EMP,ExternalFuelTank,FlightController,FuelIntake,FuelTank,MainThruster,ManneuverThruster,Missile,MissileController,MissileLauncher,Paints,PowerPlant,QuantumDrive,QuantumFuelTank,QuantumInterdictionGenerator,Radar,SelfDestruct,Shield,ShieldController,ToolArm,Turret,TurretBase,UtilityTurret,WeaponDefensive,WeaponGun,WeaponMining,WeaponMount,WheeledController',
]
);
}
Expand Down
2 changes: 1 addition & 1 deletion app/Console/Commands/SC/ImportVehicles.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function handle()
$this->bar->advance();
$chunk
->filter(function (array $vehicle) {
return $this->isNotIgnoredClass($vehicle['ClassName']);
return isset($vehicle['ClassName']) && $this->isNotIgnoredClass($vehicle['ClassName']);
})
->map(function (array $vehicle) {
$vehicle['filePathRaw'] = scdata(sprintf(
Expand Down
2 changes: 1 addition & 1 deletion app/Console/Commands/SC/Wiki/CreateCharArmorWikiPages.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,6 @@ protected function getManufacturerCode($model): string

public static function getNameForModel($model): string
{
return (new self())->getPageText($model);
return (new self)->getPageText($model);
}
}
Loading

0 comments on commit 4ad6e1b

Please sign in to comment.