about summary refs log tree commit diff stats
path: root/ranger/api/commands.py
diff options
context:
space:
mode:
authorWojciech Siewierski <wojciech.siewierski@onet.pl>2017-12-17 21:04:30 +0100
committerWojciech Siewierski <wojciech.siewierski@onet.pl>2017-12-17 21:09:05 +0100
commit18223912fc4f13a707f1f3fa8f50927e9a0a22a2 (patch)
treef8b01de23e53542c203773d72d955d0efa3adb0a /ranger/api/commands.py
parent366b1deff7c3deec7fbf8245e23e7d095ea11c14 (diff)
downloadranger-18223912fc4f13a707f1f3fa8f50927e9a0a22a2.tar.gz
Fix the "inconsistent-return-statements" Pylint warning
Some of the changes definitely could have been done better with some
refactoring instead of adding a "return" or two. Patches welcome!
Diffstat (limited to 'ranger/api/commands.py')
-rw-r--r--ranger/api/commands.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/ranger/api/commands.py b/ranger/api/commands.py
index 24a82d0b..9c687927 100644
--- a/ranger/api/commands.py
+++ b/ranger/api/commands.py
@@ -54,8 +54,8 @@ class CommandContainer(FileManagerAware):
         cmd_cls = self.get_command(cmd_name)
         if cmd_cls is None:
             self.fm.notify('alias failed: No such command: {0}'.format(cmd_name), bad=True)
-            return None
-        self.commands[name] = _command_init(command_alias_factory(name, cmd_cls, full_command))
+        else:
+            self.commands[name] = _command_init(command_alias_factory(name, cmd_cls, full_command))
 
     def load_commands_from_module(self, module):
         for var in vars(module).values():
@@ -293,7 +293,7 @@ class Command(FileManagerAware):
 
             # no results, return None
             if not dirnames:
-                return
+                return None
 
             # one result. since it must be a directory, append a slash.
             if len(dirnames) == 1:
@@ -357,7 +357,7 @@ class Command(FileManagerAware):
         else:
             # no results, return None
             if not names:
-                return
+                return None
 
             # one result. append a slash if it's a directory
             if len(names) == 1:
@@ -374,7 +374,7 @@ class Command(FileManagerAware):
         programs = [program for program in get_executables() if
                     program.startswith(self.rest(1))]
         if not programs:
-            return
+            return None
         if len(programs) == 1:
             return self.start(1) + programs[0]
         programs.sort()
@@ -397,7 +397,7 @@ def command_function_factory(func):
 
         def execute(self):  # pylint: disable=too-many-branches
             if not func:
-                return
+                return None
             if len(self.args) == 1:
                 try:
                     return func(**{'narg': self.quantifier})