SpiderFoot automates OSINT for threat intelligence and mapping your attack surface.
Python attacksurfacecticybersecurityfootprintinghackinginformation-gatheringinformation-securityinfosecintelligence-gatheringosintosint-frameworkosint-reconnaissanceosint-toolpentestingpythonreconsecurity-toolsthreat-intelligencethreatintel
tests: resolve flake8-return violations: R501 R502
Brendan Coles9890641dd3fe
diff --git a/setup.cfg b/setup.cfgindex 21fb640e..6c3fb8b0 100644--- a/setup.cfg+++ b/setup.cfg@@ -2,7 +2,7 @@flake8-max-line-length = 120max-complexity = 100select = C,E,F,W,B,DUO,D,R-ignore = E501 W503 B006 DUO130 E800 R501 R502+ignore = E501 W503 B006 DUO130 E800per-file-ignores =spiderfoot/__init__.py:F401sfcli.py:Ddiff --git a/sf.py b/sf.pyindex 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+ returndef start_web_server(sfWebUiConfig, sfConfig):diff --git a/sfcli.py b/sfcli.pyindex 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 Noneif self.ownopts['cli.history']:val = "0"else:diff --git a/sflib.py b/sflib.pyindex 62687626..80615e28 100644--- a/sflib.py+++ b/sflib.py@@ -148,14 +148,10 @@ class SpiderFoot:self._socksProxy = socksProxydef refreshTorIdent(self):- """Tell TOR to re-circuit.-- Returns:- None: success- """+ """Tell TOR to re-circuit."""if self.opts['_socks1type'] != "TOR":- return None+ returntry: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+ returndef optValueToData(self, val):"""Supplied an option value, return the data based on what the@@ -430,13 +426,10 @@ class SpiderFoot:Args:message (str): error messageexception (bool): also raise an exception-- Returns:- None"""if not self.opts['__logging']:- return None+ returnif 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+ returnif 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+ returnfrm = 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']:returnif not self.opts['__logging']:- return None+ returnfrm = inspect.stack()[1]mod = inspect.getmodule(frm[0])diff --git a/spiderfoot/plugin.py b/spiderfoot/plugin.pyindex 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+ returnstoreOnly = False # Under some conditions, only store and don't notifyif not eventData:- return None+ returnif 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+ returntry:listener.handleEvent(sfEvent)@@ -312,22 +309,16 @@ class SpiderFootPlugin():Args:sfEvent (SpiderFootEvent): event-- Returns:- None"""- return None+ returndef start(self):"""Kick off the work (for some modules nothing will happen here, but insteadthe work will start from the handleEvent() method.Will usually be overriden by the implementer.-- Returns:- None"""- return None+ return# end of SpiderFootPlugin classdiff --git a/spiderfoot/target.py b/spiderfoot/target.pyindex 5af9d48d..5494df63 100644--- a/spiderfoot/target.py+++ b/spiderfoot/target.py@@ -76,28 +76,23 @@ class SpiderFootTarget():Args:value (str): TBDtypeName (str): TBD-- Returns:- None"""if not isinstance(value, (str, bytes)):- return None+ returnif not value:- return None+ returnif not isinstance(typeName, (str, bytes)):- return None+ returnif {'type': typeName, 'value': value} in self.targetAliases:- return None+ returnself.targetAliases.append({'type': typeName, 'value': value.lower()})- return None-def _getEquivalents(self, typeName):"""TBDdiff --git a/test/unit/modules/test_sfp_accounts.py b/test/unit/modules/test_sfp_accounts.pyindex 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.pyindex 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.pyindex 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.pyindex 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))