Merge lp:~charlesk/indicator-datetime/add-cppcheck into lp:indicator-datetime/15.10

Proposed by Charles Kerr
Status: Needs review
Proposed branch: lp:~charlesk/indicator-datetime/add-cppcheck
Merge into: lp:indicator-datetime/15.10
Diff against target: 237 lines (+25/-16)
18 files modified
debian/control (+1/-0)
include/datetime/clock.h (+1/-1)
include/datetime/timezone-file.h (+1/-1)
src/awake.cpp (+1/-1)
src/clock.cpp (+1/-1)
src/exporter.cpp (+1/-1)
src/formatter-desktop.cpp (+1/-1)
src/haptic.cpp (+1/-1)
src/notifications.cpp (+1/-1)
src/planner-aggregate.cpp (+1/-1)
src/timezone-geoclue.cpp (+1/-1)
src/wakeup-timer-mainloop.cpp (+1/-1)
src/wakeup-timer-powerd.cpp (+1/-1)
tests/CMakeLists.txt (+8/-0)
tests/geoclue-fixture.h (+1/-1)
tests/test-dbus-fixture.h (+2/-2)
tests/test-timezone-geoclue.cpp (+1/-0)
tests/test-timezones.cpp (+0/-1)
To merge this branch: bzr merge lp:~charlesk/indicator-datetime/add-cppcheck
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Indicator Applet Developers Pending
Review via email: mp+266246@code.launchpad.net

Commit message

Add a cppcheck pass to the tests run by ctest.

Description of the change

Add a cppcheck pass to the tests run by ctest.

Various minor fixes spotted by cpptest; e.g. adding 'explicit' where applicable to single-argument ctors, removing dead stores

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
426. By Charles Kerr

sync with trunk

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Unmerged revisions

426. By Charles Kerr

sync with trunk

425. By Charles Kerr

suppress false pureVirtualCall cppcheck failure. Lambda code blocks in menu's ctor invokes a pure virtual function, but the lambda's not invoked until later after the ctor is finished

424. By Charles Kerr

fix dead store (cppcheck)

423. By Charles Kerr

fix unnecesssary c_str() call (cppcheck)

422. By Charles Kerr

fix dead store due to missing test condition (cppcheck)

421. By Charles Kerr

in the DBus test fixture, ensure the bus fields are initialized to nullptr when the fixture is constructed. (cppcheck)

420. By Charles Kerr

fix possible nullptr dereference (cppcheck)

419. By Charles Kerr

add 'explicit' keyword to single-argument ctors (cppcheck)

418. By Charles Kerr

