hyperstyle


Namehyperstyle JSON
Version 1.4.4 PyPI version JSON
download
home_pagehttps://github.com/hyperskill/hyperstyle
SummaryA tool for running a set of pre-configured linters and evaluating code quality.
upload_time2023-09-05 11:49:52
maintainer
docs_urlNone
authorStepik.org
requires_python>=3.8, <4
license
keywords code review
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ![Python build](https://github.com/hyperskill/hyperstyle/workflows/Python%20build/badge.svg?branch=develop)

# Hyperstyle

A tool for running a set of pre-configured linters and evaluating code quality.
It is used on the [Hyperskill](https://hyperskill.org/) platform 
to check the quality of learners' code.

[Read more detail about the project at Hyperskill Help Center](https://support.hyperskill.org/hc/en-us/articles/360049582712-Code-style-Code-quality)

[The dockerized version](https://hub.docker.com/r/stepik/hyperstyle/tags)

## What it does:

* Runs linters for several programming languages and parses their output;
* Prints the result using a unified JSON-based format;
* Evaluates the code quality value (**EXCELLENT**, **GOOD**, **MODERATE**, or **BAD**) 
based on the linters' output and some heuristics.


## License and 3rd party software

The source code of **hyperstyle** is distributed under the Apache 2.0 License.

The 3rd party software we use in this project has its own licenses.

Python language (all versions can be found in the [requirements.txt](requirements.txt) file):

- [x]  flake8 [MIT]
    * [Site and docs](https://flake8.pycqa.org/en/latest/)
    * [Repository](https://github.com/PyCQA/flake8)
  
- [x]  Pylint [GNU LGPL v2]
    * [Site and docs](https://www.pylint.org/)
    * [Repository](https://github.com/PyCQA/pylint)
   
- [x] Radon [MIT]
    * [Site and docs](https://radon.readthedocs.io/en/latest/)
    * [Repository](https://github.com/rubik/radon)

Java language:

- [x]  PMD [BSD] (Version: 6.37.0)
    * [Site and docs](https://pmd.github.io/)
    * [Repository](https://github.com/pmd/pmd)
  
- [x]  Checkstyle [GNU LGPL v2.1] (Version: 8.44)
    * [Site and docs](https://checkstyle.sourceforge.io/)
    * [Repository](https://github.com/checkstyle/checkstyle)



Kotlin language:

- [x]  Detekt [Apache 2.0] (Version: 1.14.2)
    * [Site and docs](https://detekt.github.io/detekt/)
    * [Repository](https://github.com/detekt/detekt)



JavaScript language:

- [x]  ESlint [MIT] (Version: 7.5.0)
    * [Site and docs](https://eslint.org/)
    * [Repository](https://github.com/eslint/eslint)
  


Go language:

- [x] golangci-lint [GNU GPL v3.0] (Version: 1.49.0)
    * [Site and docs](https://golangci-lint.run/)
    * [Repository](https://github.com/golangci/golangci-lint)
---

## Installation

You have to create set of environment variables:
- `CHECKSTYLE_VERSION` (the value of the variable must be the same with its value in [Dockerfile](Dockerfile))
- `CHECKSTYLE_DIRECTORY` (the directory with `CHECKSTYLE` linter sources)
- `DETEKT_VERSION` (the value of the variable must be the same with its value in [Dockerfile](Dockerfile))
- `DETEKT_DIRECTORY` (the directory with `DETEKT` linter sources)
- `PMD_VERSION` (the value of the variable must be the same with its value in [Dockerfile](Dockerfile))
- `PMD_DIRECTORY` (the directory with `PMD` linter sources)
- `GOLANG_LINT_VERSION` (the value of the variable must be the same with its value in [Dockerfile](Dockerfile))
- `GOLANG_LINT_DIRECTORY` (the directory with `GOLANG_LINT` linter sources)

### Using script

Just run the following command:
```bash
./setup_environment.sh
```
and install everything the script suggests. 

**Note**: You can also use this script to update linters. To do this, just update the corresponding 
linter version variables, run the script, and reinstall only the necessary linters. 

### Manually

If you don't want to use the script, you can install the environment manually.

Simply clone the repository and run the following commands:

1. `pip install -r requirements.txt`
2. `pip install -r requirements-test.txt` for tests
3. `npm install eslint@7.5.0 -g && eslint --init`

You can download all linters sources manually or by the following commands:
- `CHECKSTYLE`: 
```bash
curl -L https://github.com/checkstyle/checkstyle/releases/download/checkstyle-${CHECKSTYLE_VERSION}/checkstyle-${CHECKSTYLE_VERSION}-all.jar > ${CHECKSTYLE_DIRECTORY}/checkstyle-${CHECKSTYLE_VERSION}-all.jar
```
- `DETEKT`: 
```bash
curl -sSLO https://github.com/detekt/detekt/releases/download/v${DETEKT_VERSION}/detekt-cli-${DETEKT_VERSION}.zip \
&& unzip detekt-cli-${DETEKT_VERSION}.zip -d ${DETEKT_DIRECTORY} \
&&  curl -H "Accept: application/zip" https://repo.maven.apache.org/maven2/io/gitlab/arturbosch/detekt/detekt-formatting/${DETEKT_VERSION}/detekt-formatting-${DETEKT_VERSION}.jar -o ${DETEKT_DIRECTORY}/detekt-formatting-${DETEKT_VERSION}.jar
```
- `PMD`: 
```bash
curl -sSLO https://github.com/pmd/pmd/releases/download/pmd_releases/${PMD_VERSION}/pmd-bin-${PMD_VERSION}.zip \
&& unzip pmd-bin-${PMD_VERSION}.zip -d ${PMD_DIRECTORY}
```
- `GOLANG_LINT`:
```bash
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b ${GOLANG_LINT_DIRECTORY} v${GOLANG_LINT_VERSION}
```

### Using docker

Alternatively, you can build a docker image by [Dockerfile](Dockerfile) and run the tool inside this image.
Or use the public docker image, that we use in the [build.yml](.github/workflows/build.yml) file.

## Usage

Run the [run_tool.py](hyperstyle/src/python/review/run_tool.py) with the arguments.

A simple configuration: `python run_tool.py <path>`.

**Required arguments:**
1. **path** — path to file or directory to inspect.

Optional arguments:

Argument | Description
--- | ---
**&#8209;h**, **&#8209;&#8209;help**      |  show the help message and exit.
**&#8209;v**, **&#8209;&#8209;verbosity** |  choose logging level according [this](https://docs.python.org/3/library/logging.html#levels) list: `1` - **ERROR**; `2` - **INFO**; `3` - **DEBUG**; `0` - disable logging (**CRITICAL** value); default value is `0` (**CRITICAL**).
**&#8209;d**, **&#8209;&#8209;disable**   |  disable inspectors. Available values: for **Python** language: `pylint` for [Pylint](https://github.com/PyCQA/pylint), `flake8` for [flake8](https://flake8.pycqa.org/en/latest/), `radon` for [Radon](https://radon.readthedocs.io/en/latest/), `python_ast` to check different measures providing by AST; for **Java** language: `checkstyle` for the [Checkstyle](https://checkstyle.sourceforge.io/), `pmd` for [PMD](https://pmd.github.io/); for `Kotlin` language: detekt for [Detekt](https://detekt.github.io/detekt/); for **JavaScript** language: `eslint` for [ESlint](https://eslint.org/); for **Go** language: `golang_lint` for [golangci-lint](https://golangci-lint.run/). Example: `-d pylint,flake8`.
**&#8209;&#8209;allow-duplicates**        |  allow duplicate issues found by different linters. By default, duplicates are skipped.
**&#8209;&#8209;language-version**, **&#8209;&#8209;language_version**  |  specify the language version for JAVA inspectors. Available values: `java7`, `java8`, `java9`, `java11`, `java15`, `java17`. **Note**: **&#8209;&#8209;language_version** is deprecated and will be deleted in the future.
**&#8209;&#8209;n-cpu**, **&#8209;&#8209;n_cpu**  |  specify number of _cpu_ that can be used to run inspectors. **Note**: **&#8209;&#8209;n_cpu** is deprecated. Will be deleted in the future.
**&#8209;f**, **&#8209;&#8209;format**    |  the output format. Available values: `json`, `text`. Default value is `json`.
**&#8209;s**, **&#8209;&#8209;start-line**|  the first line to be analyzed. By default it starts from `1`.
**&#8209;e**, **&#8209;&#8209;end-line**  |  the end line to be analyzed. The default value is `None`, which meant to handle file by the end.
**&#8209;&#8209;new-format**              |  the argument determines whether the tool should use the _new format_. _New format_ means separating the result by the files to allow getting quality and observed issues for each file separately. The default value is `False`.
**&#8209;&#8209;history**                 |  JSON string with a list of issues for each language. For each issue its class and quantity are specified. Example: `--history "{\"python\": [{\"origin_class\": \"SC200\", \"number\": 20}, {\"origin_class\": \"WPS314\", \"number\": 3}]}"`
**&#8209;&#8209;with&#8209;all&#8209;categories** | Without this flag, all issues will be categorized into 5 main categories: `CODE_STYLE`, `BEST_PRACTICES`, `ERROR_PRONE`, `COMPLEXITY`, `INFO`.
**&#8209;&#8209;group&#8209;by&#8209;difficulty** | With this flag, the final grade and influence on penalty will be grouped by the issue difficulty.
**&#8209;&#8209;language** | Specify the language to inspect. The tool will check all languages by default. The default value is `None`.

The output examples:

(_New format_ means separating the result by the files to allow getting quality and observed issues for each file separately)

1. Json `old format` (without **&#8209;&#8209;new-format** argument):

```json
{
  "quality": {
    "code": "BAD",
    "text": "Code quality (beta): BAD"
  },
  "issues": [
    {
      "code": "C002",
      "text": "Too long function. Try to split it into smaller functions / methods.It will make your code easy to understand and less error prone.",
      "line": "<the code line>",
      "line_number": 54,
      "column_number": 0,
      "category": "FUNC_LEN",
      "difficulty": "EASY",
      "influence_on_penalty": 0 
    },
    ...
  ]
}
```

2. Json `new format` (with **&#8209;&#8209;new-format** argument):

```json
{
  "quality": {
    "code": "BAD",
    "text": "Code quality (beta): BAD"
  },
  "file_review_results": [
    {
      "file_name": "<your file>",
      "quality": {
        "code": "BAD",
        "text": "Code quality (beta): BAD"
      },
      "issues": [
        {
          "code": "W0703",
          "text": "Catching too general exception Exception",
          "line": "<the code line>",
          "line_number": 174,
          "column_number": 12,
          "category": "BEST_PRACTICES", 
          "difficulty": "MEDIUM",
          "influence_on_penalty": 0 
        },
        ...
      ]
    }
  ]
}
```

3. Json `old format` (with **&#8209;&#8209;group&#8209;by&#8209;difficulty** argument):

```json
{
  "quality": {
    "EASY": {
      "code": "BAD",
      "text": "Code quality (beta): BAD"
    },
    "MEDIUM": {
      "code": "BAD",
      "text": "Code quality (beta): BAD"
    },
    "HARD": {
      "code": "BAD",
      "text": "Code quality (beta): BAD"
    }
  },
  "issues": [
    {
      "code": "C002",
      "text": "Too long function. Try to split it into smaller functions / methods.It will make your code easy to understand and less error prone.",
      "line": "<the code line>",
      "line_number": 54,
      "column_number": 0,
      "category": "FUNC_LEN",
      "difficulty": "EASY",
      "influence_on_penalty": {
        "EASY": 0,
        "MEDIUM": 0,
        "HARD": 0
      }
    },
    ...
  ]
}
```

4. Json `new format` (with **&#8209;&#8209;group&#8209;by&#8209;difficulty** argument)

```json
{
  "quality": {
    "EASY": {
      "code": "BAD",
      "text": "Code quality (beta): BAD"
    },
    "MEDIUM": {
      "code": "BAD",
      "text": "Code quality (beta): BAD"
    },
    "HARD": {
      "code": "BAD",
      "text": "Code quality (beta): BAD"
    }
  },
  "file_review_results": [
    {
      "file_name": "<your file>",
      "quality": {
        "EASY": {
          "code": "BAD",
          "text": "Code quality (beta): BAD"
        },
        "MEDIUM": {
          "code": "BAD",
          "text": "Code quality (beta): BAD"
        },
        "HARD": {
          "code": "BAD",
          "text": "Code quality (beta): BAD"
        }
      },
      "issues": [
        {
          "code": "W0703",
          "text": "Catching too general exception Exception",
          "line": "<the code line>",
          "line_number": 174,
          "column_number": 12,
          "category": "BEST_PRACTICES",
          "difficulty": "MEDIUM",
          "influence_on_penalty": {
            "EASY": 0,
            "MEDIUM": 0,
            "HARD": 0
          }
        },
        ...
      ]
    }
  ]
}
```

5. Text format:

```text
Review of <path to your file or project> (N violations)
***********************************************************************************************************
File <file_name>
-----------------------------------------------------------------------------------------------------------
Line № : Column № : Type     : Inspector  : Origin : Description   : Line         : Path
54     : 0        : FUNC_LEN : PYTHON_AST : C002   : <Description> : <code line > : <path to the file>
...
-----------------------------------------------------------------------------------------------------------
Code quality (beta): BAD
Next level: EXCELLENT
Next level requirements:
FUNC_LEN: 12

***********************************************************************************************************
General quality:
Code quality (beta): BAD
Next level: EXCELLENT
Next level requirements:
FUNC_LEN: 12
```

---

## Tests running

We use [`pytest`](https://docs.pytest.org/en/latest/contents.html) library for tests.

__Note__: If you have `ModuleNotFoundError` while you try to run tests, please call `pip install -e .`
 before using the test system.

__Note__: We use [eslint](https://eslint.org/) and [open-jdk 11](https://openjdk.java.net/projects/jdk/11/)
in the tests. Please, set up the environment before running the tests. 
You can see en example of the environment configuration in
the [Dockerfile](Dockerfile) file.

Use `pytest` from the root directory to run __ALL__ tests.


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/hyperskill/hyperstyle",
    "name": "hyperstyle",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8, <4",
    "maintainer_email": "",
    "keywords": "code review",
    "author": "Stepik.org",
    "author_email": "ivan.magda@stepik.org",
    "download_url": "https://files.pythonhosted.org/packages/86/4f/40f120601641da116b056bea1673e9058ca5009e5675ea35ac757bd5f2d7/hyperstyle-1.4.4.tar.gz",
    "platform": null,
    "description": "![Python build](https://github.com/hyperskill/hyperstyle/workflows/Python%20build/badge.svg?branch=develop)\n\n# Hyperstyle\n\nA tool for running a set of pre-configured linters and evaluating code quality.\nIt is used on the [Hyperskill](https://hyperskill.org/) platform \nto check the quality of learners' code.\n\n[Read more detail about the project at Hyperskill Help Center](https://support.hyperskill.org/hc/en-us/articles/360049582712-Code-style-Code-quality)\n\n[The dockerized version](https://hub.docker.com/r/stepik/hyperstyle/tags)\n\n## What it does:\n\n* Runs linters for several programming languages and parses their output;\n* Prints the result using a unified JSON-based format;\n* Evaluates the code quality value (**EXCELLENT**, **GOOD**, **MODERATE**, or **BAD**) \nbased on the linters' output and some heuristics.\n\n\n## License and 3rd party software\n\nThe source code of **hyperstyle** is distributed under the Apache 2.0 License.\n\nThe 3rd party software we use in this project has its own licenses.\n\nPython language (all versions can be found in the [requirements.txt](requirements.txt) file):\n\n- [x]  flake8 [MIT]\n    * [Site and docs](https://flake8.pycqa.org/en/latest/)\n    * [Repository](https://github.com/PyCQA/flake8)\n  \n- [x]  Pylint [GNU LGPL v2]\n    * [Site and docs](https://www.pylint.org/)\n    * [Repository](https://github.com/PyCQA/pylint)\n   \n- [x] Radon [MIT]\n    * [Site and docs](https://radon.readthedocs.io/en/latest/)\n    * [Repository](https://github.com/rubik/radon)\n\nJava language:\n\n- [x]  PMD [BSD] (Version: 6.37.0)\n    * [Site and docs](https://pmd.github.io/)\n    * [Repository](https://github.com/pmd/pmd)\n  \n- [x]  Checkstyle [GNU LGPL v2.1] (Version: 8.44)\n    * [Site and docs](https://checkstyle.sourceforge.io/)\n    * [Repository](https://github.com/checkstyle/checkstyle)\n\n\n\nKotlin language:\n\n- [x]  Detekt [Apache 2.0] (Version: 1.14.2)\n    * [Site and docs](https://detekt.github.io/detekt/)\n    * [Repository](https://github.com/detekt/detekt)\n\n\n\nJavaScript language:\n\n- [x]  ESlint [MIT] (Version: 7.5.0)\n    * [Site and docs](https://eslint.org/)\n    * [Repository](https://github.com/eslint/eslint)\n  \n\n\nGo language:\n\n- [x] golangci-lint [GNU GPL v3.0] (Version: 1.49.0)\n    * [Site and docs](https://golangci-lint.run/)\n    * [Repository](https://github.com/golangci/golangci-lint)\n---\n\n## Installation\n\nYou have to create set of environment variables:\n- `CHECKSTYLE_VERSION` (the value of the variable must be the same with its value in [Dockerfile](Dockerfile))\n- `CHECKSTYLE_DIRECTORY` (the directory with `CHECKSTYLE` linter sources)\n- `DETEKT_VERSION` (the value of the variable must be the same with its value in [Dockerfile](Dockerfile))\n- `DETEKT_DIRECTORY` (the directory with `DETEKT` linter sources)\n- `PMD_VERSION` (the value of the variable must be the same with its value in [Dockerfile](Dockerfile))\n- `PMD_DIRECTORY` (the directory with `PMD` linter sources)\n- `GOLANG_LINT_VERSION` (the value of the variable must be the same with its value in [Dockerfile](Dockerfile))\n- `GOLANG_LINT_DIRECTORY` (the directory with `GOLANG_LINT` linter sources)\n\n### Using script\n\nJust run the following command:\n```bash\n./setup_environment.sh\n```\nand install everything the script suggests. \n\n**Note**: You can also use this script to update linters. To do this, just update the corresponding \nlinter version variables, run the script, and reinstall only the necessary linters. \n\n### Manually\n\nIf you don't want to use the script, you can install the environment manually.\n\nSimply clone the repository and run the following commands:\n\n1. `pip install -r requirements.txt`\n2. `pip install -r requirements-test.txt` for tests\n3. `npm install eslint@7.5.0 -g && eslint --init`\n\nYou can download all linters sources manually or by the following commands:\n- `CHECKSTYLE`: \n```bash\ncurl -L https://github.com/checkstyle/checkstyle/releases/download/checkstyle-${CHECKSTYLE_VERSION}/checkstyle-${CHECKSTYLE_VERSION}-all.jar > ${CHECKSTYLE_DIRECTORY}/checkstyle-${CHECKSTYLE_VERSION}-all.jar\n```\n- `DETEKT`: \n```bash\ncurl -sSLO https://github.com/detekt/detekt/releases/download/v${DETEKT_VERSION}/detekt-cli-${DETEKT_VERSION}.zip \\\n&& unzip detekt-cli-${DETEKT_VERSION}.zip -d ${DETEKT_DIRECTORY} \\\n&&  curl -H \"Accept: application/zip\" https://repo.maven.apache.org/maven2/io/gitlab/arturbosch/detekt/detekt-formatting/${DETEKT_VERSION}/detekt-formatting-${DETEKT_VERSION}.jar -o ${DETEKT_DIRECTORY}/detekt-formatting-${DETEKT_VERSION}.jar\n```\n- `PMD`: \n```bash\ncurl -sSLO https://github.com/pmd/pmd/releases/download/pmd_releases/${PMD_VERSION}/pmd-bin-${PMD_VERSION}.zip \\\n&& unzip pmd-bin-${PMD_VERSION}.zip -d ${PMD_DIRECTORY}\n```\n- `GOLANG_LINT`:\n```bash\ncurl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b ${GOLANG_LINT_DIRECTORY} v${GOLANG_LINT_VERSION}\n```\n\n### Using docker\n\nAlternatively, you can build a docker image by [Dockerfile](Dockerfile) and run the tool inside this image.\nOr use the public docker image, that we use in the [build.yml](.github/workflows/build.yml) file.\n\n## Usage\n\nRun the [run_tool.py](hyperstyle/src/python/review/run_tool.py) with the arguments.\n\nA simple configuration: `python run_tool.py <path>`.\n\n**Required arguments:**\n1. **path** \u2014 path to file or directory to inspect.\n\nOptional arguments:\n\nArgument | Description\n--- | ---\n**&#8209;h**, **&#8209;&#8209;help**      |  show the help message and exit.\n**&#8209;v**, **&#8209;&#8209;verbosity** |  choose logging level according [this](https://docs.python.org/3/library/logging.html#levels) list: `1` - **ERROR**; `2` - **INFO**; `3` - **DEBUG**; `0` - disable logging (**CRITICAL** value); default value is `0` (**CRITICAL**).\n**&#8209;d**, **&#8209;&#8209;disable**   |  disable inspectors. Available values: for **Python** language: `pylint` for [Pylint](https://github.com/PyCQA/pylint), `flake8` for [flake8](https://flake8.pycqa.org/en/latest/), `radon` for [Radon](https://radon.readthedocs.io/en/latest/), `python_ast` to check different measures providing by AST; for **Java** language: `checkstyle` for the [Checkstyle](https://checkstyle.sourceforge.io/), `pmd` for [PMD](https://pmd.github.io/); for `Kotlin` language: detekt for [Detekt](https://detekt.github.io/detekt/); for **JavaScript** language: `eslint` for [ESlint](https://eslint.org/); for **Go** language: `golang_lint` for [golangci-lint](https://golangci-lint.run/). Example: `-d pylint,flake8`.\n**&#8209;&#8209;allow-duplicates**        |  allow duplicate issues found by different linters. By default, duplicates are skipped.\n**&#8209;&#8209;language-version**, **&#8209;&#8209;language_version**  |  specify the language version for JAVA inspectors. Available values: `java7`, `java8`, `java9`, `java11`, `java15`, `java17`. **Note**: **&#8209;&#8209;language_version** is deprecated and will be deleted in the future.\n**&#8209;&#8209;n-cpu**, **&#8209;&#8209;n_cpu**  |  specify number of _cpu_ that can be used to run inspectors. **Note**: **&#8209;&#8209;n_cpu** is deprecated. Will be deleted in the future.\n**&#8209;f**, **&#8209;&#8209;format**    |  the output format. Available values: `json`, `text`. Default value is `json`.\n**&#8209;s**, **&#8209;&#8209;start-line**|  the first line to be analyzed. By default it starts from `1`.\n**&#8209;e**, **&#8209;&#8209;end-line**  |  the end line to be analyzed. The default value is `None`, which meant to handle file by the end.\n**&#8209;&#8209;new-format**              |  the argument determines whether the tool should use the _new format_. _New format_ means separating the result by the files to allow getting quality and observed issues for each file separately. The default value is `False`.\n**&#8209;&#8209;history**                 |  JSON string with a list of issues for each language. For each issue its class and quantity are specified. Example: `--history \"{\\\"python\\\": [{\\\"origin_class\\\": \\\"SC200\\\", \\\"number\\\": 20}, {\\\"origin_class\\\": \\\"WPS314\\\", \\\"number\\\": 3}]}\"`\n**&#8209;&#8209;with&#8209;all&#8209;categories** | Without this flag, all issues will be categorized into 5 main categories: `CODE_STYLE`, `BEST_PRACTICES`, `ERROR_PRONE`, `COMPLEXITY`, `INFO`.\n**&#8209;&#8209;group&#8209;by&#8209;difficulty** | With this flag, the final grade and influence on penalty will be grouped by the issue difficulty.\n**&#8209;&#8209;language** | Specify the language to inspect. The tool will check all languages by default. The default value is `None`.\n\nThe output examples:\n\n(_New format_ means separating the result by the files to allow getting quality and observed issues for each file separately)\n\n1. Json `old format` (without **&#8209;&#8209;new-format** argument):\n\n```json\n{\n  \"quality\": {\n    \"code\": \"BAD\",\n    \"text\": \"Code quality (beta): BAD\"\n  },\n  \"issues\": [\n    {\n      \"code\": \"C002\",\n      \"text\": \"Too long function. Try to split it into smaller functions / methods.It will make your code easy to understand and less error prone.\",\n      \"line\": \"<the code line>\",\n      \"line_number\": 54,\n      \"column_number\": 0,\n      \"category\": \"FUNC_LEN\",\n      \"difficulty\": \"EASY\",\n      \"influence_on_penalty\": 0 \n    },\n    ...\n  ]\n}\n```\n\n2. Json `new format` (with **&#8209;&#8209;new-format** argument):\n\n```json\n{\n  \"quality\": {\n    \"code\": \"BAD\",\n    \"text\": \"Code quality (beta): BAD\"\n  },\n  \"file_review_results\": [\n    {\n      \"file_name\": \"<your file>\",\n      \"quality\": {\n        \"code\": \"BAD\",\n        \"text\": \"Code quality (beta): BAD\"\n      },\n      \"issues\": [\n        {\n          \"code\": \"W0703\",\n          \"text\": \"Catching too general exception Exception\",\n          \"line\": \"<the code line>\",\n          \"line_number\": 174,\n          \"column_number\": 12,\n          \"category\": \"BEST_PRACTICES\", \n          \"difficulty\": \"MEDIUM\",\n          \"influence_on_penalty\": 0 \n        },\n        ...\n      ]\n    }\n  ]\n}\n```\n\n3. Json `old format` (with **&#8209;&#8209;group&#8209;by&#8209;difficulty** argument):\n\n```json\n{\n  \"quality\": {\n    \"EASY\": {\n      \"code\": \"BAD\",\n      \"text\": \"Code quality (beta): BAD\"\n    },\n    \"MEDIUM\": {\n      \"code\": \"BAD\",\n      \"text\": \"Code quality (beta): BAD\"\n    },\n    \"HARD\": {\n      \"code\": \"BAD\",\n      \"text\": \"Code quality (beta): BAD\"\n    }\n  },\n  \"issues\": [\n    {\n      \"code\": \"C002\",\n      \"text\": \"Too long function. Try to split it into smaller functions / methods.It will make your code easy to understand and less error prone.\",\n      \"line\": \"<the code line>\",\n      \"line_number\": 54,\n      \"column_number\": 0,\n      \"category\": \"FUNC_LEN\",\n      \"difficulty\": \"EASY\",\n      \"influence_on_penalty\": {\n        \"EASY\": 0,\n        \"MEDIUM\": 0,\n        \"HARD\": 0\n      }\n    },\n    ...\n  ]\n}\n```\n\n4. Json `new format` (with **&#8209;&#8209;group&#8209;by&#8209;difficulty** argument)\n\n```json\n{\n  \"quality\": {\n    \"EASY\": {\n      \"code\": \"BAD\",\n      \"text\": \"Code quality (beta): BAD\"\n    },\n    \"MEDIUM\": {\n      \"code\": \"BAD\",\n      \"text\": \"Code quality (beta): BAD\"\n    },\n    \"HARD\": {\n      \"code\": \"BAD\",\n      \"text\": \"Code quality (beta): BAD\"\n    }\n  },\n  \"file_review_results\": [\n    {\n      \"file_name\": \"<your file>\",\n      \"quality\": {\n        \"EASY\": {\n          \"code\": \"BAD\",\n          \"text\": \"Code quality (beta): BAD\"\n        },\n        \"MEDIUM\": {\n          \"code\": \"BAD\",\n          \"text\": \"Code quality (beta): BAD\"\n        },\n        \"HARD\": {\n          \"code\": \"BAD\",\n          \"text\": \"Code quality (beta): BAD\"\n        }\n      },\n      \"issues\": [\n        {\n          \"code\": \"W0703\",\n          \"text\": \"Catching too general exception Exception\",\n          \"line\": \"<the code line>\",\n          \"line_number\": 174,\n          \"column_number\": 12,\n          \"category\": \"BEST_PRACTICES\",\n          \"difficulty\": \"MEDIUM\",\n          \"influence_on_penalty\": {\n            \"EASY\": 0,\n            \"MEDIUM\": 0,\n            \"HARD\": 0\n          }\n        },\n        ...\n      ]\n    }\n  ]\n}\n```\n\n5. Text format:\n\n```text\nReview of <path to your file or project> (N violations)\n***********************************************************************************************************\nFile <file_name>\n-----------------------------------------------------------------------------------------------------------\nLine \u2116 : Column \u2116 : Type     : Inspector  : Origin : Description   : Line         : Path\n54     : 0        : FUNC_LEN : PYTHON_AST : C002   : <Description> : <code line > : <path to the file>\n...\n-----------------------------------------------------------------------------------------------------------\nCode quality (beta): BAD\nNext level: EXCELLENT\nNext level requirements:\nFUNC_LEN: 12\n\n***********************************************************************************************************\nGeneral quality:\nCode quality (beta): BAD\nNext level: EXCELLENT\nNext level requirements:\nFUNC_LEN: 12\n```\n\n---\n\n## Tests running\n\nWe use [`pytest`](https://docs.pytest.org/en/latest/contents.html) library for tests.\n\n__Note__: If you have `ModuleNotFoundError` while you try to run tests, please call `pip install -e .`\n before using the test system.\n\n__Note__: We use [eslint](https://eslint.org/) and [open-jdk 11](https://openjdk.java.net/projects/jdk/11/)\nin the tests. Please, set up the environment before running the tests. \nYou can see en example of the environment configuration in\nthe [Dockerfile](Dockerfile) file.\n\nUse `pytest` from the root directory to run __ALL__ tests.\n\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "A tool for running a set of pre-configured linters and evaluating code quality.",
    "version": "1.4.4",
    "project_urls": {
        "Homepage": "https://github.com/hyperskill/hyperstyle"
    },
    "split_keywords": [
        "code",
        "review"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6b7ed19efcc89ca2c28e900455d31c36ff26bb0224afdeaaa808cdd832b01432",
                "md5": "691f19dcfe22e2eae66af4695aa98e0d",
                "sha256": "8ea2de5cf41a6df06590ff72b4465f11c8d2a7911105f9409e90f9796005cf9f"
            },
            "downloads": -1,
            "filename": "hyperstyle-1.4.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "691f19dcfe22e2eae66af4695aa98e0d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8, <4",
            "size": 146016,
            "upload_time": "2023-09-05T11:49:50",
            "upload_time_iso_8601": "2023-09-05T11:49:50.906414Z",
            "url": "https://files.pythonhosted.org/packages/6b/7e/d19efcc89ca2c28e900455d31c36ff26bb0224afdeaaa808cdd832b01432/hyperstyle-1.4.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "864f40f120601641da116b056bea1673e9058ca5009e5675ea35ac757bd5f2d7",
                "md5": "2eb8717acd6f8bdae692a5ed2b4e2dcf",
                "sha256": "877a11ff339d133dde153ecf45402051e001eda332ed8738cc4726fb70a6ade4"
            },
            "downloads": -1,
            "filename": "hyperstyle-1.4.4.tar.gz",
            "has_sig": false,
            "md5_digest": "2eb8717acd6f8bdae692a5ed2b4e2dcf",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8, <4",
            "size": 103972,
            "upload_time": "2023-09-05T11:49:52",
            "upload_time_iso_8601": "2023-09-05T11:49:52.892113Z",
            "url": "https://files.pythonhosted.org/packages/86/4f/40f120601641da116b056bea1673e9058ca5009e5675ea35ac757bd5f2d7/hyperstyle-1.4.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-09-05 11:49:52",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "hyperskill",
    "github_project": "hyperstyle",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "tox": true,
    "lcname": "hyperstyle"
}
        
Elapsed time: 0.11213s