Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
ProMod3
Manage
Activity
Members
Plan
Jira
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
schwede
ProMod3
Commits
28d96e27
Commit
28d96e27
authored
9 years ago
by
Bienchen
Browse files
Options
Downloads
Patches
Plain Diff
Extended pylint
parent
9f56485f
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
extras/pre_commit/pm3_csc/filecheck/base.py
+1
-0
1 addition, 0 deletions
extras/pre_commit/pm3_csc/filecheck/base.py
extras/pre_commit/pm3_csc/filecheck/python.py
+17
-3
17 additions, 3 deletions
extras/pre_commit/pm3_csc/filecheck/python.py
with
18 additions
and
3 deletions
extras/pre_commit/pm3_csc/filecheck/base.py
+
1
−
0
View file @
28d96e27
...
@@ -24,6 +24,7 @@ class FileCheck(object):
...
@@ -24,6 +24,7 @@ class FileCheck(object):
"""
"""
def
__init__
(
self
,
filepath
):
def
__init__
(
self
,
filepath
):
self
.
filepath
=
filepath
self
.
filepath
=
filepath
self
.
absfilepath
=
os
.
path
.
abspath
(
filepath
)
self
.
current_line
=
None
self
.
current_line
=
None
def
Check
(
self
,
ignore_line_width
=
False
):
def
Check
(
self
,
ignore_line_width
=
False
):
...
...
This diff is collapsed.
Click to expand it.
extras/pre_commit/pm3_csc/filecheck/python.py
+
17
−
3
View file @
28d96e27
...
@@ -26,7 +26,9 @@ class Python(base.FileCheck):
...
@@ -26,7 +26,9 @@ class Python(base.FileCheck):
pm3_csc
.
FailMsg
(
"
ERROR in parsing pylint output, message seems to
"
+
pm3_csc
.
FailMsg
(
"
ERROR in parsing pylint output, message seems to
"
+
"
contain more than one
'
:
'
:
'
%s
'"
%
outline
,
15
)
"
contain more than one
'
:
'
:
'
%s
'"
%
outline
,
15
)
# for the message translation, we provide tags %(line)s and %(file)s,
# for the message translation, we provide tags %(line)s and %(file)s,
# they will be filled if a message gets invoked.
# they will be filled if a message gets invoked. The original pylint
# command runs with '--msg-template="{line}:{symbol}"' to reveal the
# first bit of an entry.
msg_dict
=
{
msg_dict
=
{
'
missing-docstring
'
:
'
missing-docstring
'
:
"
Line %(line)s: Documentation is missing. We want
"
+
"
Line %(line)s: Documentation is missing. We want
"
+
...
@@ -49,15 +51,25 @@ class Python(base.FileCheck):
...
@@ -49,15 +51,25 @@ class Python(base.FileCheck):
'
unused-import
'
:
'
unused-import
'
:
"
Line %(line)s: A module is imported but never used in the code.
"
+
"
Line %(line)s: A module is imported but never used in the code.
"
+
"
This increases execution time and may create an unnecessary
"
+
"
This increases execution time and may create an unnecessary
"
+
"
dependency. Please remove the import.
"
"
dependency. Please remove the import.
"
,
'
bad-continuation
'
:
"
Line %(line)s: A multi-line command is not aligned like Python
"
+
"
wants it. Usually things should all align along opening
"
+
"
parenthesis or similar landmarks. Sometimes this means to
"
+
"
introduce an awkward looking
'
=
\\
'
in a function call.
"
}
}
if
msg
[
1
]
not
in
msg_dict
.
keys
():
if
msg
[
1
]
not
in
msg_dict
.
keys
():
this_path
=
os
.
path
.
dirname
(
__file__
)
pm3_csc
.
FailMsg
(
"
Found a pylint message for the first time:
"
+
pm3_csc
.
FailMsg
(
"
Found a pylint message for the first time:
"
+
"'
%s
'
. You can get more information on
"
%
outline
+
"'
%s
'
. You can get more information on
"
%
outline
+
"
the kind of issue by running
'
pylint
"
+
"
the kind of issue by running
'
pylint
"
+
"
--help-msg=%s
'
. Once this is resolved,
"
%
msg
[
1
]
+
"
--help-msg=%s
'
. Once this is resolved,
"
%
msg
[
1
]
+
"
you could extend
'
%s
'
with more
"
%
__file__
+
"
you could extend
'
%s
'
with more
"
%
__file__
+
"
meaningful information.
"
,
16
)
"
meaningful information. You can run pylint on
"
+
"
this file by
'
pylint
"
+
"
--rcfile=%s
"
%
os
.
path
.
join
(
this_path
,
'
pylintrc
'
)
+
"
-r n %s
'
.
"
%
self
.
absfilepath
,
16
)
subst_dict
=
{
'
line
'
:
msg
[
0
],
'
file
'
:
self
.
filepath
}
subst_dict
=
{
'
line
'
:
msg
[
0
],
'
file
'
:
self
.
filepath
}
return
msg_dict
[
msg
[
1
]]
%
subst_dict
return
msg_dict
[
msg
[
1
]]
%
subst_dict
...
@@ -103,3 +115,5 @@ class Python(base.FileCheck):
...
@@ -103,3 +115,5 @@ class Python(base.FileCheck):
os
.
linesep
.
join
(
msg_stack
),
17
)
os
.
linesep
.
join
(
msg_stack
),
17
)
__all__
=
(
'
Python
'
,
)
__all__
=
(
'
Python
'
,
)
# LocalWords: multi
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment