Page MenuHomec4science

coding_convention.py
No OneTemporary

File Metadata

Created
Tue, May 21, 18:37

coding_convention.py

#!/usr/bin/env python3
"""
@file coding_convention.py
@author Till Junge <till.junge@altermail.ch>
@date 11 Aug 2016
@brief Test whether the source files of game_engine follow our coding
conventions
@section LICENCE
Copyright (C) 2016 Till Junge
coding_convention.py is part of zegame and proprietary
software; you can neither redistribute nor modify coding_convention.py.
Only members of the zegame association are allowed to view, run,
modify and copy coding_convention.py under the terms of the zegame
association statutes.
"""
try:
import unittest
import os
import pep8
import BlackDynamite
except ImportError as err:
import sys
print(err)
sys.exit(str(err))
class Pep8Test(unittest.TestCase):
"""
Test for pep8 conformity
"""
def setUp(self):
"""
builds a list of source files. If you find a smarter way, please let me
know
"""
print() # for emacs to evaluate the first line of errors
self.mod_files = list()
bd_path = os.path.join(BlackDynamite.__path__[0], "..")
for dirpath, _, filenames in os.walk(bd_path):
self.mod_files += [os.path.join(dirpath, filename)
for filename in filenames
if filename.endswith((".py", ".pyx"))]
for dirpath, _, filenames in os.walk(os.path.join(bd_path, 'scripts')):
self.mod_files += [os.path.join(dirpath, filename)
for filename in filenames
if not filename.endswith(".sh")]
def test_pep8_conformity(self):
"""
check all files for pep8 conformity
"""
pep8style = pep8.StyleGuide()
pep8style.check_files((mod_file for mod_file in self.mod_files))

Event Timeline