Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5-Boxiang
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
Hamza
erp5-Boxiang
Commits
edb87c6b
Commit
edb87c6b
authored
May 25, 2015
by
Jérome Perrin
Committed by
Gabriel Monnerat
Feb 02, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
check source code: only use compile for failures and pyflakes for warning
parent
2221ca46
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 @
edb87c6b
...
@@ -434,6 +434,40 @@ def checkPythonSourceCode(source_code_str):
...
@@ -434,6 +434,40 @@ def checkPythonSourceCode(source_code_str):
if
not
source_code_str
:
if
not
source_code_str
:
return
[]
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
:
try
:
from
pylint.lint
import
Run
from
pylint.lint
import
Run
from
pylint.reporters.text
import
TextReporter
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