Module: check_mk
Branch: master
Commit: 5e25808634528ccdd416f784a9bc64f5b4d9cfe5
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=5e25808634528c…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Tue Jul 3 12:23:59 2018 +0200
Fixed and enabled pointless-statement warnings.
Change-Id: I1e6bbb2d7c5a12da790e5f10ff9d83ff4caea6b9
---
checks/cisco_ace_rserver | 4 ++--
checks/netstat | 2 +-
checks/ps.include | 2 +-
tests/pylint/pylintrc | 1 -
web/htdocs/background_job.py | 1 -
web/htdocs/config.py | 4 ++--
web/htdocs/metrics.py | 2 +-
web/htdocs/wato.py | 49 +++++++++++++++++++++++++------------------
web/plugins/views/commands.py | 2 +-
9 files changed, 37 insertions(+), 30 deletions(-)
diff --git a/checks/cisco_ace_rserver b/checks/cisco_ace_rserver
index 516ceca..8f91c57 100644
--- a/checks/cisco_ace_rserver
+++ b/checks/cisco_ace_rserver
@@ -48,7 +48,7 @@ def inventory_cisco_ace_rserver(info):
elif descr != '':
item = descr
else:
- ip
+ item = ip
yield item, None
@@ -85,7 +85,7 @@ def check_cisco_ace_rserver(item, _no_params, info):
admin_state = admin_stati[admin_status]
state, state_txt = oper_stati[oper_status]
if admin_status == "2" and state == 2:
- state == 1 # max state is WARN if real server out of service
+ state = 1 # max state is WARN if real server out of service
infotext = "Operational State: %s, Administrative State: %s, Current
Connections: %s" % \
(state_txt, admin_state, conns)
perfdata = [ ("connections", int(conns)) ]
diff --git a/checks/netstat b/checks/netstat
index a7d6975..8732f59 100644
--- a/checks/netstat
+++ b/checks/netstat
@@ -62,7 +62,7 @@ def parse_netstat(info):
proto = "UDP"
# Ubuntu recently deviced to use "LISTEN" instead of
"LISTENING"
if connstate == "LISTEN":
- connstate == "LISTENING"
+ connstate = "LISTENING"
if len(line) == 5: # handles UDP listeners
proto, recv_q, send_q, local, remote = line
diff --git a/checks/ps.include b/checks/ps.include
index 78475b7..92e2af8 100644
--- a/checks/ps.include
+++ b/checks/ps.include
@@ -330,7 +330,7 @@ def ps_cleanup_params(params):
def ps_has_extended_perfdata(process_info):
try:
- process_info[4]
+ _dummy = process_info[4]
return True
except IndexError:
return False
diff --git a/tests/pylint/pylintrc b/tests/pylint/pylintrc
index ea23405..a6f3a70 100644
--- a/tests/pylint/pylintrc
+++ b/tests/pylint/pylintrc
@@ -53,7 +53,6 @@ disable=
no-else-return,
no-self-use,
old-style-class,
- pointless-statement,
pointless-string-statement,
protected-access,
redefine-in-handler,
diff --git a/web/htdocs/background_job.py b/web/htdocs/background_job.py
index 9eaa3bb..4ee08a8 100644
--- a/web/htdocs/background_job.py
+++ b/web/htdocs/background_job.py
@@ -287,7 +287,6 @@ class BackgroundJob(object):
housekeeping_max_age_sec = 86400 * 30
housekeeping_max_count = 50
- _
def __init__(self, job_id, logger=None, **kwargs):
super(BackgroundJob, self).__init__()
self._job_id = job_id
diff --git a/web/htdocs/config.py b/web/htdocs/config.py
index 5e7422e..8752a28 100644
--- a/web/htdocs/config.py
+++ b/web/htdocs/config.py
@@ -183,7 +183,7 @@ def reporting_available():
try:
# Check the existance of one arbitrary config variable from the
# reporting module
- reporting_filename
+ _dummy = reporting_filename
return True
except:
return False
@@ -191,7 +191,7 @@ def reporting_available():
def combined_graphs_available():
try:
- have_combined_graphs
+ _dummy = have_combined_graphs
return True
except:
return False
diff --git a/web/htdocs/metrics.py b/web/htdocs/metrics.py
index a79bf68..bc6aa27 100644
--- a/web/htdocs/metrics.py
+++ b/web/htdocs/metrics.py
@@ -1604,7 +1604,7 @@ def render_graph_pnp(graph_template, translated_metrics):
def cmk_graphs_possible(site_id = None):
try:
- render_graph_html # Will throw exception if missing
+ _dummy = render_graph_html # Will throw exception if missing
return not config.force_pnp_graphing \
and browser_supports_canvas() \
and site_is_running_cmc(site_id)
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index 4f3aa5f..63c186e 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -1445,7 +1445,7 @@ def mode_edit_host(phase, new, is_cluster):
html.open_ul()
for error in errors:
html.li(error)
- html.close_ul
+ html.close_ul()
html.close_p()
if html.form_submitted():
@@ -3466,50 +3466,59 @@ class ModeDiscovery(WatoMode):
descr, state, output, perfdata = check
checkbox_name = self._checkbox_name(check_type, item)
- buttons = []
+ num_buttons = 0
if table_source == self.SERVICE_MONITORED:
if config.user.may("wato.service_discovery_to_undecided"):
- buttons.append(icon_button(table_source, checkbox_name,
self.SERVICE_UNDECIDED, "undecided"))
+ icon_button(table_source, checkbox_name, self.SERVICE_UNDECIDED,
"undecided")
+ num_buttons += 1
if may_edit_ruleset("ignored_services") \
and config.user.may("wato.service_discovery_to_ignored"):
- buttons.append(icon_button(table_source, checkbox_name,
self.SERVICE_IGNORED, "disabled"))
+ icon_button(table_source, checkbox_name, self.SERVICE_IGNORED,
"disabled")
+ num_buttons += 1
elif table_source == self.SERVICE_IGNORED:
if may_edit_ruleset("ignored_services"):
if config.user.may("wato.service_discovery_to_monitored"):
- buttons.append(icon_button(table_source, checkbox_name,
self.SERVICE_MONITORED, "monitored"))
+ icon_button(table_source, checkbox_name, self.SERVICE_MONITORED,
"monitored")
+ num_buttons += 1
if config.user.may("wato.service_discovery_to_ignored"):
- buttons.append(icon_button(table_source, checkbox_name,
self.SERVICE_UNDECIDED, "undecided"))
- buttons.append(disabled_services_button())
+ icon_button(table_source, checkbox_name, self.SERVICE_UNDECIDED,
"undecided")
+ num_buttons += 1
+ disabled_services_button()
+ num_buttons += 1
elif table_source == self.SERVICE_VANISHED:
if config.user.may("wato.service_discovery_to_removed"):
- buttons.append(icon_button_removed(table_source, checkbox_name))
+ icon_button_removed(table_source, checkbox_name)
+ num_buttons += 1
if may_edit_ruleset("ignored_services") \
and config.user.may("wato.service_discovery_to_ignored"):
- buttons.append(icon_button(table_source, checkbox_name,
self.SERVICE_IGNORED, "disabled"))
+ icon_button(table_source, checkbox_name, self.SERVICE_IGNORED,
"disabled")
+ num_buttons += 1
elif table_source == self.SERVICE_UNDECIDED:
if config.user.may("wato.service_discovery_to_monitored"):
- buttons.append(icon_button(table_source, checkbox_name,
self.SERVICE_MONITORED, "monitored"))
+ icon_button(table_source, checkbox_name, self.SERVICE_MONITORED,
"monitored")
+ num_buttons += 1
if may_edit_ruleset("ignored_services") \
and config.user.may("wato.service_discovery_to_ignored"):
- buttons.append(icon_button(table_source, checkbox_name,
self.SERVICE_IGNORED, "disabled"))
+ icon_button(table_source, checkbox_name, self.SERVICE_IGNORED,
"disabled")
+ num_buttons += 1
- while len(buttons) < 2:
- buttons.append(html.empty_icon())
+ while num_buttons < 2:
+ html.empty_icon()
+ num_buttons += 1
if table_source not in [self.SERVICE_UNDECIDED,
self.SERVICE_IGNORED] \
and config.user.may('wato.rulesets'):
- buttons.append(rulesets_button())
- buttons.append(check_parameters_button())
+ rulesets_button()
+ check_parameters_button()
+ num_buttons += 2
- while len(buttons) < 4:
- buttons.append(html.empty_icon())
-
- for button in buttons:
- button
+ while num_buttons < 4:
+ html.empty_icon()
+ num_buttons += 1
def _get_ruleset_name(self, table_source, check_type, checkgroup):
diff --git a/web/plugins/views/commands.py b/web/plugins/views/commands.py
index 75ecfcd..efc3e46 100644
--- a/web/plugins/views/commands.py
+++ b/web/plugins/views/commands.py
@@ -781,7 +781,7 @@ def paint_downtime_buttons(what):
def has_recurring_downtimes():
try:
- wato.recurring_downtimes_types # Check if this exists
+ _dummy = wato.recurring_downtimes_types # Check if this exists
return True
except AttributeError:
return False