aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/advisory/auditor.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-06-29 00:03:00 +0900
committernsfisis <nsfisis@gmail.com>2026-06-29 00:03:00 +0900
commit9be0f98f71fe8071ab839ac1036b4064ac3172b4 (patch)
tree66a2f4feba752f4761c40449e0827ad74fc9b02c /crates/shirabe/src/advisory/auditor.rs
parenta84d531548efa678d4021cea891826e59f8fb462 (diff)
downloadphp-shirabe-9be0f98f71fe8071ab839ac1036b4064ac3172b4.tar.gz
php-shirabe-9be0f98f71fe8071ab839ac1036b4064ac3172b4.tar.zst
php-shirabe-9be0f98f71fe8071ab839ac1036b4064ac3172b4.zip
chore(lint): ban bare `use anyhow::Result` and fully qualify it
Add a no_banned_use linter that forbids importing anyhow::Result, and update all call sites to reference it via its fully-qualified path so it is never confused with std::result::Result. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/advisory/auditor.rs')
-rw-r--r--crates/shirabe/src/advisory/auditor.rs20
1 files changed, 11 insertions, 9 deletions
diff --git a/crates/shirabe/src/advisory/auditor.rs b/crates/shirabe/src/advisory/auditor.rs
index be78f4b..662a940 100644
--- a/crates/shirabe/src/advisory/auditor.rs
+++ b/crates/shirabe/src/advisory/auditor.rs
@@ -10,7 +10,6 @@ use crate::package::PackageInterfaceHandle;
use crate::package::base_package;
use crate::repository::RepositorySet;
use crate::util::PackageInfo;
-use anyhow::Result;
use indexmap::IndexMap;
use shirabe_external_packages::composer::pcre::Preg;
use shirabe_external_packages::symfony::console::formatter::OutputFormatter;
@@ -37,7 +36,10 @@ struct AuditJsonReport<'a> {
/// PHP `json_encode` emits an empty associative array as `[]`, not `{}`. Mirror that so an empty
/// map serializes as an empty JSON array.
-fn serialize_php_array<S, V>(map: &IndexMap<String, V>, serializer: S) -> Result<S::Ok, S::Error>
+fn serialize_php_array<S, V>(
+ map: &IndexMap<String, V>,
+ serializer: S,
+) -> anyhow::Result<S::Ok, S::Error>
where
S: serde::Serializer,
V: serde::Serialize,
@@ -54,7 +56,7 @@ where
fn serialize_advisories_field<S>(
map: &&IndexMap<String, Vec<AnySecurityAdvisory>>,
serializer: S,
-) -> Result<S::Ok, S::Error>
+) -> anyhow::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
@@ -64,7 +66,7 @@ where
fn serialize_abandoned_field<S>(
map: &IndexMap<String, Option<String>>,
serializer: S,
-) -> Result<S::Ok, S::Error>
+) -> anyhow::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
@@ -120,7 +122,7 @@ impl Auditor {
ignored_severities: IndexMap<String, Option<String>>,
ignore_unreachable: bool,
ignore_abandoned: IndexMap<String, Option<String>>,
- ) -> Result<i64> {
+ ) -> anyhow::Result<i64> {
let result = repo_set.get_matching_security_advisories(
packages.clone(),
format == Self::FORMAT_SUMMARY,
@@ -426,7 +428,7 @@ impl Auditor {
io: &mut dyn IOInterface,
advisories: &IndexMap<String, Vec<AnySecurityAdvisory>>,
format: &str,
- ) -> Result<()> {
+ ) -> anyhow::Result<()> {
match format {
Self::FORMAT_TABLE => {
let io_as_console = io.as_any().downcast_ref::<ConsoleIO>();
@@ -463,7 +465,7 @@ impl Auditor {
&self,
io: &ConsoleIO,
advisories: &IndexMap<String, Vec<AnySecurityAdvisory>>,
- ) -> Result<()> {
+ ) -> anyhow::Result<()> {
for package_advisories in advisories.values() {
for advisory in package_advisories {
let mut headers: Vec<String> = vec![
@@ -524,7 +526,7 @@ impl Auditor {
&self,
io: &mut dyn IOInterface,
advisories: &IndexMap<String, Vec<AnySecurityAdvisory>>,
- ) -> Result<()> {
+ ) -> anyhow::Result<()> {
let mut error: Vec<String> = vec![];
let mut first_advisory = true;
for package_advisories in advisories.values() {
@@ -572,7 +574,7 @@ impl Auditor {
io: &mut dyn IOInterface,
packages: &[CompletePackageInterfaceHandle],
format: &str,
- ) -> Result<()> {
+ ) -> anyhow::Result<()> {
io.write_error(&format!(
"<error>Found {} abandoned package{}:</error>",
packages.len() as i64,