From 6f48bdd4d3202374bb5d3e5314fcc90270a4e304 Mon Sep 17 00:00:00 2001 From: Rongxin Liu Date: Thu, 31 Aug 2023 14:07:22 -0400 Subject: [PATCH] fix markdown file --- README.md | 34 +++++++++++++++++++--------------- setup.py | 1 + 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 4c186bc..08b3175 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,17 @@ # style50 + This is style50, a tool with which code can be checked against the CS50 style guide. ## Installation - pip install style50 +```bash +pip install style50 +``` In order to style check C, C++, or Java code, a recent version (`>=3.0.1`) of `astyle` must be installed. `astyle` may be downloaded [here](https://sourceforge.net/projects/astyle/files/astyle/astyle%203.0.1/). ### Windows + Along with most of CS50's command line tools, `style50` supports being run on Windows but only via the [Linux Subsystem in Windows 10](https://msdn.microsoft.com/en-us/commandline/wsl/install_guide). After launching it, `style50` can be installed using the `pip` command above. ## Usage @@ -16,24 +20,25 @@ Along with most of CS50's command line tools, `style50` supports being run on Wi usage: style50 [-h] [-o MODE] [-v] [-V] [-E] [-i PATTERN] file [file ...] positional arguments: - file file or directory to lint +file file or directory to lint optional arguments: - -h, --help show this help message and exit - -o MODE, --output MODE +-h, --help show this help message and exit +-o MODE, --output MODE output mode, which can be character (default), split, unified, score, or json - -v, --verbose print full tracebacks of errors - -V, --version show program's version number and exit - -E, --extensions print supported file extensions (as JSON list) and +-v, --verbose print full tracebacks of errors +-V, --version show program's version number and exit +-E, --extensions print supported file extensions (as JSON list) and exit - -i PATTERN, --ignore PATTERN +-i PATTERN, --ignore PATTERN paths/patterns to be ignored ``` `character`, `split`, and `unified` modes output character-based, side-by-side, and unified (respectively) diffs between the inputted file and the correctly styled version. `score` outputs the raw percentage of correct (unchanged) lines, while `json` outputs a json object containing information pertinent to the CS50 IDE plugin (coming soon). ## Language Support + `style50` currently supports the following languages: - C++ @@ -53,8 +58,8 @@ from style50 import StyleCheck, Style50 class FooBar(StyleCheck): - - # REQUIRED: this property informs style50 what file extensions this + + # REQUIRED: this property informs style50 what file extensions this # check should be run on (in this case, all .fb and .foobar files) extensions = ["fb", "foobar"] @@ -63,8 +68,8 @@ class FooBar(StyleCheck): # All FooBar code is perfectly styled return code - # OPTIONAL: should return the number of comments in `code`. - # If this function is not defined, `style50` will not warn the student about + # OPTIONAL: should return the number of comments in `code`. + # If this function is not defined, `style50` will not warn the student about # too few comments def count_comments(self, code): # A real-world, check would need to worry about not counting '#' in string-literals @@ -74,7 +79,6 @@ class FooBar(StyleCheck): All classes which inherit from `StyleCheck` are automatically registered with `style50`'s `Style50` class, making style50 easily extensible. Adding the following to the above code creates a script which checks the code that `style50` already does as well as FooBar programs. ```python -# Style check the current directory, printing a unified diff -Style50("unified").run(["."]) - + # Style check the current directory, printing a unified diff + Style50("unified").run(["."]) ``` diff --git a/setup.py b/setup.py index f1c4990..b79bdee 100644 --- a/setup.py +++ b/setup.py @@ -14,6 +14,7 @@ ], description="This is style50, with which code can be checked against the CS50 style guide", long_description=open("README.md").read(), + long_description_content_type="text/markdown", install_requires=["argparse", "autopep8>=1.4.3", "icdiff", "jsbeautifier", "pycodestyle", "python-magic", "termcolor", "jinja2>=2.10"], dependency_links=["git+https://github.com/jeffkaufman/icdiff.git"], keywords=["style", "style50"],