check50_checkstyle
This is an extension for the CS50 automarker check50 that allows to run the static code analyser checkstyle and interpret the resulting XML report as check50 Failures.
Checkstyle let's you complain about style issues, particularly in Java code, beyond what style50 (astyle) can do. For instance you can flag if identifiers don't adhere to Java's camelCase code conventions, or javadocs are missing.
For convenience, this package ships with the stand-alone CLI of checkstyle (checkstyle-8.35-all.jar), which is why it is so large.
Example Usage
You need to import this module into your problem set (__init.py__):
import check50_checkstyle
and declare #- check50-checkstyle it as a dependency in your .cs50.yml file:
check50:
dependencies:
- check50-checkstyle
Checkstyle needs an XML style definition file to run. The jar file contains two such definitions, following the sun or google style guides but both are rather "picky",i.e., complain about lots of minor stuff. Pick one of these style files and delete what you don't like.
Let's assume your problem set contains the style definition style.xml.
Then you add a check50 check as follows. The target can be more specific of course.
@check50.check(exists)
def checkstyle():
"""style police"""
check50.include("style.xml")
check50_checkstyle.run_and_interpret_checkstyle(
checks_file='style.xml',
target='*.java')
This will dump all warnings into the log (because check50 hard-codes its html template). Example output:
:( style police
stylistic issues found
Issues found:
- In Credit.java(line 4, char 5): Missing a Javadoc comment.
- In Basket.java(line 2, char 1): Wrong lexicographical order for 'java.util.ArrayList' import. Should be before 'java.util.List'.
- In Basket.java(line 19, char 5): Missing a Javadoc comment.
- In Basket.java(line 27, char 5): Missing a Javadoc comment.
- In Basket.java(line 35, char 5): Missing a Javadoc comment.
- In Basket.java(line 47): First sentence of Javadoc is missing an ending period.
- In Item.java(line 27): Line is longer than 100 characters (found 102).
- In Item.java(line 53, char 40): 'typecast' is not followed by whitespace.
- In Snack.java(line 20, char 5): Missing a Javadoc comment.
Metadata
Release files for check50-checkstyle 0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| check50_checkstyle-0.4.tar.gz | 12.0 MB | Without provenance | Details for check50_checkstyle-0.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| check50_checkstyle-0.4-py3-none-any.whl | Python 3 | none | any | Details for check50_checkstyle-0.4-py3-none-any.whl |
Total release size: 24.0 MB
Release files / check50_checkstyle-0.4.tar.gz
| Download URL | check50_checkstyle-0.4.tar.gz |
|---|---|
| Size | 12.0 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c026a7a50e92c655551bc32eb0f2e8ec442e8cff8c7277a210791530b22e01f4
|
|
BLAKE2b-256 checksum How to use checksums |
e3d63d56c33f26fa70f4f4f9117812990aae6e2ba163f7c243a12e4018a85331
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1
|
Release files / check50_checkstyle-0.4-py3-none-any.whl
| Download URL | check50_checkstyle-0.4-py3-none-any.whl |
|---|---|
| Size | 12.0 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2c59b69a820b8a4a70ad3eb4b27bbe5d5a2afa66b339e83a187e93c675d5fcf6
|
|
BLAKE2b-256 checksum How to use checksums |
d314ebf0aeab40b166629fb334c11e39c2be6e8b8f2335a716286d26f0f12749
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1
|
Security for check50-checkstyle 0.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.