add cppcheck to the standard 'make test' invocation

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'debian/control'
--- debian/control 2015-07-28 08:42:25 +0000
+++ debian/control 2015-09-10 14:07:25 +0000
@@ -19,6 +19,7 @@
19 libdbustest1-dev,19 libdbustest1-dev,
20 dbus-test-runner,20 dbus-test-runner,
21 python3-dbusmock,21 python3-dbusmock,
22 cppcheck,
22# for 12h/24h locale unit tests:23# for 12h/24h locale unit tests:
23 locales,24 locales,
24 language-pack-touch-en | language-pack-en-base,25 language-pack-touch-en | language-pack-en-base,
2526
=== modified file 'include/datetime/clock.h'
--- include/datetime/clock.h 2015-04-03 17:36:46 +0000
+++ include/datetime/clock.h 2015-09-10 14:07:25 +0000
@@ -74,7 +74,7 @@
74class LiveClock: public Clock74class LiveClock: public Clock
75{75{
76public:76public:
77 LiveClock (const std::shared_ptr<const Timezone>& zones);77 explicit LiveClock(const std::shared_ptr<const Timezone>& zones);
78 virtual ~LiveClock();78 virtual ~LiveClock();
79 virtual DateTime localtime() const override;79 virtual DateTime localtime() const override;
8080
8181
=== modified file 'include/datetime/timezone-file.h'
--- include/datetime/timezone-file.h 2014-09-13 20:45:23 +0000
+++ include/datetime/timezone-file.h 2015-09-10 14:07:25 +0000
@@ -34,7 +34,7 @@
34class FileTimezone: public Timezone34class FileTimezone: public Timezone
35{35{
36public:36public:
37 FileTimezone(const std::string& filename);37 explicit FileTimezone(const std::string& filename);
38 ~FileTimezone();38 ~FileTimezone();
3939
40private:40private:
4141
=== modified file 'src/awake.cpp'
--- src/awake.cpp 2015-03-31 18:54:26 +0000
+++ src/awake.cpp 2015-09-10 14:07:25 +0000
@@ -36,7 +36,7 @@
36{36{
37public:37public:
3838
39 Impl(const std::string& app_name):39 explicit Impl(const std::string& app_name):
40 m_app_name(app_name),40 m_app_name(app_name),
41 m_cancellable(g_cancellable_new())41 m_cancellable(g_cancellable_new())
42 {42 {
4343
=== modified file 'src/clock.cpp'
--- src/clock.cpp 2014-09-15 14:56:52 +0000
+++ src/clock.cpp 2015-09-10 14:07:25 +0000
@@ -40,7 +40,7 @@
40{40{
41public:41public:
4242
43 Impl(Clock& owner):43 explicit Impl(Clock& owner):
44 m_owner(owner),44 m_owner(owner),
45 m_cancellable(g_cancellable_new())45 m_cancellable(g_cancellable_new())
46 {46 {
4747
=== modified file 'src/exporter.cpp'
--- src/exporter.cpp 2014-09-02 15:37:03 +0000
+++ src/exporter.cpp 2015-09-10 14:07:25 +0000
@@ -37,7 +37,7 @@
37{37{
38public:38public:
3939
40 Impl(const std::shared_ptr<Settings>& settings):40 explicit Impl(const std::shared_ptr<Settings>& settings):
41 m_settings(settings),41 m_settings(settings),
42 m_alarm_props(datetime_alarm_properties_skeleton_new())42 m_alarm_props(datetime_alarm_properties_skeleton_new())
43 {43 {
4444
=== modified file 'src/formatter-desktop.cpp'
--- src/formatter-desktop.cpp 2014-03-28 00:25:34 +0000
+++ src/formatter-desktop.cpp 2015-09-10 14:07:25 +0000
@@ -46,7 +46,7 @@
46 {46 {
47 str = date_string;47 str = date_string;
48 }48 }
49 else // time_string49 else if (time_string)
50 {50 {
51 str = time_string;51 str = time_string;
52 }52 }
5353
=== modified file 'src/haptic.cpp'
--- src/haptic.cpp 2014-08-01 00:52:42 +0000
+++ src/haptic.cpp 2015-09-10 14:07:25 +0000
@@ -37,7 +37,7 @@
37{37{
38public:38public:
3939
40 Impl(const Mode& mode):40 explicit Impl(const Mode& mode):
41 m_mode(mode),41 m_mode(mode),
42 m_cancellable(g_cancellable_new())42 m_cancellable(g_cancellable_new())
43 {43 {
4444
=== modified file 'src/notifications.cpp'
--- src/notifications.cpp 2014-09-17 17:08:01 +0000
+++ src/notifications.cpp 2015-09-10 14:07:25 +0000
@@ -115,7 +115,7 @@
115115
116public:116public:
117117
118 Impl(const std::string& app_name):118 explicit Impl(const std::string& app_name):
119 m_app_name(app_name)119 m_app_name(app_name)
120 {120 {
121 if (!notify_init(app_name.c_str()))121 if (!notify_init(app_name.c_str()))
122122
=== modified file 'src/planner-aggregate.cpp'
--- src/planner-aggregate.cpp 2014-09-02 15:35:27 +0000
+++ src/planner-aggregate.cpp 2015-09-10 14:07:25 +0000
@@ -30,7 +30,7 @@
30class AggregatePlanner::Impl30class AggregatePlanner::Impl
31{31{
32public:32public:
33 Impl(AggregatePlanner* owner):33 explicit Impl(AggregatePlanner* owner):
34 m_owner(owner)34 m_owner(owner)
35 {35 {
36 }36 }
3737
=== modified file 'src/timezone-geoclue.cpp'
--- src/timezone-geoclue.cpp 2014-09-13 20:45:23 +0000
+++ src/timezone-geoclue.cpp 2015-09-10 14:07:25 +0000
@@ -36,7 +36,7 @@
3636
37public:37public:
3838
39 Impl(GeoclueTimezone& owner):39 explicit Impl(GeoclueTimezone& owner):
40 m_owner(owner),40 m_owner(owner),
41 m_cancellable(g_cancellable_new())41 m_cancellable(g_cancellable_new())
42 {42 {
4343
=== modified file 'src/wakeup-timer-mainloop.cpp'
--- src/wakeup-timer-mainloop.cpp 2014-06-10 14:00:14 +0000
+++ src/wakeup-timer-mainloop.cpp 2015-09-10 14:07:25 +0000
@@ -36,7 +36,7 @@
3636
37public:37public:
3838
39 Impl(const std::shared_ptr<Clock>& clock):39 explicit Impl(const std::shared_ptr<Clock>& clock):
40 m_clock(clock)40 m_clock(clock)
41 {41 {
42 }42 }
4343
=== modified file 'src/wakeup-timer-powerd.cpp'
--- src/wakeup-timer-powerd.cpp 2014-11-04 18:27:27 +0000
+++ src/wakeup-timer-powerd.cpp 2015-09-10 14:07:25 +0000
@@ -38,7 +38,7 @@
38{38{
39public:39public:
4040
41 Impl(const std::shared_ptr<Clock>& clock):41 explicit Impl(const std::shared_ptr<Clock>& clock):
42 m_clock(clock),42 m_clock(clock),
43 m_cancellable(g_cancellable_new())43 m_cancellable(g_cancellable_new())
44 {44 {
4545
=== modified file 'tests/CMakeLists.txt'
--- tests/CMakeLists.txt 2015-07-22 12:00:11 +0000
+++ tests/CMakeLists.txt 2015-09-10 14:07:25 +0000
@@ -36,6 +36,14 @@
36include_directories (${CMAKE_CURRENT_BINARY_DIR})36include_directories (${CMAKE_CURRENT_BINARY_DIR})
37include_directories (${DBUSTEST_INCLUDE_DIRS})37include_directories (${DBUSTEST_INCLUDE_DIRS})
3838
39add_test(cppcheck cppcheck
40 --quiet
41 --enable=all
42 --error-exitcode=2
43 --suppress=pureVirtualCall
44 -I${CMAKE_SOURCE_DIR}/include
45 ${CMAKE_SOURCE_DIR}/src
46 ${CMAKE_SOURCE_DIR}/tests)
3947
40add_definitions (-DSANDBOX="${CMAKE_CURRENT_BINARY_DIR}")48add_definitions (-DSANDBOX="${CMAKE_CURRENT_BINARY_DIR}")
4149
4250
=== modified file 'tests/geoclue-fixture.h'
--- tests/geoclue-fixture.h 2014-09-17 16:51:51 +0000
+++ tests/geoclue-fixture.h 2015-09-10 14:07:25 +0000
@@ -146,7 +146,7 @@
146146
147 void setGeoclueTimezoneOnIdle (const std::string& newZone)147 void setGeoclueTimezoneOnIdle (const std::string& newZone)
148 {148 {
149 g_timeout_add (50, emit_address_changed_idle, new EmitAddressChangedData(mock, obj_geo_addr, newZone.c_str()));149 g_timeout_add (50, emit_address_changed_idle, new EmitAddressChangedData(mock, obj_geo_addr, newZone));
150 }150 }
151151
152};152};
153153
=== modified file 'tests/test-dbus-fixture.h'
--- tests/test-dbus-fixture.h 2014-09-17 16:51:51 +0000
+++ tests/test-dbus-fixture.h 2015-09-10 14:07:25 +0000
@@ -65,8 +65,8 @@
6565
66 protected:66 protected:
6767
68 GTestDBus * test_dbus;68 GTestDBus * test_dbus = nullptr;
69 GDBusConnection * system_bus;69 GDBusConnection * system_bus = nullptr;
70 const std::vector<std::string> service_dirs;70 const std::vector<std::string> service_dirs;
7171
72 virtual void SetUp() override72 virtual void SetUp() override
7373
=== modified file 'tests/test-timezone-geoclue.cpp'
--- tests/test-timezone-geoclue.cpp 2014-01-31 00:40:13 +0000
+++ tests/test-timezone-geoclue.cpp 2015-09-10 14:07:25 +0000
@@ -44,5 +44,6 @@
44 const std::string timezone_2 = "America/Chicago";44 const std::string timezone_2 = "America/Chicago";
45 setGeoclueTimezoneOnIdle(timezone_2);45 setGeoclueTimezoneOnIdle(timezone_2);
46 g_main_loop_run(loop);46 g_main_loop_run(loop);
47 EXPECT_TRUE(changed);
47 EXPECT_EQ(timezone_2, tz.timezone.get());48 EXPECT_EQ(timezone_2, tz.timezone.get());
48}49}
4950
=== modified file 'tests/test-timezones.cpp'
--- tests/test-timezones.cpp 2014-09-17 16:51:51 +0000
+++ tests/test-timezones.cpp 2015-09-10 14:07:25 +0000
@@ -90,7 +90,6 @@
90 EXPECT_EQ(2, zones.size());90 EXPECT_EQ(2, zones.size());
91 EXPECT_EQ(1, zones.count(timezone_file));91 EXPECT_EQ(1, zones.count(timezone_file));
92 EXPECT_EQ(1, zones.count(timezone_geo));92 EXPECT_EQ(1, zones.count(timezone_geo));
93 zones_changed = false;
9493
95 // now tweak the geoclue value... the geoclue-detected timezone should change,94 // now tweak the geoclue value... the geoclue-detected timezone should change,
96 // causing the 'timezones' property to change95 // causing the 'timezones' property to change

Subscribers

People subscribed via source and target branches