diff -r 0572a215bd2f -r 5994b80b8760 eric6/Plugins/CheckerPlugins/CodeStyleChecker/Security/Checks/generalFilePermissions.py --- a/eric6/Plugins/CheckerPlugins/CodeStyleChecker/Security/Checks/generalFilePermissions.py Sun Apr 11 16:53:48 2021 +0200 +++ b/eric6/Plugins/CheckerPlugins/CodeStyleChecker/Security/Checks/generalFilePermissions.py Sun Apr 11 18:45:10 2021 +0200 @@ -44,31 +44,33 @@ @param config dictionary with configuration data @type dict """ - if 'chmod' in context.callFunctionName: - if context.callArgsCount == 2: - mode = context.getCallArgAtPosition(1) + if ( + 'chmod' in context.callFunctionName and + context.callArgsCount == 2 + ): + mode = context.getCallArgAtPosition(1) + + if ( + mode is not None and + isinstance(mode, int) and + (mode & stat.S_IWOTH or mode & stat.S_IXGRP) + ): + # world writable is an HIGH, group executable is a MEDIUM + if mode & stat.S_IWOTH: + severity = "H" + else: + severity = "M" - if ( - mode is not None and - isinstance(mode, int) and - (mode & stat.S_IWOTH or mode & stat.S_IXGRP) - ): - # world writable is an HIGH, group executable is a MEDIUM - if mode & stat.S_IWOTH: - severity = "H" - else: - severity = "M" - - filename = context.getCallArgAtPosition(0) - if filename is None: - filename = 'NOT PARSED' - - reportError( - context.node.lineno - 1, - context.node.col_offset, - "S103", - severity, - "H", - oct(mode), - filename - ) + filename = context.getCallArgAtPosition(0) + if filename is None: + filename = 'NOT PARSED' + + reportError( + context.node.lineno - 1, + context.node.col_offset, + "S103", + severity, + "H", + oct(mode), + filename + )