Skip to content

SpiderFoot automates OSINT for threat intelligence and mapping your attack surface.

tests: resolve flake8-return violations: R501 R502

Brendan Coles9890641dd3fe
diff --git a/setup.cfg b/setup.cfg
index 21fb640e..6c3fb8b0 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -2,7 +2,7 @@
flake8-max-line-length = 120
max-complexity = 100
select = C,E,F,W,B,DUO,D,R
-ignore = E501 W503 B006 DUO130 E800 R501 R502
+ignore = E501 W503 B006 DUO130 E800
per-file-ignores =
spiderfoot/__init__.py:F401
sfcli.py:D
diff --git a/sf.py b/sf.py
index 206a02b0..12a2d0cf 100755
--- a/sf.py
+++ b/sf.py
@@ -428,7 +428,7 @@ def start_scan(sfConfig, sfModules, args):
print("]")
sys.exit(0)
- return None
+ return
def start_web_server(sfWebUiConfig, sfConfig):
diff --git a/sfcli.py b/sfcli.py
index 6df7c9b9..e49850fe 100755
--- a/sfcli.py
+++ b/sfcli.py
@@ -190,7 +190,7 @@ class SpiderFootCli(cmd.Cmd):
while i < readline.get_current_history_length():
self.dprint(readline.get_history_item(i), plain=True)
i += 1
- return
+ return None
if self.ownopts['cli.history']:
val = "0"
else:
diff --git a/sflib.py b/sflib.py
index 62687626..80615e28 100644
--- a/sflib.py
+++ b/sflib.py
@@ -148,14 +148,10 @@ class SpiderFoot:
self._socksProxy = socksProxy
def refreshTorIdent(self):
- """Tell TOR to re-circuit.
-
- Returns:
- None: success
- """
+ """Tell TOR to re-circuit."""
if self.opts['_socks1type'] != "TOR":
- return None
+ return
try:
self.info("Re-circuiting TOR...")
@@ -167,7 +163,7 @@ class SpiderFoot:
except BaseException as e:
self.fatal(f"Unable to re-circuit TOR: {e}")
- return None
+ return
def optValueToData(self, val):
"""Supplied an option value, return the data based on what the
@@ -430,13 +426,10 @@ class SpiderFoot:
Args:
message (str): error message
exception (bool): also raise an exception
-
- Returns:
- None
"""
if not self.opts['__logging']:
- return None
+ return
if self.dbh:
self._dblog("ERROR", message)
@@ -464,13 +457,10 @@ class SpiderFoot:
Args:
message (str): status message
-
- Returns:
- None
"""
if not self.opts['__logging']:
- return None
+ return
if self.dbh:
self._dblog("STATUS", message)
@@ -482,13 +472,10 @@ class SpiderFoot:
Args:
message (str): info message
-
- Returns:
- None
"""
if not self.opts['__logging']:
- return None
+ return
frm = inspect.stack()[1]
mod = inspect.getmodule(frm[0])
@@ -516,15 +503,12 @@ class SpiderFoot:
Args:
message (str): debug message
-
- Returns:
- None
"""
if not self.opts['_debug']:
return
if not self.opts['__logging']:
- return None
+ return
frm = inspect.stack()[1]
mod = inspect.getmodule(frm[0])
diff --git a/spiderfoot/plugin.py b/spiderfoot/plugin.py
index 43acdc5a..7d39daca 100644
--- a/spiderfoot/plugin.py
+++ b/spiderfoot/plugin.py
@@ -191,9 +191,6 @@ class SpiderFootPlugin():
Args:
sfEvent (SpiderFootEvent): event
- Returns:
- None
-
Raises:
TypeError: sfEvent argument was invalid type
"""
@@ -210,15 +207,15 @@ class SpiderFootPlugin():
# the ROOT event or the event type of the target.
if eventName not in ('ROOT', self.getTarget().targetType):
if eventName not in self.__outputFilter__:
- return None
+ return
storeOnly = False # Under some conditions, only store and don't notify
if not eventData:
- return None
+ return
if self.checkForStop():
- return None
+ return
# Look back to ensure the original notification for an element
# is what's linked to children. For instance, sfp_dns may find
@@ -256,7 +253,7 @@ class SpiderFootPlugin():
# Check if we've been asked to stop in the meantime, so that
# notifications stop triggering module activity.
if self.checkForStop():
- return None
+ return
try:
listener.handleEvent(sfEvent)
@@ -312,22 +309,16 @@ class SpiderFootPlugin():
Args:
sfEvent (SpiderFootEvent): event
-
- Returns:
- None
"""
- return None
+ return
def start(self):
"""Kick off the work (for some modules nothing will happen here, but instead
the work will start from the handleEvent() method.
Will usually be overriden by the implementer.
-
- Returns:
- None
"""
- return None
+ return
# end of SpiderFootPlugin class
diff --git a/spiderfoot/target.py b/spiderfoot/target.py
index 5af9d48d..5494df63 100644
--- a/spiderfoot/target.py
+++ b/spiderfoot/target.py
@@ -76,28 +76,23 @@ class SpiderFootTarget():
Args:
value (str): TBD
typeName (str): TBD
-
- Returns:
- None
"""
if not isinstance(value, (str, bytes)):
- return None
+ return
if not value:
- return None
+ return
if not isinstance(typeName, (str, bytes)):
- return None
+ return
if {'type': typeName, 'value': value} in self.targetAliases:
- return None
+ return
self.targetAliases.append(
{'type': typeName, 'value': value.lower()}
)
- return None
-
def _getEquivalents(self, typeName):
"""TBD
diff --git a/test/unit/modules/test_sfp_accounts.py b/test/unit/modules/test_sfp_accounts.py
index 55f360e1..02282bb6 100644
--- a/test/unit/modules/test_sfp_accounts.py
+++ b/test/unit/modules/test_sfp_accounts.py
@@ -33,7 +33,6 @@ class TestModuleaccounts(unittest.TestCase):
'__logstdout': False
}
- @unittest.skip("todo")
def test_opts(self):
module = sfp_accounts()
self.assertEqual(len(module.opts), len(module.optdescs))
diff --git a/test/unit/modules/test_sfp_callername.py b/test/unit/modules/test_sfp_callername.py
index 31c08157..56f3088e 100644
--- a/test/unit/modules/test_sfp_callername.py
+++ b/test/unit/modules/test_sfp_callername.py
@@ -33,7 +33,6 @@ class TestModulecallername(unittest.TestCase):
'__logstdout': False
}
- @unittest.skip("todo")
def test_opts(self):
module = sfp_callername()
self.assertEqual(len(module.opts), len(module.optdescs))
diff --git a/test/unit/modules/test_sfp_circllu.py b/test/unit/modules/test_sfp_circllu.py
index 2748de12..4d1a0193 100644
--- a/test/unit/modules/test_sfp_circllu.py
+++ b/test/unit/modules/test_sfp_circllu.py
@@ -33,7 +33,6 @@ class TestModulecircllu(unittest.TestCase):
'__logstdout': False
}
- @unittest.skip("todo")
def test_opts(self):
module = sfp_circllu()
self.assertEqual(len(module.opts), len(module.optdescs))
diff --git a/test/unit/modules/test_sfp_hostio.py b/test/unit/modules/test_sfp_hostio.py
index c61c365f..6611c819 100644
--- a/test/unit/modules/test_sfp_hostio.py
+++ b/test/unit/modules/test_sfp_hostio.py
@@ -33,7 +33,6 @@ class TestModulehostio(unittest.TestCase):
'__logstdout': False
}
- @unittest.skip("todo")
def test_opts(self):
module = sfp_hostio()
self.assertEqual(len(module.opts), len(module.optdescs))