Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-lint
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-lint
Commits
fe2e726c
Commit
fe2e726c
authored
Nov 23, 2015
by
Ned Batchelder
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #20 from edx/ned/also-check-delattr
Also check delattr for literal-used-as-attribute
parents
d787dc74
6fa8de17
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
1 deletions
+4
-1
edx_lint/pylint/getattr_check.py
+1
-1
test/input/func_getattr_literals.py
+2
-0
test/messages/func_getattr_literals.txt
+1
-0
No files found.
edx_lint/pylint/getattr_check.py
View file @
fe2e726c
...
...
@@ -40,7 +40,7 @@ class GetSetAttrLiteralChecker(BaseChecker):
if
len
(
node
.
args
)
!=
2
:
# We only attend to 2-argument getattr()
return
elif
node
.
func
.
name
==
"setattr"
:
elif
node
.
func
.
name
in
[
"setattr"
,
"delattr"
]
:
pass
else
:
# Not a function we care about.
...
...
test/input/func_getattr_literals.py
View file @
fe2e726c
...
...
@@ -7,3 +7,5 @@ def do_things(name):
world
=
getattr
(
name
,
"hello"
,
17
)
setattr
(
name
,
"hello"
,
hello
)
setattr
(
name
,
"h"
+
"ello"
,
world
)
delattr
(
name
,
"something"
)
delattr
(
name
,
"FOO"
.
lower
())
test/messages/func_getattr_literals.txt
View file @
fe2e726c
C: 6:do_things: getattr using a literal attribute name
C: 8:do_things: setattr using a literal attribute name
C: 10:do_things: delattr using a literal attribute name
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