Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Amer
erp5
Commits
56427392
Commit
56427392
authored
May 25, 2015
by
Jérome Perrin
Committed by
Jérome Perrin
Feb 10, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
check source code: only use compile for failures and pyflakes for warning
parent
1226bf38
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
0 deletions
+34
-0
product/ERP5Type/Utils.py
product/ERP5Type/Utils.py
+34
-0
No files found.
product/ERP5Type/Utils.py
View file @
56427392
...
...
@@ -433,6 +433,40 @@ def checkPythonSourceCode(source_code_str):
if
not
source_code_str
:
return
[]
try
:
compile
(
source_code_str
,
'<string>'
,
'exec'
)
except
Exception
,
error
:
if
isinstance
(
error
,
SyntaxError
):
message
=
{
'type'
:
'F'
,
'row'
:
error
.
lineno
,
'column'
:
error
.
offset
,
'text'
:
error
.
message
}
else
:
message
=
{
'type'
:
'F'
,
'row'
:
-
1
,
'column'
:
-
1
,
'text'
:
str
(
error
)}
return
[
message
]
import
pyflakes.reporter
import
pyflakes.api
message_list
=
[]
class
ERP5FlakesReporter
(
pyflakes
.
reporter
.
Reporter
):
__init__
=
unexpectedError
=
syntaxError
=
lambda
*
args
,
**
kw
:
None
# errors are handled by compile
def
flake
(
self
,
message
):
message_list
.
append
(
{
'type'
:
'W'
,
'row'
:
message
.
lineno
,
'column'
:
message
.
col
,
'text'
:
message
.
message
%
message
.
message_args
})
pyflakes
.
api
.
check
(
source_code_str
,
'<string>'
,
ERP5FlakesReporter
())
return
message_list
# XXX pylint disabled because it is slow
try
:
from
pylint.lint
import
Run
from
pylint.reporters.text
import
TextReporter
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment