Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
course-discovery
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
course-discovery
Commits
baab3037
Commit
baab3037
authored
Nov 30, 2015
by
Clinton Blackburn
Committed by
Clinton Blackburn
Dec 17, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Restored Pylint
parent
1f8975e8
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
26 additions
and
28 deletions
+26
-28
Makefile
+1
-1
course_discovery/apps/api/serializers.py
+6
-4
course_discovery/apps/api/v1/views.py
+3
-2
course_discovery/apps/catalogs/models.py
+2
-2
course_discovery/apps/core/tests/test_models.py
+3
-3
course_discovery/urls.py
+2
-2
pylintrc
+4
-9
pylintrc_tweaks
+4
-3
requirements/test.txt
+1
-2
No files found.
Makefile
View file @
baab3037
...
...
@@ -48,7 +48,7 @@ test: clean
quality
:
pep8
--config
=
.pep8 course_discovery
*
.py
#
pylint --rcfile=pylintrc course_discovery *.py
pylint
--rcfile
=
pylintrc course_discovery
*
.py
validate
:
test quality
...
...
course_discovery/apps/api/serializers.py
View file @
baab3037
...
...
@@ -10,11 +10,13 @@ class CatalogSerializer(serializers.ModelSerializer):
fields
=
(
'id'
,
'name'
,
'query'
,)
class
CourseSerializer
(
serializers
.
Serializer
):
class
CourseSerializer
(
serializers
.
Serializer
):
# pylint: disable=abstract-method
id
=
serializers
.
CharField
(
help_text
=
_
(
'Course ID'
))
name
=
serializers
.
CharField
(
help_text
=
_
(
'Course name'
))
class
ContainedCoursesSerializer
(
serializers
.
Serializer
):
courses
=
serializers
.
DictField
(
child
=
serializers
.
BooleanField
(),
help_text
=
_
(
'Dictionary mapping course IDs to boolean values'
))
class
ContainedCoursesSerializer
(
serializers
.
Serializer
):
# pylint: disable=abstract-method
courses
=
serializers
.
DictField
(
child
=
serializers
.
BooleanField
(),
help_text
=
_
(
'Dictionary mapping course IDs to boolean values'
)
)
course_discovery/apps/api/v1/views.py
View file @
baab3037
...
...
@@ -12,6 +12,7 @@ from course_discovery.apps.catalogs.models import Catalog
logger
=
logging
.
getLogger
(
__name__
)
# pylint: disable=no-member
class
CatalogViewSet
(
viewsets
.
ModelViewSet
):
""" Catalog resource. """
...
...
@@ -47,7 +48,7 @@ class CatalogViewSet(viewsets.ModelViewSet):
return
super
(
CatalogViewSet
,
self
)
.
update
(
request
,
*
args
,
**
kwargs
)
@detail_route
()
def
courses
(
self
,
request
,
id
=
None
):
def
courses
(
self
,
request
,
id
=
None
):
# pylint: disable=redefined-builtin,unused-argument
"""
Retrieve the list of courses contained within this catalog.
---
...
...
@@ -62,7 +63,7 @@ class CatalogViewSet(viewsets.ModelViewSet):
return
self
.
get_paginated_response
(
serializer
.
data
)
@detail_route
()
def
contains
(
self
,
request
,
id
=
None
):
def
contains
(
self
,
request
,
id
=
None
):
# pylint: disable=redefined-builtin,unused-argument
"""
Determine if this catalog contains the provided courses.
...
...
course_discovery/apps/catalogs/models.py
View file @
baab3037
...
...
@@ -8,7 +8,7 @@ class Catalog(TimeStampedModel):
query
=
models
.
TextField
(
null
=
False
,
blank
=
False
,
help_text
=
_
(
'Query to retrieve catalog contents'
))
def
__str__
(
self
):
return
'Catalog #{id}: {name}'
.
format
(
id
=
self
.
id
,
name
=
self
.
name
)
return
'Catalog #{id}: {name}'
.
format
(
id
=
self
.
id
,
name
=
self
.
name
)
# pylint: disable=no-member
def
courses
(
self
):
""" Returns the list of courses contained within this catalog.
...
...
@@ -18,7 +18,7 @@ class Catalog(TimeStampedModel):
"""
return
[]
def
contains
(
self
,
course_ids
):
def
contains
(
self
,
course_ids
):
# pylint: disable=unused-argument
""" Determines if the given courses are contained in this catalog.
Arguments:
...
...
course_discovery/apps/core/tests/test_models.py
View file @
baab3037
...
...
@@ -28,13 +28,13 @@ class UserTests(TestCase):
""" Test that the user model concatenates first and last name if the full name is not set. """
full_name
=
"George Costanza"
user
=
G
(
User
,
full_name
=
full_name
)
self
.
assertEqual
s
(
user
.
get_full_name
(),
full_name
)
self
.
assertEqual
(
user
.
get_full_name
(),
full_name
)
first_name
=
"Jerry"
last_name
=
"Seinfeld"
user
=
G
(
User
,
full_name
=
None
,
first_name
=
first_name
,
last_name
=
last_name
)
expected
=
"{first_name} {last_name}"
.
format
(
first_name
=
first_name
,
last_name
=
last_name
)
self
.
assertEqual
s
(
user
.
get_full_name
(),
expected
)
self
.
assertEqual
(
user
.
get_full_name
(),
expected
)
user
=
G
(
User
,
full_name
=
full_name
,
first_name
=
first_name
,
last_name
=
last_name
)
self
.
assertEqual
s
(
user
.
get_full_name
(),
full_name
)
self
.
assertEqual
(
user
.
get_full_name
(),
full_name
)
course_discovery/urls.py
View file @
baab3037
...
...
@@ -42,7 +42,7 @@ urlpatterns = [
url
(
''
,
include
(
'social.apps.django_app.urls'
,
namespace
=
'social'
)),
]
if
settings
.
DEBUG
and
os
.
environ
.
get
(
'ENABLE_DJANGO_TOOLBAR'
,
False
):
# pragma: no cover
import
debug_toolbar
# pylint: disable=import-error
import
debug_toolbar
# pylint: disable=wrong-import-position,import-error
urlpatterns
.
append
(
url
(
r'^__debug__/'
,
include
(
debug_toolbar
.
urls
)))
pylintrc
View file @
baab3037
...
...
@@ -22,10 +22,9 @@
#
# ------------------------------
[MASTER]
profile = no
ignore = ,migrations, settings, wsgi.py
persistent = yes
load-plugins = edx_lint.pylint
load-plugins = edx_lint.pylint
,pylint_django
[MESSAGES CONTROL]
disable =
...
...
@@ -49,17 +48,15 @@ disable =
too-many-arguments,
too-many-locals,
unused-wildcard-import,
duplicate-code,invalid-name
duplicate-code,invalid-name
,missing-docstring
[REPORTS]
output-format = text
files-output = no
reports = no
evaluation = 10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)
comment = no
[BASIC]
required-attributes =
bad-functions = map,filter,apply,input
module-rgx = (([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$
const-rgx = (([A-Z_][A-Z0-9_]*)|(__.*__)|log|urlpatterns|logger|User)$
...
...
@@ -95,8 +92,7 @@ ignore-imports = no
[TYPECHECK]
ignore-mixin-members = yes
ignored-classes = SQLObject
zope = no
ignored-classes = SQLObject,WSGIRequest,UserFactory,CatalogFactory
unsafe-load-any-extension = yes
generated-members =
REQUEST,
...
...
@@ -127,7 +123,6 @@ dummy-variables-rgx = _|dummy|unused|.*_unused
additional-builtins =
[CLASSES]
ignore-iface-methods = isImplementedBy,deferred,extends,names,namesAndDescriptions,queryDescriptionFor,getBases,getDescriptionFor,getDoc,getName,getTaggedValue,getTaggedValueTags,isEqualOrExtendedBy,setTaggedValue,isImplementedByInstancesOf,adaptWith,is_implemented_by
defining-attr-methods = __init__,__new__,setUp
valid-classmethod-first-arg = cls
valid-metaclass-classmethod-first-arg = mcs
...
...
@@ -153,4 +148,4 @@ int-import-graph =
[EXCEPTIONS]
overgeneral-exceptions = Exception
#
304129eed6c04643faf6fa5d5070d2b0f6b44ff0
#
d9dbd5cb8a05067710b776137902855c9ca7f6a6
pylintrc_tweaks
View file @
baab3037
[MASTER]
ignore+= ,migrations, settings, wsgi.py
load-plugins = edx_lint.pylint
[BASIC]
const-rgx = (([A-Z_][A-Z0-9_]*)|(__.*__)|log|urlpatterns|logger|User)$
[MESSAGES CONTROL]
DISABLE+= ,invalid-name
\ No newline at end of file
DISABLE+= ,invalid-name,missing-docstring
[TYPECHECK]
ignored-classes+= ,WSGIRequest,UserFactory,CatalogFactory
requirements/test.txt
View file @
baab3037
...
...
@@ -5,9 +5,8 @@ coverage == 4.0.2
ddt==1.0.1
django-dynamic-fixture == 1.8.5
django-nose == 1.4.2
edx-lint == 0.
3.2
edx-lint == 0.
4.0
factory-boy==2.6.0
mock == 1.3.0
nose-ignore-docstring == 0.2
pep8 == 1.6.2
#pylint == 1.4.4
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