aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/downloader
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-06-28 17:45:06 +0900
committernsfisis <nsfisis@gmail.com>2026-06-28 17:45:26 +0900
commit53f1fb395f33e0fb8db9aebd09ea9082f650f9f1 (patch)
treef9e8bf0e9d4b1e98cce383574fb6a13b684fff08 /crates/shirabe/src/downloader
parent212f5cd75b1403ee75ffa44d7ebdb181174340c0 (diff)
downloadphp-shirabe-53f1fb395f33e0fb8db9aebd09ea9082f650f9f1.tar.gz
php-shirabe-53f1fb395f33e0fb8db9aebd09ea9082f650f9f1.tar.zst
php-shirabe-53f1fb395f33e0fb8db9aebd09ea9082f650f9f1.zip
refactor: add linter
Diffstat (limited to 'crates/shirabe/src/downloader')
-rw-r--r--crates/shirabe/src/downloader/archive_downloader.rs15
-rw-r--r--crates/shirabe/src/downloader/change_report_interface.rs3
-rw-r--r--crates/shirabe/src/downloader/download_manager.rs13
-rw-r--r--crates/shirabe/src/downloader/dvcs_downloader_interface.rs3
-rw-r--r--crates/shirabe/src/downloader/file_downloader.rs24
-rw-r--r--crates/shirabe/src/downloader/git_downloader.rs17
-rw-r--r--crates/shirabe/src/downloader/mod.rs47
-rw-r--r--crates/shirabe/src/downloader/path_downloader.rs17
-rw-r--r--crates/shirabe/src/downloader/svn_downloader.rs9
-rw-r--r--crates/shirabe/src/downloader/vcs_downloader.rs15
10 files changed, 53 insertions, 110 deletions
diff --git a/crates/shirabe/src/downloader/archive_downloader.rs b/crates/shirabe/src/downloader/archive_downloader.rs
index b1bdee7..4744bc2 100644
--- a/crates/shirabe/src/downloader/archive_downloader.rs
+++ b/crates/shirabe/src/downloader/archive_downloader.rs
@@ -1,5 +1,12 @@
//! ref: composer/src/Composer/Downloader/ArchiveDownloader.php
+use crate::dependency_resolver::operation::InstallOperation;
+use crate::downloader::DownloaderInterface;
+use crate::downloader::FileDownloader;
+use crate::io::IOInterfaceImmutable;
+use crate::package::PackageInterfaceHandle;
+use crate::util::Filesystem;
+use crate::util::Platform;
use anyhow::Result;
use indexmap::IndexMap;
use shirabe_external_packages::symfony::finder::Finder;
@@ -9,14 +16,6 @@ use shirabe_php_shim::{
};
use std::path::{Path, PathBuf};
-use crate::dependency_resolver::operation::InstallOperation;
-use crate::downloader::DownloaderInterface;
-use crate::downloader::FileDownloader;
-use crate::io::IOInterfaceImmutable;
-use crate::package::PackageInterfaceHandle;
-use crate::util::Filesystem;
-use crate::util::Platform;
-
pub trait ArchiveDownloader {
fn inner(&self) -> &FileDownloader;
fn inner_mut(&mut self) -> &mut FileDownloader;
diff --git a/crates/shirabe/src/downloader/change_report_interface.rs b/crates/shirabe/src/downloader/change_report_interface.rs
index 718b2c1..ca2a113 100644
--- a/crates/shirabe/src/downloader/change_report_interface.rs
+++ b/crates/shirabe/src/downloader/change_report_interface.rs
@@ -1,8 +1,7 @@
//! ref: composer/src/Composer/Downloader/ChangeReportInterface.php
-use anyhow::Result;
-
use crate::package::PackageInterfaceHandle;
+use anyhow::Result;
pub trait ChangeReportInterface {
fn get_local_changes(
diff --git a/crates/shirabe/src/downloader/download_manager.rs b/crates/shirabe/src/downloader/download_manager.rs
index b978368..82bf4bb 100644
--- a/crates/shirabe/src/downloader/download_manager.rs
+++ b/crates/shirabe/src/downloader/download_manager.rs
@@ -1,6 +1,12 @@
//! ref: composer/src/Composer/Downloader/DownloadManager.php
+use crate::downloader::DownloaderInterface;
+use crate::exception::IrrecoverableDownloadException;
+use crate::io::IOInterface;
+use crate::io::IOInterfaceImmutable;
use crate::io::io_interface;
+use crate::package::PackageInterfaceHandle;
+use crate::util::Filesystem;
use anyhow::Result;
use indexmap::IndexMap;
use shirabe_external_packages::composer::pcre::Preg;
@@ -10,13 +16,6 @@ use shirabe_php_shim::{
strtolower, usort,
};
-use crate::downloader::DownloaderInterface;
-use crate::exception::IrrecoverableDownloadException;
-use crate::io::IOInterface;
-use crate::io::IOInterfaceImmutable;
-use crate::package::PackageInterfaceHandle;
-use crate::util::Filesystem;
-
/// Downloaders manager.
#[derive(Debug)]
pub struct DownloadManager {
diff --git a/crates/shirabe/src/downloader/dvcs_downloader_interface.rs b/crates/shirabe/src/downloader/dvcs_downloader_interface.rs
index 59f5774..e33aa46 100644
--- a/crates/shirabe/src/downloader/dvcs_downloader_interface.rs
+++ b/crates/shirabe/src/downloader/dvcs_downloader_interface.rs
@@ -1,8 +1,7 @@
//! ref: composer/src/Composer/Downloader/DvcsDownloaderInterface.php
-use anyhow::Result;
-
use crate::package::PackageInterfaceHandle;
+use anyhow::Result;
pub trait DvcsDownloaderInterface {
fn get_unpushed_changes(
diff --git a/crates/shirabe/src/downloader/file_downloader.rs b/crates/shirabe/src/downloader/file_downloader.rs
index 66f3390..d3e1f6c 100644
--- a/crates/shirabe/src/downloader/file_downloader.rs
+++ b/crates/shirabe/src/downloader/file_downloader.rs
@@ -1,18 +1,5 @@
//! ref: composer/src/Composer/Downloader/FileDownloader.php
-use crate::io::io_interface;
-use anyhow::Result;
-use indexmap::IndexMap;
-use std::sync::{LazyLock, Mutex};
-
-use crate::util::Silencer;
-use shirabe_php_shim::{
- DIRECTORY_SEPARATOR, InvalidArgumentException, PATHINFO_BASENAME, PATHINFO_EXTENSION,
- PHP_URL_PATH, PhpMixed, RuntimeException, UnexpectedValueException, array_search, file_exists,
- filesize, get_class, hash, hash_file, in_array, is_dir, is_executable, parse_url, pathinfo,
- realpath, rtrim, spl_object_hash, strlen, strpos, strtr, trim, umask, usleep,
-};
-
use crate::cache::Cache;
use crate::config::Config;
use crate::dependency_resolver::operation::InstallOperation;
@@ -27,13 +14,24 @@ use crate::exception::IrrecoverableDownloadException;
use crate::io::IOInterface;
use crate::io::IOInterfaceImmutable;
use crate::io::NullIO;
+use crate::io::io_interface;
use crate::package::PackageInterfaceHandle;
use crate::package::comparer::Comparer;
use crate::util::Filesystem;
use crate::util::HttpDownloader;
use crate::util::Platform;
use crate::util::ProcessExecutor;
+use crate::util::Silencer;
use crate::util::Url as UrlUtil;
+use anyhow::Result;
+use indexmap::IndexMap;
+use shirabe_php_shim::{
+ DIRECTORY_SEPARATOR, InvalidArgumentException, PATHINFO_BASENAME, PATHINFO_EXTENSION,
+ PHP_URL_PATH, PhpMixed, RuntimeException, UnexpectedValueException, array_search, file_exists,
+ filesize, get_class, hash, hash_file, in_array, is_dir, is_executable, parse_url, pathinfo,
+ realpath, rtrim, spl_object_hash, strlen, strpos, strtr, trim, umask, usleep,
+};
+use std::sync::{LazyLock, Mutex};
/// @var array<string, int|string>
/// @private
diff --git a/crates/shirabe/src/downloader/git_downloader.rs b/crates/shirabe/src/downloader/git_downloader.rs
index fd044f8..dc27e0c 100644
--- a/crates/shirabe/src/downloader/git_downloader.rs
+++ b/crates/shirabe/src/downloader/git_downloader.rs
@@ -1,14 +1,5 @@
//! ref: composer/src/Composer/Downloader/GitDownloader.php
-use crate::io::io_interface;
-use anyhow::Result;
-use indexmap::IndexMap;
-use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
-use shirabe_php_shim::{
- PhpMixed, RuntimeException, array_map, basename, dirname, implode, in_array, is_dir,
- preg_quote, realpath, rtrim, strlen, strpos, substr, trim, version_compare,
-};
-
use crate::cache::Cache;
use crate::config::Config;
use crate::downloader::ChangeReportInterface;
@@ -18,12 +9,20 @@ use crate::downloader::VcsDownloader;
use crate::downloader::VcsDownloaderBase;
use crate::io::IOInterface;
use crate::io::IOInterfaceImmutable;
+use crate::io::io_interface;
use crate::package::PackageInterfaceHandle;
use crate::util::Filesystem;
use crate::util::Git as GitUtil;
use crate::util::Platform;
use crate::util::ProcessExecutor;
use crate::util::Url;
+use anyhow::Result;
+use indexmap::IndexMap;
+use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
+use shirabe_php_shim::{
+ PhpMixed, RuntimeException, array_map, basename, dirname, implode, in_array, is_dir,
+ preg_quote, realpath, rtrim, strlen, strpos, substr, trim, version_compare,
+};
#[derive(Debug)]
pub struct GitDownloader {
diff --git a/crates/shirabe/src/downloader/mod.rs b/crates/shirabe/src/downloader/mod.rs
deleted file mode 100644
index 4f7641b..0000000
--- a/crates/shirabe/src/downloader/mod.rs
+++ /dev/null
@@ -1,47 +0,0 @@
-pub mod archive_downloader;
-pub mod change_report_interface;
-pub mod download_manager;
-pub mod downloader_interface;
-pub mod dvcs_downloader_interface;
-pub mod file_downloader;
-pub mod filesystem_exception;
-pub mod fossil_downloader;
-pub mod git_downloader;
-pub mod gzip_downloader;
-pub mod hg_downloader;
-pub mod max_file_size_exceeded_exception;
-pub mod path_downloader;
-pub mod perforce_downloader;
-pub mod phar_downloader;
-pub mod rar_downloader;
-pub mod svn_downloader;
-pub mod tar_downloader;
-pub mod transport_exception;
-pub mod vcs_capable_downloader_interface;
-pub mod vcs_downloader;
-pub mod xz_downloader;
-pub mod zip_downloader;
-
-pub use archive_downloader::*;
-pub use change_report_interface::*;
-pub use download_manager::*;
-pub use downloader_interface::*;
-pub use dvcs_downloader_interface::*;
-pub use file_downloader::*;
-pub use filesystem_exception::*;
-pub use fossil_downloader::*;
-pub use git_downloader::*;
-pub use gzip_downloader::*;
-pub use hg_downloader::*;
-pub use max_file_size_exceeded_exception::*;
-pub use path_downloader::*;
-pub use perforce_downloader::*;
-pub use phar_downloader::*;
-pub use rar_downloader::*;
-pub use svn_downloader::*;
-pub use tar_downloader::*;
-pub use transport_exception::*;
-pub use vcs_capable_downloader_interface::*;
-pub use vcs_downloader::*;
-pub use xz_downloader::*;
-pub use zip_downloader::*;
diff --git a/crates/shirabe/src/downloader/path_downloader.rs b/crates/shirabe/src/downloader/path_downloader.rs
index 694f758..cfd4889 100644
--- a/crates/shirabe/src/downloader/path_downloader.rs
+++ b/crates/shirabe/src/downloader/path_downloader.rs
@@ -1,14 +1,5 @@
//! ref: composer/src/Composer/Downloader/PathDownloader.php
-use crate::io::io_interface;
-use anyhow::Result;
-use indexmap::IndexMap;
-use shirabe_external_packages::symfony::filesystem::Filesystem as SymfonyFilesystem;
-use shirabe_php_shim::{
- DIRECTORY_SEPARATOR, PHP_WINDOWS_VERSION_MAJOR, PHP_WINDOWS_VERSION_MINOR, PhpMixed,
- RuntimeException, file_exists, function_exists, is_dir, realpath,
-};
-
use crate::cache::Cache;
use crate::config::Config;
use crate::dependency_resolver::operation::InstallOperation;
@@ -19,6 +10,7 @@ use crate::downloader::VcsCapableDownloaderInterface;
use crate::event_dispatcher::EventDispatcher;
use crate::io::IOInterface;
use crate::io::IOInterfaceImmutable;
+use crate::io::io_interface;
use crate::package::PackageInterfaceHandle;
use crate::package::archiver::ArchivableFilesFinder;
use crate::package::dumper::ArrayDumper;
@@ -28,6 +20,13 @@ use crate::util::Filesystem;
use crate::util::HttpDownloader;
use crate::util::Platform;
use crate::util::ProcessExecutor;
+use anyhow::Result;
+use indexmap::IndexMap;
+use shirabe_external_packages::symfony::filesystem::Filesystem as SymfonyFilesystem;
+use shirabe_php_shim::{
+ DIRECTORY_SEPARATOR, PHP_WINDOWS_VERSION_MAJOR, PHP_WINDOWS_VERSION_MINOR, PhpMixed,
+ RuntimeException, file_exists, function_exists, is_dir, realpath,
+};
#[derive(Debug)]
pub struct PathDownloader {
diff --git a/crates/shirabe/src/downloader/svn_downloader.rs b/crates/shirabe/src/downloader/svn_downloader.rs
index 8c13a05..cd48dae 100644
--- a/crates/shirabe/src/downloader/svn_downloader.rs
+++ b/crates/shirabe/src/downloader/svn_downloader.rs
@@ -1,10 +1,5 @@
//! ref: composer/src/Composer/Downloader/SvnDownloader.php
-use crate::io::io_interface;
-use indexmap::IndexMap;
-use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
-use shirabe_php_shim::{PhpMixed, RuntimeException, is_dir, version_compare};
-
use crate::config::Config;
use crate::downloader::ChangeReportInterface;
use crate::downloader::DownloaderInterface;
@@ -13,11 +8,15 @@ use crate::downloader::VcsDownloader;
use crate::downloader::VcsDownloaderBase;
use crate::io::IOInterface;
use crate::io::IOInterfaceImmutable;
+use crate::io::io_interface;
use crate::package::PackageInterfaceHandle;
use crate::repository::VcsRepository;
use crate::util::Filesystem;
use crate::util::ProcessExecutor;
use crate::util::Svn as SvnUtil;
+use indexmap::IndexMap;
+use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
+use shirabe_php_shim::{PhpMixed, RuntimeException, is_dir, version_compare};
#[derive(Debug)]
pub struct SvnDownloader {
diff --git a/crates/shirabe/src/downloader/vcs_downloader.rs b/crates/shirabe/src/downloader/vcs_downloader.rs
index 8084c37..1c89571 100644
--- a/crates/shirabe/src/downloader/vcs_downloader.rs
+++ b/crates/shirabe/src/downloader/vcs_downloader.rs
@@ -1,13 +1,5 @@
//! ref: composer/src/Composer/Downloader/VcsDownloader.php
-use crate::io::io_interface;
-use anyhow::Result;
-use indexmap::IndexMap;
-use shirabe_php_shim::{
- InvalidArgumentException, PhpMixed, RuntimeException, array_map, array_shift, explode,
- get_class_err, implode, rawurldecode, realpath, str_replace, strlen, strpos, substr, trim,
-};
-
use crate::config::Config;
use crate::dependency_resolver::operation::InstallOperation;
use crate::dependency_resolver::operation::UninstallOperation;
@@ -17,12 +9,19 @@ use crate::downloader::DownloaderInterface;
use crate::downloader::VcsCapableDownloaderInterface;
use crate::io::IOInterface;
use crate::io::IOInterfaceImmutable;
+use crate::io::io_interface;
use crate::package::PackageInterfaceHandle;
use crate::package::dumper::ArrayDumper;
use crate::package::version::VersionGuesser;
use crate::package::version::VersionParser;
use crate::util::Filesystem;
use crate::util::ProcessExecutor;
+use anyhow::Result;
+use indexmap::IndexMap;
+use shirabe_php_shim::{
+ InvalidArgumentException, PhpMixed, RuntimeException, array_map, array_shift, explode,
+ get_class_err, implode, rawurldecode, realpath, str_replace, strlen, strpos, substr, trim,
+};
#[derive(Debug)]
pub struct VcsDownloaderBase {