Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F66622702
coding_convention.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Tue, Jun 11, 22:05
Size
1 KB
Mime Type
text/x-python
Expires
Thu, Jun 13, 22:05 (2 d)
Engine
blob
Format
Raw Data
Handle
18250506
Attached To
R3127 blackdynamite
coding_convention.py
View Options
#!/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
Log In to Comment