summaryrefslogtreecommitdiffstats
path: root/tests/hawd/modules/check.cpp
diff options
context:
space:
mode:
authorAaron Seigo <aseigo@kde.org>2014-12-09 22:56:15 +0100
committerAaron Seigo <aseigo@kde.org>2014-12-11 01:01:13 +0100
commit1b29e4a6e8fb9a27a96bdfadb69b12cc2436db6e (patch)
tree82550f5a56eb8be86256efeef0b356a719644ae0 /tests/hawd/modules/check.cpp
parent326d6181e6a71e5ff4c82784ada7af3f55ec6e05 (diff)
downloadsink-1b29e4a6e8fb9a27a96bdfadb69b12cc2436db6e.tar.gz
sink-1b29e4a6e8fb9a27a96bdfadb69b12cc2436db6e.zip
add a checkall
Diffstat (limited to 'tests/hawd/modules/check.cpp')
-rw-r--r--tests/hawd/modules/check.cpp30
1 files changed, 20 insertions, 10 deletions
diff --git a/tests/hawd/modules/check.cpp b/tests/hawd/modules/check.cpp
index 1359b3d..e334fb8 100644
--- a/tests/hawd/modules/check.cpp
+++ b/tests/hawd/modules/check.cpp
@@ -29,12 +29,30 @@
29namespace HAWD 29namespace HAWD
30{ 30{
31 31
32CheckAll::CheckAll()
33 : Module()
34{
35 setSyntax(Syntax("checkall", &CheckAll::check));
36}
37
38bool CheckAll::check(const QStringList &commands, State &state)
39{
40 QDir project(state.projectPath());
41 project.setFilter(QDir::Files | QDir::Readable | QDir::NoDotAndDotDot | QDir::NoSymLinks);
42 for (const QString &entry: project.entryList()) {
43 Check::checkFile(entry, state);
44 }
45
46 return true;
47}
48
32Check::Check() 49Check::Check()
33 : Module() 50 : Module()
34{ 51{
35 Syntax top("check", &Check::check); 52 Syntax top("check", &Check::check);
36 setDescription(QObject::tr("Checks a dataset description for validity and prints out any errors it finds"));
37 setSyntax(top); 53 setSyntax(top);
54
55 setDescription(QObject::tr("Checks a dataset description for validity and prints out any errors it finds"));
38} 56}
39 57
40bool Check::check(const QStringList &commands, State &state) 58bool Check::check(const QStringList &commands, State &state)
@@ -43,15 +61,7 @@ bool Check::check(const QStringList &commands, State &state)
43 std::cout << QObject::tr("Please provide the name of a dataset definition file. (Use the 'list' command to see available datasets.)").toStdString() << std::endl; 61 std::cout << QObject::tr("Please provide the name of a dataset definition file. (Use the 'list' command to see available datasets.)").toStdString() << std::endl;
44 } else { 62 } else {
45 for (const QString &name: commands) { 63 for (const QString &name: commands) {
46 if (name == "*") { 64 checkFile(name, state);
47 QDir project(state.projectPath());
48 project.setFilter(QDir::Files | QDir::Readable | QDir::NoDotAndDotDot | QDir::NoSymLinks);
49 for (const QString &entry: project.entryList()) {
50 checkFile(entry, state);
51 }
52 } else {
53 checkFile(name, state);
54 }
55 } 65 }
56 } 66 }
57 67