Skip to content

Commit

Permalink
python: remove semicolon from end of lines
Browse files Browse the repository at this point in the history
Python does not need to end a statement with a semicolon. Doing this
gets reported by linters such as flake8 ("E703 statement ends with a
semicolon").

Remove such semicolons in the code and enable this warning in
scripts/run-flake8.

Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
  • Loading branch information
fishilico committed Aug 19, 2018
1 parent b5e2da2 commit 6f01778
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion python/sepolgen/src/sepolgen/audit.py
Expand Up @@ -258,7 +258,7 @@ def analyze(self):
if (scontext, tcontext, self.tclass, access_tuple) in avcdict.keys():
self.type, self.data = avcdict[(scontext, tcontext, self.tclass, access_tuple)]
else:
self.type, self.data = audit2why.analyze(scontext, tcontext, self.tclass, self.accesses);
self.type, self.data = audit2why.analyze(scontext, tcontext, self.tclass, self.accesses)
if self.type == audit2why.NOPOLICY:
self.type = audit2why.TERULE
if self.type == audit2why.BADTCON:
Expand Down
8 changes: 4 additions & 4 deletions python/sepolgen/src/sepolgen/yacc.py
Expand Up @@ -1864,10 +1864,10 @@ def lr_write_tables(modulename=tab_module,outputdir=''):
""")

else:
f.write("\n_lr_action = { ");
f.write("\n_lr_action = { ")
for k,v in _lr_action.items():
f.write("(%r,%r):%r," % (k[0],k[1],v))
f.write("}\n");
f.write("}\n")

if smaller:
# Factor out names to try and make smaller
Expand Down Expand Up @@ -1901,10 +1901,10 @@ def lr_write_tables(modulename=tab_module,outputdir=''):
del _lr_goto_items
""")
else:
f.write("\n_lr_goto = { ");
f.write("\n_lr_goto = { ")
for k,v in _lr_goto.items():
f.write("(%r,%r):%r," % (k[0],k[1],v))
f.write("}\n");
f.write("}\n")

# Write production table
f.write("_lr_productions = [\n")
Expand Down
2 changes: 1 addition & 1 deletion python/sepolicy/sepolicy/manpage.py
Expand Up @@ -539,7 +539,7 @@ def __gen_man_page(self):
self.fd = fd
self.man_page_path = man_page_path
except KeyError:
continue;
continue
self.attributes[domain_type] = next(sepolicy.info(sepolicy.TYPE, ("%s") % domain_type))["attributes"]

self._header()
Expand Down
1 change: 0 additions & 1 deletion scripts/run-flake8
Expand Up @@ -14,7 +14,6 @@ IGNORE_LIST=''
IGNORE_LIST="$IGNORE_LIST,W191" # indentation contains tabs

IGNORE_LIST="$IGNORE_LIST,E101" # indentation contains mixed spaces and tabs
IGNORE_LIST="$IGNORE_LIST,E703" # statement ends with a semicolon
IGNORE_LIST="$IGNORE_LIST,E711" # comparison to None should be 'if cond is not None:'
IGNORE_LIST="$IGNORE_LIST,E712" # comparison to False should be 'if cond is False:' or 'if not cond:'
IGNORE_LIST="$IGNORE_LIST,E722" # do not use bare 'except'
Expand Down

0 comments on commit 6f01778

Please sign in to comment.