|
|
@@ -34,15 +34,6 @@ Then:
|
|
|
|
|
|
This will download and extract all the packages listed within `bower.json`. **Under no circumstance should any front-end libraries manually be pushed up to the repository.**
|
|
|
|
|
|
-Two routes have currently been set up, which are located at:
|
|
|
-
|
|
|
- # First test route
|
|
|
- http://127.0.0.1:8000/hackathon/
|
|
|
-
|
|
|
- # Second test route
|
|
|
- http://127.0.0.1:8000/hackathon/test
|
|
|
-
|
|
|
-
|
|
|
## Testing
|
|
|
|
|
|
This project aims to be as close to 100% tested as possible. For a good guide to testing using Python and `Mock`, `Nosetests` and `Unittests` libraries, please [read here](http://docs.python-guide.org/en/latest/writing/tests/).
|
|
|
@@ -51,195 +42,32 @@ To run the tests:
|
|
|
|
|
|
hackthon-starter $ python manage.py test hackathon/unittests/
|
|
|
|
|
|
-You will see an output as shown below:
|
|
|
-
|
|
|
- Name Stmts Miss Cover Missing
|
|
|
- --------------------------------------------------------------------
|
|
|
- hackathon/__init__.py 0 0 100%
|
|
|
- hackathon/admin.py 3 3 0% 1-5
|
|
|
- hackathon/forms.py 9 9 0% 1-11
|
|
|
- hackathon/migrations/0001_initial.py 6 0 100%
|
|
|
- hackathon/migrations/__init__.py 0 0 100%
|
|
|
- hackathon/models.py 6 6 0% 1-11
|
|
|
- hackathon/scripts/__init__.py 0 0 100%
|
|
|
- hackathon/scripts/github.py 106 96 9% 17-34, 41-64, 69-97, 102-121, 126-132, 139-165, 169-175
|
|
|
- hackathon/scripts/linkedin.py 19 19 0% 1-24
|
|
|
- hackathon/scripts/samplescript.py NoSource: No source for code: '/Users/DrkSephy/Documents/django-hackathon-starter/hackathon_starter/hackathon/scripts/samplescript.py'.
|
|
|
- hackathon/scripts/steam.py 15 15 0% 3-29
|
|
|
- hackathon/scripts/tumblr.py 60 60 0% 1-85
|
|
|
- hackathon/tests.py 1 0 100%
|
|
|
- hackathon/urls.py 3 3 0% 1-5
|
|
|
- hackathon/views.py 76 76 0% 1-157
|
|
|
- --------------------------------------------------------------------
|
|
|
- TOTAL 304 287 6%
|
|
|
- ----------------------------------------------------------------------
|
|
|
- Ran 2 tests in 0.002s
|
|
|
-
|
|
|
- OK
|
|
|
- Destroying test database for alias 'default'...
|
|
|
-
|
|
|
## Code evaluation
|
|
|
|
|
|
In order to write clean code with a consistent style guide, we'll be using `Pylint` to maintain our code. Pylint will display a ton of messages regarding things that should be fixed. A sample output from running `pylint views.py` is shown below:
|
|
|
|
|
|
- (web)λ pylint views.py
|
|
|
- No config file found, using default configuration
|
|
|
- ************* Module hackathon.views
|
|
|
- C: 7, 0: Trailing whitespace (trailing-whitespace)
|
|
|
- W: 11, 0: Found indentation with tabs instead of spaces (mixed-indentation)
|
|
|
- W: 12, 0: Found indentation with tabs instead of spaces (mixed-indentation)
|
|
|
- W: 15, 0: Found indentation with tabs instead of spaces (mixed-indentation)
|
|
|
- C: 59, 0: Wrong continued indentation.
|
|
|
- 'hackathon/register.html',
|
|
|
- ^ | (bad-continuation)
|
|
|
- C: 60, 0: Wrong continued indentation.
|
|
|
- {'user_form': user_form, 'registered': registered} )
|
|
|
- ^ | (bad-continuation)
|
|
|
- C: 60, 0: No space allowed before bracket
|
|
|
- {'user_form': user_form, 'registered': registered} )
|
|
|
- ^ (bad-whitespace)
|
|
|
- C: 69, 0: Line too long (103/100) (line-too-long)
|
|
|
- C:116, 0: Exactly one space required after comma
|
|
|
- return render(request,'hackathon/steam.html', {"game": game })
|
|
|
- ^ (bad-whitespace)
|
|
|
- C:116, 0: No space allowed before bracket
|
|
|
- return render(request,'hackathon/steam.html', {"game": game })
|
|
|
- ^ (bad-whitespace)
|
|
|
- C: 1, 0: Missing module docstring (missing-docstring)
|
|
|
- W: 7, 0: Relative import 'scripts.steam', should be 'hackathon.scripts.steam' (relative-import)
|
|
|
- C: 10, 0: Missing function docstring (missing-docstring)
|
|
|
- C: 14, 0: Missing function docstring (missing-docstring)
|
|
|
- W: 14, 9: Unused argument 'request' (unused-argument)
|
|
|
- C: 17, 0: Missing function docstring (missing-docstring)
|
|
|
- C: 21, 0: Missing function docstring (missing-docstring)
|
|
|
- C: 62, 0: Missing function docstring (missing-docstring)
|
|
|
- C:103, 0: Missing function docstring (missing-docstring)
|
|
|
- C:110, 0: Missing function docstring (missing-docstring)
|
|
|
- C:113, 4: Invalid variable name "SteamUN" (invalid-name)
|
|
|
- C:114, 4: Invalid variable name "steamID" (invalid-name)
|
|
|
- C:118, 0: Missing function docstring (missing-docstring)
|
|
|
- W: 4, 0: Unused RequestContext imported from django.template (unused-import)
|
|
|
- W: 4, 0: Unused loader imported from django.template (unused-import)
|
|
|
-
|
|
|
-
|
|
|
- Report
|
|
|
- ======
|
|
|
- 53 statements analysed.
|
|
|
-
|
|
|
- Statistics by type
|
|
|
- ------------------
|
|
|
-
|
|
|
- +---------+-------+-----------+-----------+------------+---------+
|
|
|
- |type |number |old number |difference |%documented |%badname |
|
|
|
- +=========+=======+===========+===========+============+=========+
|
|
|
- |module |1 |NC |NC |0.00 |0.00 |
|
|
|
- +---------+-------+-----------+-----------+------------+---------+
|
|
|
- |class |0 |NC |NC |0 |0 |
|
|
|
- +---------+-------+-----------+-----------+------------+---------+
|
|
|
- |method |0 |NC |NC |0 |0 |
|
|
|
- +---------+-------+-----------+-----------+------------+---------+
|
|
|
- |function |8 |NC |NC |0.00 |0.00 |
|
|
|
- +---------+-------+-----------+-----------+------------+---------+
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- External dependencies
|
|
|
- ---------------------
|
|
|
- ::
|
|
|
-
|
|
|
- django
|
|
|
- \-contrib
|
|
|
- | \-auth (hackathon.views)
|
|
|
- \-http (hackathon.views)
|
|
|
- \-shortcuts (hackathon.views)
|
|
|
- \-template (hackathon.views)
|
|
|
- \-loader (hackathon.views)
|
|
|
- hackathon
|
|
|
- \-forms (hackathon.views)
|
|
|
- \-scripts
|
|
|
- \-steam (hackathon.views)
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- Raw metrics
|
|
|
- -----------
|
|
|
-
|
|
|
- +----------+-------+------+---------+-----------+
|
|
|
- |type |number |% |previous |difference |
|
|
|
- +==========+=======+======+=========+===========+
|
|
|
- |code |59 |59.00 |NC |NC |
|
|
|
- +----------+-------+------+---------+-----------+
|
|
|
- |docstring |1 |1.00 |NC |NC |
|
|
|
- +----------+-------+------+---------+-----------+
|
|
|
- |comment |29 |29.00 |NC |NC |
|
|
|
- +----------+-------+------+---------+-----------+
|
|
|
- |empty |11 |11.00 |NC |NC |
|
|
|
- +----------+-------+------+---------+-----------+
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- Duplication
|
|
|
- -----------
|
|
|
-
|
|
|
- +-------------------------+------+---------+-----------+
|
|
|
- | |now |previous |difference |
|
|
|
- +=========================+======+=========+===========+
|
|
|
- |nb duplicated lines |0 |NC |NC |
|
|
|
- +-------------------------+------+---------+-----------+
|
|
|
- |percent duplicated lines |0.000 |NC |NC |
|
|
|
- +-------------------------+------+---------+-----------+
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- Messages by category
|
|
|
- --------------------
|
|
|
-
|
|
|
- +-----------+-------+---------+-----------+
|
|
|
- |type |number |previous |difference |
|
|
|
- +===========+=======+=========+===========+
|
|
|
- |convention |18 |NC |NC |
|
|
|
- +-----------+-------+---------+-----------+
|
|
|
- |refactor |0 |NC |NC |
|
|
|
- +-----------+-------+---------+-----------+
|
|
|
- |warning |7 |NC |NC |
|
|
|
- +-----------+-------+---------+-----------+
|
|
|
- |error |0 |NC |NC |
|
|
|
- +-----------+-------+---------+-----------+
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- Messages
|
|
|
- --------
|
|
|
-
|
|
|
- +--------------------+------------+
|
|
|
- |message id |occurrences |
|
|
|
- +====================+============+
|
|
|
- |missing-docstring |9 |
|
|
|
- +--------------------+------------+
|
|
|
- |mixed-indentation |3 |
|
|
|
- +--------------------+------------+
|
|
|
- |bad-whitespace |3 |
|
|
|
- +--------------------+------------+
|
|
|
- |unused-import |2 |
|
|
|
- +--------------------+------------+
|
|
|
- |invalid-name |2 |
|
|
|
- +--------------------+------------+
|
|
|
- |bad-continuation |2 |
|
|
|
- +--------------------+------------+
|
|
|
- |unused-argument |1 |
|
|
|
- +--------------------+------------+
|
|
|
- |trailing-whitespace |1 |
|
|
|
- +--------------------+------------+
|
|
|
- |relative-import |1 |
|
|
|
- +--------------------+------------+
|
|
|
- |line-too-long |1 |
|
|
|
- +--------------------+------------+
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- Global evaluation
|
|
|
- -----------------
|
|
|
- Your code has been rated at 5.28/10
|
|
|
+
|
|
|
+## RESTful endpoints
|
|
|
+
|
|
|
+Using the `Django REST framework, the current RESTful endpoints exist:
|
|
|
+
|
|
|
+ http://127.0.0.1:8000/hackathon/snippets/
|
|
|
+
|
|
|
+The list will appear empty at first, since the database model `Snippets` will be empty. To populate it with some sample data, run the following:
|
|
|
+
|
|
|
+ python manage.py shell
|
|
|
+ from hackathon.models import Snippet
|
|
|
+ from hackathon.serializers import SnippetSerializer
|
|
|
+ from rest_framework.renderers import JSONRenderer
|
|
|
+ from rest_framework.parsers import JSONParser
|
|
|
+
|
|
|
+ snippet = Snippet(code='foo = "bar"\n')
|
|
|
+ snippet.save()
|
|
|
+
|
|
|
+ snippet = Snippet(code='print "hello, world"\n')
|
|
|
+ snippet.save()
|
|
|
+
|
|
|
+The above will open the Django shell, and allow you to create objects and save them to the database. If you then navigate to the URL above, you will see the JSON output of the database model, `Snippet`.
|
|
|
|
|
|
## Contributors
|
|
|
|