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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Aurélien Vermylen
erp5
Commits
974ff17a
Commit
974ff17a
authored
9 years ago
by
Jérome Perrin
Committed by
Jérome Perrin
8 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
check source code: only use compile for failures and pyflakes for warning
parent
6b7621da
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 @
974ff17a
...
...
@@ -434,6 +434,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
...
...
This diff is collapsed.
Click to expand it.
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