Jelajahi Sumber

Updating readme with Pylint instructions, updating requirements.txt with Pylint packages

David Leonard 10 tahun lalu
induk
melakukan
c243dae486
2 mengubah file dengan 166 tambahan dan 0 penghapusan
  1. 163 0
      README.md
  2. 3 0
      requirements.txt

+ 163 - 0
README.md

@@ -72,6 +72,169 @@ You will see an output as shown below:
     ----------------------------------------------------------------------
     Ran 0 tests in 0.194s
 
+## 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
+
 ## Contributors
 
 * David Leonard

+ 3 - 0
requirements.txt

@@ -1,11 +1,14 @@
 Django==1.7.6
+astroid==1.3.6
 coverage==4.0a5
 django-bootstrap-form==3.2
 django-bootstrap-forms==0.1
 django-bower==5.0.2
 django-openid==0.3a1
+logilab-common==0.63.2
 mock==1.0.1
 nose==1.3.4
+pylint==1.4.3
 python-openid==2.2.5
 requests==2.6.0
 six==1.9.0