aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-02-14 15:10:41 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-02-14 15:10:41 +0000
commit1a9417a6ac1436eeefed1408c9dfe32b7d87448b (patch)
tree2ab9981481de56bb88424dbf2f5fc0fa25a1fb53
parent600d47f1dc00facc7a72b53b072748b8b4263fce (diff)
downloadpaludis-1a9417a6ac1436eeefed1408c9dfe32b7d87448b.tar.gz
paludis-1a9417a6ac1436eeefed1408c9dfe32b7d87448b.tar.xz
QA check importance
-rw-r--r--paludis/qa/check.hh5
-rw-r--r--paludis/qa/file_name_check.hh5
-rw-r--r--paludis/qa/package_name_check.hh5
-rw-r--r--src/qualudis/qualudis.cc14
4 files changed, 29 insertions, 0 deletions
diff --git a/paludis/qa/check.hh b/paludis/qa/check.hh
index 47ab5b4..5ebb068 100644
--- a/paludis/qa/check.hh
+++ b/paludis/qa/check.hh
@@ -48,6 +48,11 @@ namespace paludis
public:
virtual std::string describe() const = 0;
+
+ virtual bool is_important() const
+ {
+ return false;
+ }
};
}
}
diff --git a/paludis/qa/file_name_check.hh b/paludis/qa/file_name_check.hh
index 6679c82..3baa2c7 100644
--- a/paludis/qa/file_name_check.hh
+++ b/paludis/qa/file_name_check.hh
@@ -41,6 +41,11 @@ namespace paludis
{
return "Checks that the file name is legal";
}
+
+ virtual bool is_important() const
+ {
+ return true;
+ }
};
static const FileCheckMaker::RegisterMaker register_file_name_check(
diff --git a/paludis/qa/package_name_check.hh b/paludis/qa/package_name_check.hh
index 1386f80..8bcefde 100644
--- a/paludis/qa/package_name_check.hh
+++ b/paludis/qa/package_name_check.hh
@@ -41,6 +41,11 @@ namespace paludis
{
return "Checks that the category/package name is valid";
}
+
+ virtual bool is_important() const
+ {
+ return true;
+ }
};
static const PackageDirCheckMaker::RegisterMaker register_package_name_check(
diff --git a/src/qualudis/qualudis.cc b/src/qualudis/qualudis.cc
index 125848c..709c933 100644
--- a/src/qualudis/qualudis.cc
+++ b/src/qualudis/qualudis.cc
@@ -129,11 +129,25 @@ namespace
}
}
+ template <typename VC_>
+ struct IsImportant :
+ std::binary_function<bool, std::string, std::string>
+ {
+ bool operator() (const std::string & k1, const std::string & k2) const
+ {
+ return (*VC_::get_instance()->find_maker(k1))()->is_important() >
+ (*VC_::get_instance()->find_maker(k2))()->is_important();
+ }
+ };
+
template <typename VC_, typename P_>
void do_check_kind(bool & ok, bool & fatal, const P_ & value)
{
std::list<std::string> checks;
VC_::get_instance()->copy_keys(std::back_inserter(checks));
+ checks.sort();
+ checks.sort(IsImportant<VC_>());
+
for (std::list<std::string>::const_iterator i(checks.begin()),
i_end(checks.end()) ; i != i_end ; ++i)
{