diff --git a/README.md b/README.md index bd656c79..2310f493 100644 --- a/README.md +++ b/README.md @@ -106,6 +106,7 @@ Argument | Description **‑‑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`. **‑‑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}]}"` **‑‑with‑all‑categories** | Without this flag, all issues will be categorized into 5 main categories: `CODE_STYLE`, `BEST_PRACTICES`, `ERROR_PRONE`, `COMPLEXITY`, `INFO`. +**‑‑group‑by‑difficulty** | With this flag, the final grade and influence on penalty will be grouped by the issue difficulty. The output examples: @@ -127,6 +128,7 @@ The output examples: "line_number": 54, "column_number": 0, "category": "FUNC_LEN", + "difficulty": "EASY", "influence_on_penalty": 0 }, ... @@ -157,6 +159,7 @@ The output examples: "line_number": 174, "column_number": 12, "category": "BEST_PRACTICES", + "difficulty": "MEDIUM", "influence_on_penalty": 0 }, ... diff --git a/src/python/common/tool_arguments.py b/src/python/common/tool_arguments.py index 5911933a..0edb4689 100644 --- a/src/python/common/tool_arguments.py +++ b/src/python/common/tool_arguments.py @@ -82,6 +82,9 @@ class RunToolArgument(Enum): 'Without this flag, all issues will be categorized into 5 main categories: ' 'CODE_STYLE, BEST_PRACTICES, ERROR_PRONE, COMPLEXITY, INFO.') + GROUP_BY_DIFFICULTY = ArgumentsInfo(None, '--group-by-difficulty', + 'With this flag, the final grade will be grouped by the issue difficulty.') + SOLUTIONS_FILE_PATH = ArgumentsInfo(None, 'solutions_file_path', 'Local XLSX-file or CSV-file path. ' 'Your file must include column-names: ' diff --git a/src/python/evaluation/issues_statistics/common/raw_issue_encoder_decoder.py b/src/python/evaluation/issues_statistics/common/raw_issue_encoder_decoder.py index 7de4f3b4..42206eb3 100644 --- a/src/python/evaluation/issues_statistics/common/raw_issue_encoder_decoder.py +++ b/src/python/evaluation/issues_statistics/common/raw_issue_encoder_decoder.py @@ -7,6 +7,7 @@ CodeIssue, get_issue_class_by_issue_type, IssueData, + IssueDifficulty, IssueType, Measurable, MEASURABLE_ISSUE_TYPE_TO_MEASURE_NAME, @@ -32,6 +33,7 @@ def default(self, obj): IssueData.LINE_NUMBER.value: obj.line_no, IssueData.COLUMN_NUMBER.value: obj.column_no, IssueData.INSPECTOR_TYPE.value: obj.inspector_type.value, + IssueData.DIFFICULTY.value: obj.difficulty.value, } if isinstance(obj, Measurable): @@ -50,6 +52,10 @@ def object_hook(self, json_dict): json_dict[IssueData.ISSUE_TYPE.value] = IssueType(json_dict[IssueData.ISSUE_TYPE.value]) json_dict[IssueData.INSPECTOR_TYPE.value] = InspectorType(json_dict[IssueData.INSPECTOR_TYPE.value]) json_dict[IssueData.FILE_PATH.value] = Path(json_dict[IssueData.FILE_PATH.value]) + # TODO: remove get after analyzing raw issue statistics + json_dict[IssueData.DIFFICULTY.value] = IssueDifficulty( + json_dict.get(IssueData.DIFFICULTY.value, IssueDifficulty.HARD.value), + ) issue_type = json_dict[IssueData.ISSUE_TYPE.value] if issue_type in MEASURABLE_ISSUE_TYPE_TO_MEASURE_NAME.keys(): diff --git a/src/python/review/application_config.py b/src/python/review/application_config.py index bc59b621..07a72780 100644 --- a/src/python/review/application_config.py +++ b/src/python/review/application_config.py @@ -17,6 +17,7 @@ class ApplicationConfig: end_line: Optional[int] = None new_format: bool = False history: Optional[str] = None + group_by_difficulty: bool = False @unique diff --git a/src/python/review/inspectors/checkstyle/checkstyle.py b/src/python/review/inspectors/checkstyle/checkstyle.py index 0eafef7f..f441fcbb 100644 --- a/src/python/review/inspectors/checkstyle/checkstyle.py +++ b/src/python/review/inspectors/checkstyle/checkstyle.py @@ -7,7 +7,7 @@ from src.python.review.inspectors.base_inspector import BaseInspector from src.python.review.inspectors.checkstyle.issue_types import CHECK_CLASS_NAME_TO_ISSUE_TYPE from src.python.review.inspectors.inspector_type import InspectorType -from src.python.review.inspectors.issue import BaseIssue, IssueType +from src.python.review.inspectors.issue import BaseIssue, IssueDifficulty, IssueType from src.python.review.inspectors.parsers.checkstyle_parser import parse_checkstyle_file_result logger = logging.getLogger(__name__) @@ -51,6 +51,7 @@ def inspect(self, path: Path, config: Dict[str, Any]) -> List[BaseIssue]: return parse_checkstyle_file_result(Path(output_path), self.inspector_type, self.choose_issue_type, + IssueDifficulty.get_by_issue_type, self.origin_class_to_pattern) @classmethod diff --git a/src/python/review/inspectors/detekt/detekt.py b/src/python/review/inspectors/detekt/detekt.py index f9a9bdec..7460880e 100644 --- a/src/python/review/inspectors/detekt/detekt.py +++ b/src/python/review/inspectors/detekt/detekt.py @@ -7,7 +7,7 @@ from src.python.review.inspectors.base_inspector import BaseInspector from src.python.review.inspectors.detekt.issue_types import DETECT_CLASS_NAME_TO_ISSUE_TYPE from src.python.review.inspectors.inspector_type import InspectorType -from src.python.review.inspectors.issue import BaseIssue, IssueType +from src.python.review.inspectors.issue import BaseIssue, IssueDifficulty, IssueType from src.python.review.inspectors.parsers.checkstyle_parser import parse_checkstyle_file_result logger = logging.getLogger(__name__) @@ -50,6 +50,7 @@ def inspect(self, path: Path, config: Dict[str, Any]) -> List[BaseIssue]: return parse_checkstyle_file_result(output_path, self.inspector_type, self.choose_issue_type, + IssueDifficulty.get_by_issue_type, self.origin_class_to_pattern) @classmethod diff --git a/src/python/review/inspectors/eslint/eslint.py b/src/python/review/inspectors/eslint/eslint.py index 0d4736d4..7bcdb94f 100644 --- a/src/python/review/inspectors/eslint/eslint.py +++ b/src/python/review/inspectors/eslint/eslint.py @@ -6,7 +6,7 @@ from src.python.review.inspectors.base_inspector import BaseInspector from src.python.review.inspectors.eslint.issue_types import ESLINT_CLASS_NAME_TO_ISSUE_TYPE from src.python.review.inspectors.inspector_type import InspectorType -from src.python.review.inspectors.issue import BaseIssue, IssueType +from src.python.review.inspectors.issue import BaseIssue, IssueDifficulty, IssueType from src.python.review.inspectors.parsers.checkstyle_parser import parse_checkstyle_file_result PATH_ESLINT_CONFIG = Path(__file__).parent / '.eslintrc' @@ -41,6 +41,7 @@ def inspect(self, path: Path, config: Dict[str, Any]) -> List[BaseIssue]: issues = parse_checkstyle_file_result(output_path, self.inspector_type, self.choose_issue_type, + IssueDifficulty.get_by_issue_type, self.origin_class_to_pattern) output_path.unlink() diff --git a/src/python/review/inspectors/flake8/flake8.py b/src/python/review/inspectors/flake8/flake8.py index a427cb14..a4b19e32 100644 --- a/src/python/review/inspectors/flake8/flake8.py +++ b/src/python/review/inspectors/flake8/flake8.py @@ -14,6 +14,7 @@ CohesionIssue, CyclomaticComplexityIssue, IssueData, + IssueDifficulty, IssueType, LineLenIssue, ) @@ -71,25 +72,32 @@ def parse(cls, output: str) -> List[BaseIssue]: column_number=column_number, origin_class=origin_class) if cc_match is not None: # mccabe: cyclomatic complexity + issue_type = IssueType.CYCLOMATIC_COMPLEXITY issue_data[IssueData.DESCRIPTION.value] = get_cyclomatic_complexity_tip() issue_data[IssueData.CYCLOMATIC_COMPLEXITY.value] = int(cc_match.groups()[1]) - issue_data[IssueData.ISSUE_TYPE.value] = IssueType.CYCLOMATIC_COMPLEXITY + issue_data[IssueData.ISSUE_TYPE.value] = issue_type + issue_data[IssueData.DIFFICULTY.value] = IssueDifficulty.get_by_issue_type(issue_type) issues.append(CyclomaticComplexityIssue(**issue_data)) elif cohesion_match is not None: # flake8-cohesion + issue_type = IssueType.COHESION issue_data[IssueData.DESCRIPTION.value] = description # TODO: Add tip issue_data[IssueData.COHESION_LACK.value] = convert_percentage_of_value_to_lack_of_value( float(cohesion_match.group(1)), ) - issue_data[IssueData.ISSUE_TYPE.value] = IssueType.COHESION + issue_data[IssueData.ISSUE_TYPE.value] = issue_type + issue_data[IssueData.DIFFICULTY.value] = IssueDifficulty.get_by_issue_type(issue_type) issues.append(CohesionIssue(**issue_data)) elif line_len_match is not None: + issue_type = IssueType.LINE_LEN issue_data[IssueData.DESCRIPTION.value] = get_line_len_tip() issue_data[IssueData.LINE_LEN.value] = int(line_len_match.groups()[0]) issue_data[IssueData.ISSUE_TYPE.value] = IssueType.LINE_LEN + issue_data[IssueData.DIFFICULTY.value] = IssueDifficulty.get_by_issue_type(issue_type) issues.append(LineLenIssue(**issue_data)) else: issue_type = cls.choose_issue_type(origin_class) issue_data[IssueData.ISSUE_TYPE.value] = issue_type + issue_data[IssueData.DIFFICULTY.value] = IssueDifficulty.get_by_issue_type(issue_type) issue_data[IssueData.DESCRIPTION.value] = description issues.append(CodeIssue(**issue_data)) diff --git a/src/python/review/inspectors/intellij/intellij.py b/src/python/review/inspectors/intellij/intellij.py index 360cb089..46a0437c 100644 --- a/src/python/review/inspectors/intellij/intellij.py +++ b/src/python/review/inspectors/intellij/intellij.py @@ -10,7 +10,7 @@ from src.python.review.inspectors.base_inspector import BaseInspector from src.python.review.inspectors.inspector_type import InspectorType from src.python.review.inspectors.intellij.issue_types import ISSUE_CLASS_TO_ISSUE_TYPE -from src.python.review.inspectors.issue import BaseIssue, CodeIssue, IssueType +from src.python.review.inspectors.issue import BaseIssue, CodeIssue, IssueDifficulty, IssueType logger = logging.getLogger(__name__) @@ -161,6 +161,7 @@ def parse(cls, out_dir_path: Path, origin_class=issue_class, inspector_type=cls.inspector_type, type=issue_type, + difficulty=IssueDifficulty.get_by_issue_type(issue_type), )) return issues diff --git a/src/python/review/inspectors/issue.py b/src/python/review/inspectors/issue.py index b6fcb45e..055f77c7 100644 --- a/src/python/review/inspectors/issue.py +++ b/src/python/review/inspectors/issue.py @@ -1,4 +1,5 @@ import abc +import logging from collections import defaultdict from dataclasses import dataclass from enum import Enum, unique @@ -7,6 +8,8 @@ from src.python.review.inspectors.inspector_type import InspectorType +logger = logging.getLogger(__name__) + @unique class IssueType(Enum): @@ -118,6 +121,7 @@ class IssueData(Enum): # Additional fields ISSUE_TYPE = 'type' DESCRIPTION = 'description' + DIFFICULTY = 'difficulty' LINE_LEN = 'line_len' FUNCTION_LEN = 'func_len' @@ -142,6 +146,48 @@ def get_base_issue_data_dict(cls, } +@unique +class IssueDifficulty(Enum): + EASY = 'EASY' + MEDIUM = 'MEDIUM' + HARD = 'HARD' + + @classmethod + def get_by_issue_type(cls, issue_type: IssueType) -> 'IssueDifficulty': + issue_type_to_difficulty = { + # Easy + IssueType.CODE_STYLE: cls.EASY, + IssueType.LINE_LEN: cls.EASY, + IssueType.FUNC_LEN: cls.EASY, + IssueType.BOOL_EXPR_LEN: cls.EASY, + IssueType.INFO: cls.EASY, # Because INFO should always be shown on the platforms + + # Medium + IssueType.BEST_PRACTICES: cls.MEDIUM, + + # Hard + IssueType.CLASS_RESPONSE: cls.HARD, + IssueType.METHOD_NUMBER: cls.HARD, + IssueType.ERROR_PRONE: cls.HARD, + IssueType.COMPLEXITY: cls.HARD, + IssueType.CYCLOMATIC_COMPLEXITY: cls.HARD, + IssueType.INHERITANCE_DEPTH: cls.HARD, + IssueType.CHILDREN_NUMBER: cls.HARD, + IssueType.WEIGHTED_METHOD: cls.HARD, + IssueType.COUPLING: cls.HARD, + IssueType.COHESION: cls.HARD, + IssueType.MAINTAINABILITY: cls.HARD, + IssueType.UNDEFINED: cls.HARD, + IssueType.ARCHITECTURE: cls.HARD, + } + + if issue_type not in issue_type_to_difficulty: + logger.warning(f'IssueDifficulty: {issue_type} - unknown issue type.') + return cls.HARD + + return issue_type_to_difficulty[issue_type] + + @dataclass(frozen=True, eq=True) class ShortIssue: origin_class: str @@ -158,6 +204,7 @@ class BaseIssue(ShortIssue): column_no: int inspector_type: InspectorType + difficulty: IssueDifficulty class Measurable(abc.ABC): diff --git a/src/python/review/inspectors/parsers/checkstyle_parser.py b/src/python/review/inspectors/parsers/checkstyle_parser.py index 482340c4..413f084e 100644 --- a/src/python/review/inspectors/parsers/checkstyle_parser.py +++ b/src/python/review/inspectors/parsers/checkstyle_parser.py @@ -13,6 +13,7 @@ CyclomaticComplexityIssue, FuncLenIssue, IssueData, + IssueDifficulty, IssueType, LineLenIssue, ) @@ -101,6 +102,7 @@ def parse_checkstyle_file_result( file_path: Path, inspector_type: InspectorType, issue_type_selector: Callable[[str], IssueType], + difficulty_selector: Callable[[IssueType], IssueDifficulty], origin_class_to_description: Dict[str, str]) -> List[BaseIssue]: """ Parses the output, which is a xml file, and returns a list of the issues found there. @@ -137,6 +139,7 @@ def parse_checkstyle_file_result( issue_type = issue_type_selector(origin_class) issue_data[IssueData.ISSUE_TYPE.value] = issue_type + issue_data[IssueData.DIFFICULTY.value] = difficulty_selector(issue_type) if origin_class in origin_class_to_description: pattern = origin_class_to_description.get(origin_class) diff --git a/src/python/review/inspectors/pmd/pmd.py b/src/python/review/inspectors/pmd/pmd.py index 6f6f1b08..b6379e19 100644 --- a/src/python/review/inspectors/pmd/pmd.py +++ b/src/python/review/inspectors/pmd/pmd.py @@ -10,7 +10,7 @@ from src.python.review.inspectors.base_inspector import BaseInspector from src.python.review.inspectors.common import remove_prefix from src.python.review.inspectors.inspector_type import InspectorType -from src.python.review.inspectors.issue import BaseIssue, CodeIssue, IssueType +from src.python.review.inspectors.issue import BaseIssue, CodeIssue, IssueDifficulty, IssueType from src.python.review.inspectors.pmd.issue_types import PMD_RULE_TO_ISSUE_TYPE logger = logging.getLogger(__name__) @@ -78,6 +78,7 @@ def parse_output(self, output_path: Path) -> List[BaseIssue]: origin_class=row['Rule'], description=row['Description'], inspector_type=self.inspector_type, + difficulty=IssueDifficulty.get_by_issue_type(self.choose_issue_type(row['Rule'])), ) for row in reader] @classmethod diff --git a/src/python/review/inspectors/pyast/python_ast.py b/src/python/review/inspectors/pyast/python_ast.py index 77cdb8d1..cb0eb537 100644 --- a/src/python/review/inspectors/pyast/python_ast.py +++ b/src/python/review/inspectors/pyast/python_ast.py @@ -8,7 +8,7 @@ from src.python.review.common.language import Language from src.python.review.inspectors.base_inspector import BaseInspector from src.python.review.inspectors.inspector_type import InspectorType -from src.python.review.inspectors.issue import BaseIssue, BoolExprLenIssue, FuncLenIssue, IssueType +from src.python.review.inspectors.issue import BaseIssue, BoolExprLenIssue, FuncLenIssue, IssueDifficulty, IssueType from src.python.review.inspectors.tips import get_bool_expr_len_tip, get_func_len_tip BOOL_EXPR_LEN_ORIGIN_CLASS = 'C001' @@ -32,6 +32,8 @@ def visit(self, node: ast.AST): if isinstance(inner_node, ast.BoolOp): length += len(inner_node.values) - 1 + issue_type = PythonAstInspector.choose_issue_type(BOOL_EXPR_LEN_ORIGIN_CLASS) + self.bool_expression_lens.append(BoolExprLenIssue( file_path=self._file_path, line_no=node.lineno, @@ -40,7 +42,8 @@ def visit(self, node: ast.AST): origin_class=BOOL_EXPR_LEN_ORIGIN_CLASS, inspector_type=self._inspector_type, bool_expr_len=length, - type=PythonAstInspector.choose_issue_type(BOOL_EXPR_LEN_ORIGIN_CLASS), + type=issue_type, + difficulty=IssueDifficulty.get_by_issue_type(issue_type), )) @@ -61,6 +64,8 @@ def visit(self, node): self._previous_node.lineno, node.lineno, ) + issue_type = PythonAstInspector.choose_issue_type(FUNC_LEN_ORIGIN_CLASS) + self._function_lens.append(FuncLenIssue( file_path=self._file_path, line_no=self._previous_node.lineno, @@ -69,7 +74,8 @@ def visit(self, node): origin_class=FUNC_LEN_ORIGIN_CLASS, inspector_type=self._inspector_type, func_len=func_length, - type=PythonAstInspector.choose_issue_type(FUNC_LEN_ORIGIN_CLASS), + type=issue_type, + difficulty=IssueDifficulty.get_by_issue_type(issue_type), )) self._previous_node = node @@ -83,6 +89,8 @@ def function_lens(self) -> List[FuncLenIssue]: self._previous_node.lineno, self._n_lines + 1, ) + issue_type = PythonAstInspector.choose_issue_type(FUNC_LEN_ORIGIN_CLASS) + self._function_lens.append(FuncLenIssue( file_path=self._file_path, line_no=self._previous_node.lineno, @@ -91,7 +99,8 @@ def function_lens(self) -> List[FuncLenIssue]: origin_class=FUNC_LEN_ORIGIN_CLASS, inspector_type=self._inspector_type, func_len=func_length, - type=PythonAstInspector.choose_issue_type(FUNC_LEN_ORIGIN_CLASS), + type=issue_type, + difficulty=IssueDifficulty.get_by_issue_type(issue_type), )) self._previous_node = None diff --git a/src/python/review/inspectors/pylint/pylint.py b/src/python/review/inspectors/pylint/pylint.py index a8430d05..5467f998 100644 --- a/src/python/review/inspectors/pylint/pylint.py +++ b/src/python/review/inspectors/pylint/pylint.py @@ -6,7 +6,7 @@ from src.python.review.common.subprocess_runner import run_in_subprocess from src.python.review.inspectors.base_inspector import BaseInspector from src.python.review.inspectors.inspector_type import InspectorType -from src.python.review.inspectors.issue import CodeIssue, IssueType +from src.python.review.inspectors.issue import CodeIssue, IssueDifficulty, IssueType from src.python.review.inspectors.pylint.issue_types import CATEGORY_TO_ISSUE_TYPE, CODE_TO_ISSUE_TYPE from src.python.review.inspectors.tips import add_complexity_tip @@ -71,6 +71,7 @@ def parse(cls, output: str) -> List[CodeIssue]: description=description, inspector_type=cls.inspector_type, type=issue_type, + difficulty=IssueDifficulty.get_by_issue_type(issue_type), )) return issues diff --git a/src/python/review/inspectors/radon/radon.py b/src/python/review/inspectors/radon/radon.py index 4d7466fa..4499b890 100644 --- a/src/python/review/inspectors/radon/radon.py +++ b/src/python/review/inspectors/radon/radon.py @@ -6,7 +6,13 @@ from src.python.review.inspectors.base_inspector import BaseInspector from src.python.review.inspectors.common import convert_percentage_of_value_to_lack_of_value from src.python.review.inspectors.inspector_type import InspectorType -from src.python.review.inspectors.issue import BaseIssue, IssueData, IssueType, MaintainabilityLackIssue +from src.python.review.inspectors.issue import ( + BaseIssue, + IssueData, + IssueDifficulty, + IssueType, + MaintainabilityLackIssue, +) from src.python.review.inspectors.tips import get_maintainability_index_tip @@ -44,12 +50,15 @@ def mi_parse(cls, mi_output: str) -> List[BaseIssue]: file_path = Path(groups[0]) maintainability_lack = convert_percentage_of_value_to_lack_of_value(float(groups[1])) + issue_type = cls.choose_issue_type(MAINTAINABILITY_ORIGIN_CLASS) + issue_data = IssueData.get_base_issue_data_dict( file_path, cls.inspector_type, origin_class=MAINTAINABILITY_ORIGIN_CLASS, ) issue_data[IssueData.DESCRIPTION.value] = get_maintainability_index_tip() issue_data[IssueData.MAINTAINABILITY_LACK.value] = maintainability_lack - issue_data[IssueData.ISSUE_TYPE.value] = cls.choose_issue_type(MAINTAINABILITY_ORIGIN_CLASS) + issue_data[IssueData.ISSUE_TYPE.value] = issue_type + issue_data[IssueData.DIFFICULTY.value] = IssueDifficulty.get_by_issue_type(issue_type) issues.append(MaintainabilityLackIssue(**issue_data)) diff --git a/src/python/review/inspectors/spotbugs/spotbugs.py b/src/python/review/inspectors/spotbugs/spotbugs.py index c4580034..59f78750 100644 --- a/src/python/review/inspectors/spotbugs/spotbugs.py +++ b/src/python/review/inspectors/spotbugs/spotbugs.py @@ -9,7 +9,7 @@ from src.python.review.common.subprocess_runner import run_in_subprocess from src.python.review.inspectors.base_inspector import BaseInspector from src.python.review.inspectors.inspector_type import InspectorType -from src.python.review.inspectors.issue import BaseIssue, CodeIssue, IssueType +from src.python.review.inspectors.issue import BaseIssue, CodeIssue, IssueDifficulty, IssueType logger = logging.getLogger(__name__) @@ -101,4 +101,5 @@ def _parse_single_line(cls, line: str, file_name_to_path: Dict[str, Path]) -> Ba origin_class=issue_class, description=short_desc, inspector_type=cls.inspector_type, + difficulty=IssueDifficulty.get_by_issue_type(IssueType.ERROR_PRONE), ) diff --git a/src/python/review/inspectors/springlint/springlint.py b/src/python/review/inspectors/springlint/springlint.py index d6dd748b..636db248 100644 --- a/src/python/review/inspectors/springlint/springlint.py +++ b/src/python/review/inspectors/springlint/springlint.py @@ -18,6 +18,7 @@ CouplingIssue, InheritanceIssue, IssueData, + IssueDifficulty, IssueType, MethodNumberIssue, WeightedMethodIssue, @@ -136,6 +137,7 @@ def _parse_smells(cls, file_content: AnyStr, origin_path: str = '') -> List[Base inspector_type=cls.inspector_type, type=IssueType.ARCHITECTURE, description=smell['description'], + difficulty=IssueDifficulty.get_by_issue_type(IssueType.ARCHITECTURE), ) for smell in file_smell['smells']]) return issues @@ -165,10 +167,12 @@ def _parse_metrics(cls, file_content: AnyStr, origin_path: str = '') -> List[Bas def _create_issue(cls, metric_name: str, metric_value: int, path: Path) -> Optional[BaseIssue]: property_name = cls.metric_name_to_property[metric_name] + issue_type = cls.metric_name_to_issue_type[metric_name] issue_data = cls._get_common_issue_data(path) issue_data[property_name] = metric_value - issue_data['description'] = cls.metric_name_to_description[metric_name] - issue_data['type'] = cls.metric_name_to_issue_type[metric_name] + issue_data[IssueData.DESCRIPTION.value] = cls.metric_name_to_description[metric_name] + issue_data[IssueData.ISSUE_TYPE.value] = issue_type + issue_data[IssueData.DIFFICULTY.value] = IssueDifficulty.get_by_issue_type(issue_type) if metric_name == 'dit': return InheritanceIssue(**issue_data) diff --git a/src/python/review/reviewers/common.py b/src/python/review/reviewers/common.py index 22a56f48..cdd13cf9 100644 --- a/src/python/review/reviewers/common.py +++ b/src/python/review/reviewers/common.py @@ -18,7 +18,11 @@ from src.python.review.quality.penalty import categorize, get_previous_issues_by_language, Punisher from src.python.review.reviewers.review_result import FileReviewResult, GeneralReviewResult from src.python.review.reviewers.utils.code_statistics import gather_code_statistics -from src.python.review.reviewers.utils.issues_filter import filter_duplicate_issues, filter_low_measure_issues +from src.python.review.reviewers.utils.issues_filter import ( + filter_duplicate_issues, + filter_low_measure_issues, + group_issues_by_difficulty, +) from src.python.review.reviewers.utils.metadata_exploration import FileMetadata, Metadata LANGUAGE_TO_INSPECTORS = { @@ -66,23 +70,53 @@ def perform_language_review(metadata: Metadata, config: ApplicationConfig, langu previous_issues = get_previous_issues_by_language(config.history, language) categorize(previous_issues, issues) - general_punisher = Punisher(issues, previous_issues) - general_quality = Quality([]) + issues_by_difficulty = group_issues_by_difficulty(issues) + + general_punisher_by_difficulty = { + difficulty: Punisher(issues, previous_issues) for difficulty, issues in issues_by_difficulty.items() + } + + general_quality_by_difficulty = { + difficulty: Quality([]) for difficulty in issues_by_difficulty.keys() + } file_review_results = [] for file_metadata in files_metadata: file_issues = file_path_to_issues[file_metadata.path] - code_statistics = gather_code_statistics(file_issues, file_metadata.path) - code_statistics.total_lines = min(code_statistics.total_lines, - get_range_lines(config.start_line, config.end_line)) - - punisher = Punisher(file_issues, previous_issues) - quality = evaluate_quality(code_statistics, language) - general_quality = general_quality.merge(quality) - - file_review_results.append(FileReviewResult(quality, punisher, file_issues, file_metadata.path)) - - return GeneralReviewResult(general_quality, general_punisher, issues, file_review_results) + file_issues_by_difficulty = group_issues_by_difficulty(file_issues) + + code_statistics_by_difficulty = { + difficulty: gather_code_statistics(file_issues, file_metadata.path) + for difficulty, file_issues in file_issues_by_difficulty.items() + } + + for code_statistics in code_statistics_by_difficulty.values(): + code_statistics.total_lines = min(code_statistics.total_lines, + get_range_lines(config.start_line, config.end_line)) + + punisher_by_difficulty = { + difficulty: Punisher(file_issues, previous_issues) + for difficulty, file_issues in file_issues_by_difficulty.items() + } + + quality_by_difficulty = { + difficulty: evaluate_quality(code_statistics, language) + for difficulty, code_statistics in code_statistics_by_difficulty.items() + } + + for difficulty, quality in quality_by_difficulty.items(): + general_quality_by_difficulty[difficulty] = general_quality_by_difficulty[difficulty].merge(quality) + + file_review_results.append( + FileReviewResult(quality_by_difficulty, punisher_by_difficulty, file_issues, file_metadata.path), + ) + + return GeneralReviewResult( + general_quality_by_difficulty, + general_punisher_by_difficulty, + issues, + file_review_results, + ) def filter_out_of_range_issues(issues: List[BaseIssue], diff --git a/src/python/review/reviewers/review_result.py b/src/python/review/reviewers/review_result.py index 93a6e9e4..88854d3f 100644 --- a/src/python/review/reviewers/review_result.py +++ b/src/python/review/reviewers/review_result.py @@ -1,8 +1,8 @@ from dataclasses import dataclass from pathlib import Path -from typing import List +from typing import Dict, List -from src.python.review.inspectors.issue import BaseIssue +from src.python.review.inspectors.issue import BaseIssue, IssueDifficulty from src.python.review.quality.model import Quality from src.python.review.quality.penalty import Punisher @@ -12,8 +12,8 @@ class ReviewResult: """ ReviewResult contains a list of issues, as well as quality and punisher obtained with these issues. """ - quality: Quality - punisher: Punisher + quality_by_difficulty: Dict[IssueDifficulty, Quality] + punisher_by_difficulty: Dict[IssueDifficulty, Punisher] issues: List[BaseIssue] diff --git a/src/python/review/reviewers/utils/issues_filter.py b/src/python/review/reviewers/utils/issues_filter.py index b6e5529e..dfec89ff 100644 --- a/src/python/review/reviewers/utils/issues_filter.py +++ b/src/python/review/reviewers/utils/issues_filter.py @@ -2,7 +2,7 @@ from typing import Dict, List, Tuple from src.python.review.common.language import Language -from src.python.review.inspectors.issue import BaseIssue, IssueType, Measurable +from src.python.review.inspectors.issue import BaseIssue, IssueDifficulty, IssueType, Measurable from src.python.review.quality.rules.boolean_length_scoring import LANGUAGE_TO_BOOLEAN_EXPRESSION_RULE_CONFIG from src.python.review.quality.rules.class_response_scoring import LANGUAGE_TO_RESPONSE_RULE_CONFIG from src.python.review.quality.rules.cohesion_scoring import LANGUAGE_TO_COHESION_RULE_CONFIG @@ -130,3 +130,11 @@ def group_issues(issues: List[BaseIssue]) -> GroupedIssues: grouped_issues[file_path][line_no][inspector_name][issue_type].append(issue) return grouped_issues + + +def group_issues_by_difficulty(issues: List[BaseIssue]) -> Dict[IssueDifficulty, List[BaseIssue]]: + return { + IssueDifficulty.EASY: [issue for issue in issues if issue.difficulty == IssueDifficulty.EASY], + IssueDifficulty.MEDIUM: [issue for issue in issues if issue.difficulty != IssueDifficulty.HARD], + IssueDifficulty.HARD: issues, + } diff --git a/src/python/review/reviewers/utils/print_review.py b/src/python/review/reviewers/utils/print_review.py index 66f1a67f..f7aa62eb 100644 --- a/src/python/review/reviewers/utils/print_review.py +++ b/src/python/review/reviewers/utils/print_review.py @@ -2,13 +2,13 @@ import linecache from enum import Enum, unique from pathlib import Path -from typing import Any, Dict, List +from typing import Any, Dict, List, Union from src.python.evaluation.inspectors.common.statistics import PenaltyIssue from src.python.review.application_config import ApplicationConfig from src.python.review.common.file_system import get_file_line from src.python.review.inspectors.inspector_type import InspectorType -from src.python.review.inspectors.issue import BaseIssue, IssueType +from src.python.review.inspectors.issue import BaseIssue, IssueDifficulty, IssueType from src.python.review.quality.model import QualityType from src.python.review.reviewers.review_result import FileReviewResult, GeneralReviewResult, ReviewResult @@ -46,37 +46,60 @@ def print_review_result_as_text(review_result: GeneralReviewResult, path: Path, f'{line_text}: ' f'{issue.file_path}') print('-' * len(heading)) - print(file_review_result.quality) + print(file_review_result.quality_by_difficulty[IssueDifficulty.HARD]) print('*' * len(heading)) print('General quality:') - print(review_result.quality, end='') + print(review_result.quality_by_difficulty[IssueDifficulty.HARD], end='') -def _get_quality_without_penalty(review_result: ReviewResult) -> QualityType: - return review_result.quality.quality_type +def _get_quality_without_penalty(review_result: ReviewResult) -> Dict[IssueDifficulty, QualityType]: + return {difficulty: quality.quality_type for difficulty, quality in review_result.quality_by_difficulty.items()} -def _get_quality_with_penalty(review_result: ReviewResult) -> QualityType: +def _get_quality_with_penalty(review_result: ReviewResult) -> Dict[IssueDifficulty, QualityType]: quality_without_penalty = _get_quality_without_penalty(review_result) - return review_result.punisher.get_quality_with_penalty(quality_without_penalty) - -def get_quality_json_dict(quality: QualityType) -> Dict: return { - OutputJsonFields.CODE.value: quality.value, - OutputJsonFields.TEXT.value: f'Code quality (beta): {quality.value}', + difficulty: punisher.get_quality_with_penalty(quality_without_penalty[difficulty]) + for difficulty, punisher in review_result.punisher_by_difficulty.items() + } + + +def get_quality_json_dict(quality: Dict[IssueDifficulty, QualityType], config: ApplicationConfig) -> Dict: + quality_json_dict = { + difficulty.value: { + OutputJsonFields.CODE.value: quality.value, + OutputJsonFields.TEXT.value: f'Code quality (beta): {quality.value}', + } + for difficulty, quality in quality.items() } + if config.group_by_difficulty: + return quality_json_dict -def get_influence_on_penalty_json_dict(origin_class: str, review_result: ReviewResult) -> int: + return quality_json_dict[IssueDifficulty.HARD.value] + + +def get_influence_on_penalty_json_dict( + origin_class: str, + review_result: ReviewResult, + config: ApplicationConfig, +) -> Union[Dict[IssueDifficulty, int], int]: quality_without_penalty = _get_quality_without_penalty(review_result) quality_with_penalty = _get_quality_with_penalty(review_result) - if quality_with_penalty != quality_without_penalty: - return review_result.punisher.get_issue_influence_on_penalty(origin_class) + influence_on_penalty_json_dict = { + difficulty.value: punisher.get_issue_influence_on_penalty(origin_class) + if quality_with_penalty[difficulty] != quality_without_penalty[difficulty] + else 0 + for difficulty, punisher in review_result.punisher_by_difficulty.items() + } + + if config.group_by_difficulty: + return influence_on_penalty_json_dict - return 0 + return influence_on_penalty_json_dict[IssueDifficulty.HARD.value] def convert_review_result_to_json_dict(review_result: ReviewResult, config: ApplicationConfig) -> Dict: @@ -90,14 +113,16 @@ def convert_review_result_to_json_dict(review_result: ReviewResult, config: Appl if isinstance(review_result, FileReviewResult): output_json[OutputJsonFields.FILE_NAME.value] = str(review_result.file_path) - output_json[OutputJsonFields.QUALITY.value] = get_quality_json_dict(quality_with_penalty) + output_json[OutputJsonFields.QUALITY.value] = get_quality_json_dict(quality_with_penalty, config) output_json[OutputJsonFields.ISSUES.value] = [] for issue in issues: json_issue = convert_issue_to_json(issue, config) json_issue[OutputJsonFields.INFLUENCE_ON_PENALTY.value] = get_influence_on_penalty_json_dict( - issue.origin_class, review_result, + issue.origin_class, + review_result, + config, ) output_json[OutputJsonFields.ISSUES.value].append(json_issue) @@ -119,7 +144,7 @@ def print_review_result_as_multi_file_json(review_result: GeneralReviewResult, c quality_with_penalty = _get_quality_with_penalty(review_result) output_json = { - OutputJsonFields.QUALITY.value: get_quality_json_dict(quality_with_penalty), + OutputJsonFields.QUALITY.value: get_quality_json_dict(quality_with_penalty, config), OutputJsonFields.FILE_REVIEW_RESULTS.value: file_review_result_jsons, } @@ -140,6 +165,7 @@ class OutputJsonFields(Enum): COLUMN_NUMBER = 'column_number' CATEGORY = 'category' INFLUENCE_ON_PENALTY = 'influence_on_penalty' + DIFFICULTY = 'difficulty' def convert_issue_to_json(issue: BaseIssue, config: ApplicationConfig) -> Dict[str, Any]: @@ -156,6 +182,7 @@ def convert_issue_to_json(issue: BaseIssue, config: ApplicationConfig) -> Dict[s OutputJsonFields.LINE_NUMBER.value: issue.line_no, OutputJsonFields.COLUMN_NUMBER.value: issue.column_no, OutputJsonFields.CATEGORY.value: issue_type.value, + OutputJsonFields.DIFFICULTY.value: issue.difficulty.value, } @@ -174,6 +201,7 @@ def convert_json_to_issues(issues_json: List[dict]) -> List[PenaltyIssue]: file_path=Path(), inspector_type=InspectorType.UNDEFINED, influence_on_penalty=issue.get(OutputJsonFields.INFLUENCE_ON_PENALTY.value, 0), + difficulty=IssueDifficulty(issue.get(OutputJsonFields.DIFFICULTY.value, IssueDifficulty.HARD.value)), ), ) return issues diff --git a/src/python/review/run_tool.py b/src/python/review/run_tool.py index 0230b05d..dee61be5 100644 --- a/src/python/review/run_tool.py +++ b/src/python/review/run_tool.py @@ -110,6 +110,10 @@ def configure_arguments(parser: argparse.ArgumentParser) -> None: help=RunToolArgument.WITH_ALL_CATEGORIES.value.description, action='store_true') + parser.add_argument(RunToolArgument.GROUP_BY_DIFFICULTY.value.long_name, + help=RunToolArgument.GROUP_BY_DIFFICULTY.value.description, + action='store_true') + def configure_logging(verbosity: VerbosityLevel) -> None: if verbosity is VerbosityLevel.ERROR: @@ -155,6 +159,7 @@ def main() -> int: new_format=args.new_format, history=args.history, with_all_categories=args.with_all_categories, + group_by_difficulty=args.group_by_difficulty, ) n_issues = perform_and_print_review(args.path, OutputFormat(args.format), config) diff --git a/test/python/evaluation/inspectors/diffs_between_df/test_diifs_between_df.py b/test/python/evaluation/inspectors/diffs_between_df/test_diifs_between_df.py index b794b0a4..72571842 100644 --- a/test/python/evaluation/inspectors/diffs_between_df/test_diifs_between_df.py +++ b/test/python/evaluation/inspectors/diffs_between_df/test_diifs_between_df.py @@ -7,7 +7,7 @@ from src.python.evaluation.inspectors.common.statistics import PenaltyIssue from src.python.evaluation.inspectors.diffs_between_df import find_diffs from src.python.review.inspectors.inspector_type import InspectorType -from src.python.review.inspectors.issue import IssueType +from src.python.review.inspectors.issue import IssueDifficulty, IssueType RESOURCES_PATH = INSPECTORS_DIR_PATH / 'diffs_between_df' @@ -38,6 +38,7 @@ file_path=Path(), inspector_type=InspectorType.UNDEFINED, influence_on_penalty=0, + difficulty=IssueDifficulty.EASY, ), PenaltyIssue( origin_class='E211', description='whitespace before \'(\'', @@ -48,6 +49,7 @@ file_path=Path(), inspector_type=InspectorType.UNDEFINED, influence_on_penalty=0, + difficulty=IssueDifficulty.EASY, ), } diff --git a/test/python/evaluation/issues_statistics/test_get_raw_issues.py b/test/python/evaluation/issues_statistics/test_get_raw_issues.py index ba9a8610..976701ba 100644 --- a/test/python/evaluation/issues_statistics/test_get_raw_issues.py +++ b/test/python/evaluation/issues_statistics/test_get_raw_issues.py @@ -10,7 +10,14 @@ from src.python.evaluation.common.pandas_util import get_solutions_df_by_file_path from src.python.evaluation.issues_statistics.get_raw_issues import _filter_issues, _get_output_path, inspect_solutions from src.python.review.inspectors.inspector_type import InspectorType -from src.python.review.inspectors.issue import BaseIssue, CodeIssue, IssueType, LineLenIssue, MaintainabilityLackIssue +from src.python.review.inspectors.issue import ( + BaseIssue, + CodeIssue, + IssueDifficulty, + IssueType, + LineLenIssue, + MaintainabilityLackIssue, +) ORIGINAL_DF_NAME = 'original_df' ORIGINAL_DF_CSV = f'{ORIGINAL_DF_NAME}.csv' @@ -52,6 +59,7 @@ def test_get_output_path(solutions_file_path: Path, output_path: Optional[Path], line_no=112, column_no=13, inspector_type=InspectorType.CHECKSTYLE, + difficulty=IssueDifficulty.HARD, ), CodeIssue( origin_class="SwitchStmtsShouldHaveDefault", @@ -61,6 +69,7 @@ def test_get_output_path(solutions_file_path: Path, output_path: Optional[Path], line_no=112, column_no=1, inspector_type=InspectorType.PMD, + difficulty=IssueDifficulty.HARD, ), CodeIssue( origin_class="MagicNumberCheck", @@ -70,6 +79,7 @@ def test_get_output_path(solutions_file_path: Path, output_path: Optional[Path], line_no=303, column_no=25, inspector_type=InspectorType.CHECKSTYLE, + difficulty=IssueDifficulty.EASY, ), MaintainabilityLackIssue( origin_class="SomeMaintainabilityCheck", @@ -80,16 +90,18 @@ def test_get_output_path(solutions_file_path: Path, output_path: Optional[Path], column_no=50, inspector_type=InspectorType.CHECKSTYLE, maintainability_lack=0, + difficulty=IssueDifficulty.HARD, ), LineLenIssue( origin_class="SomeLineLenCheck", - type=IssueType.MAINTAINABILITY, + type=IssueType.LINE_LEN, description="Some description", file_path=Path(""), line_no=139, column_no=24, inspector_type=InspectorType.CHECKSTYLE, line_len=10, + difficulty=IssueDifficulty.EASY, ), ] @@ -102,6 +114,7 @@ def test_get_output_path(solutions_file_path: Path, output_path: Optional[Path], line_no=112, column_no=13, inspector_type=InspectorType.CHECKSTYLE, + difficulty=IssueDifficulty.HARD, ), CodeIssue( origin_class="MagicNumberCheck", @@ -111,6 +124,7 @@ def test_get_output_path(solutions_file_path: Path, output_path: Optional[Path], line_no=303, column_no=25, inspector_type=InspectorType.CHECKSTYLE, + difficulty=IssueDifficulty.EASY, ), MaintainabilityLackIssue( origin_class="SomeMaintainabilityCheck", @@ -121,16 +135,18 @@ def test_get_output_path(solutions_file_path: Path, output_path: Optional[Path], column_no=50, inspector_type=InspectorType.CHECKSTYLE, maintainability_lack=0, + difficulty=IssueDifficulty.HARD, ), LineLenIssue( origin_class="SomeLineLenCheck", - type=IssueType.MAINTAINABILITY, + type=IssueType.LINE_LEN, description="Some description", file_path=Path(""), line_no=139, column_no=24, inspector_type=InspectorType.CHECKSTYLE, line_len=10, + difficulty=IssueDifficulty.EASY, ), ] @@ -143,6 +159,7 @@ def test_get_output_path(solutions_file_path: Path, output_path: Optional[Path], line_no=112, column_no=13, inspector_type=InspectorType.CHECKSTYLE, + difficulty=IssueDifficulty.HARD, ), CodeIssue( origin_class="SwitchStmtsShouldHaveDefault", @@ -152,6 +169,7 @@ def test_get_output_path(solutions_file_path: Path, output_path: Optional[Path], line_no=112, column_no=1, inspector_type=InspectorType.PMD, + difficulty=IssueDifficulty.HARD, ), CodeIssue( origin_class="MagicNumberCheck", @@ -161,16 +179,18 @@ def test_get_output_path(solutions_file_path: Path, output_path: Optional[Path], line_no=303, column_no=25, inspector_type=InspectorType.CHECKSTYLE, + difficulty=IssueDifficulty.EASY, ), LineLenIssue( origin_class="SomeLineLenCheck", - type=IssueType.MAINTAINABILITY, + type=IssueType.LINE_LEN, description="Some description", file_path=Path(""), line_no=139, column_no=24, inspector_type=InspectorType.CHECKSTYLE, line_len=10, + difficulty=IssueDifficulty.EASY, ), ] @@ -183,6 +203,7 @@ def test_get_output_path(solutions_file_path: Path, output_path: Optional[Path], line_no=112, column_no=13, inspector_type=InspectorType.CHECKSTYLE, + difficulty=IssueDifficulty.HARD, ), CodeIssue( origin_class="SwitchStmtsShouldHaveDefault", @@ -192,6 +213,7 @@ def test_get_output_path(solutions_file_path: Path, output_path: Optional[Path], line_no=112, column_no=1, inspector_type=InspectorType.PMD, + difficulty=IssueDifficulty.HARD, ), MaintainabilityLackIssue( origin_class="SomeMaintainabilityCheck", @@ -202,16 +224,18 @@ def test_get_output_path(solutions_file_path: Path, output_path: Optional[Path], column_no=50, inspector_type=InspectorType.CHECKSTYLE, maintainability_lack=0, + difficulty=IssueDifficulty.HARD, ), LineLenIssue( origin_class="SomeLineLenCheck", - type=IssueType.MAINTAINABILITY, + type=IssueType.LINE_LEN, description="Some description", file_path=Path(""), line_no=139, column_no=24, inspector_type=InspectorType.CHECKSTYLE, line_len=10, + difficulty=IssueDifficulty.EASY, ), ] @@ -224,16 +248,18 @@ def test_get_output_path(solutions_file_path: Path, output_path: Optional[Path], line_no=112, column_no=13, inspector_type=InspectorType.CHECKSTYLE, + difficulty=IssueDifficulty.HARD, ), LineLenIssue( origin_class="SomeLineLenCheck", - type=IssueType.MAINTAINABILITY, + type=IssueType.LINE_LEN, description="Some description", file_path=Path(""), line_no=139, column_no=24, inspector_type=InspectorType.CHECKSTYLE, line_len=10, + difficulty=IssueDifficulty.EASY, ), ] diff --git a/test/python/evaluation/issues_statistics/test_raw_issue_encoding_decoding.py b/test/python/evaluation/issues_statistics/test_raw_issue_encoding_decoding.py index 43c20e08..79abcbba 100644 --- a/test/python/evaluation/issues_statistics/test_raw_issue_encoding_decoding.py +++ b/test/python/evaluation/issues_statistics/test_raw_issue_encoding_decoding.py @@ -12,6 +12,7 @@ CohesionIssue, CyclomaticComplexityIssue, FuncLenIssue, + IssueDifficulty, IssueType, LineLenIssue, MaintainabilityLackIssue, @@ -30,6 +31,7 @@ line_no=656, column_no=42, inspector_type=InspectorType.CHECKSTYLE, + difficulty=IssueDifficulty.EASY, ), f""" {{ @@ -39,7 +41,8 @@ "file_path": "{FILE_PATH}", "line_no": 656, "column_no": 42, - "inspector_type": "CHECKSTYLE" + "inspector_type": "CHECKSTYLE", + "difficulty": "EASY" }} """, ), @@ -53,6 +56,7 @@ column_no=428, inspector_type=InspectorType.DETEKT, bool_expr_len=975, + difficulty=IssueDifficulty.EASY, ), f""" {{ @@ -63,6 +67,7 @@ "line_no": 983, "column_no": 428, "inspector_type": "DETEKT", + "difficulty": "EASY", "measure": 975 }} """, @@ -77,6 +82,7 @@ column_no=487, inspector_type=InspectorType.ESLINT, func_len=909, + difficulty=IssueDifficulty.EASY, ), f""" {{ @@ -87,6 +93,7 @@ "line_no": 790, "column_no": 487, "inspector_type": "ESLINT", + "difficulty": "EASY", "measure": 909 }} """, @@ -101,6 +108,7 @@ column_no=383, inspector_type=InspectorType.PMD, line_len=383, + difficulty=IssueDifficulty.EASY, ), f""" {{ @@ -111,6 +119,7 @@ "line_no": 154, "column_no": 383, "inspector_type": "PMD", + "difficulty": "EASY", "measure": 383 }} """, @@ -125,6 +134,7 @@ column_no=78, inspector_type=InspectorType.INTELLIJ, cc_value=229, + difficulty=IssueDifficulty.HARD, ), f""" {{ @@ -135,6 +145,7 @@ "line_no": 670, "column_no": 78, "inspector_type": "INTELLIJ", + "difficulty": "HARD", "measure": 229 }} """, @@ -149,6 +160,7 @@ column_no=386, inspector_type=InspectorType.PYLINT, cohesion_lack=564, + difficulty=IssueDifficulty.HARD, ), f""" {{ @@ -159,6 +171,7 @@ "line_no": 997, "column_no": 386, "inspector_type": "PYLINT", + "difficulty": "HARD", "measure": 564 }} """, @@ -173,6 +186,7 @@ column_no=542, inspector_type=InspectorType.RADON, maintainability_lack=431, + difficulty=IssueDifficulty.HARD, ), f""" {{ @@ -183,6 +197,7 @@ "line_no": 830, "column_no": 542, "inspector_type": "RADON", + "difficulty": "HARD", "measure": 431 }} """, diff --git a/test/python/functional_tests/conftest.py b/test/python/functional_tests/conftest.py index da01adde..64b9b049 100644 --- a/test/python/functional_tests/conftest.py +++ b/test/python/functional_tests/conftest.py @@ -5,6 +5,7 @@ import pytest from src.python import MAIN_FOLDER +from src.python.common.tool_arguments import RunToolArgument DATA_PATH = TEST_DATA_FOLDER / 'functional_tests' @@ -22,34 +23,46 @@ class LocalCommandBuilder: start_line: Optional[int] = None end_line: Optional[int] = None new_format: bool = False + group_by_difficulty: bool = False + history: Optional[str] = None def build(self) -> List[str]: assert self.path is not None - command = ['python3', (MAIN_FOLDER.parent / 'review/run_tool.py'), f'-v{self.verbosity}'] + command = [ + 'python3', (MAIN_FOLDER.parent / 'review/run_tool.py'), + RunToolArgument.VERBOSITY.value.long_name, str(self.verbosity), + ] + if self.disable: - command.extend(['-d', ','.join(self.disable)]) + command.extend([RunToolArgument.DISABLE.value.long_name, ','.join(self.disable)]) if self.allow_duplicates: - command.append('--allow-duplicates') + command.append(RunToolArgument.DUPLICATES.value.long_name) if self.language_version is not None: - command.extend(['--language-version', self.language_version]) + command.extend([RunToolArgument.LANG_VERSION.value.long_name, self.language_version]) if self.new_format: - command.append('--new-format') + command.append(RunToolArgument.NEW_FORMAT.value.long_name) + + if self.history is not None: + command.extend([RunToolArgument.HISTORY.value.long_name, self.history]) + + if self.group_by_difficulty: + command.append(RunToolArgument.GROUP_BY_DIFFICULTY.value.long_name) command.extend([ - '--n_cpu', str(self.n_cpu), - '-f', self.format, + RunToolArgument.CPU.value.long_name, str(self.n_cpu), + RunToolArgument.FORMAT.value.long_name, self.format, str(self.path), ]) if self.start_line is not None: - command.extend(['-s', str(self.start_line)]) + command.extend([RunToolArgument.START_LINE.value.long_name, str(self.start_line)]) if self.end_line is not None: - command.extend(['-e', str(self.end_line)]) + command.extend([RunToolArgument.END_LINE.value.long_name, str(self.end_line)]) return command diff --git a/test/python/functional_tests/test_difficulty_levels.py b/test/python/functional_tests/test_difficulty_levels.py new file mode 100644 index 00000000..4c6e37b6 --- /dev/null +++ b/test/python/functional_tests/test_difficulty_levels.py @@ -0,0 +1,461 @@ +import json +import subprocess +from test.python.functional_tests.conftest import DATA_PATH, LocalCommandBuilder +from typing import Dict, Optional + +import pytest + + +def _get_output_json(local_command: LocalCommandBuilder, file_path: str, history: Optional[str] = None) -> Dict: + file_path = DATA_PATH / 'difficulty_levels' / file_path + + local_command.verbosity = 0 + local_command.format = 'json' + local_command.path = file_path + local_command.new_format = False + local_command.group_by_difficulty = True + local_command.history = history + + process = subprocess.run( + local_command.build(), + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + ) + + return json.loads(process.stdout.decode()) + + +WITHOUT_ISSUES = { + 'quality': { + 'EASY': {'code': 'EXCELLENT', 'text': 'Code quality (beta): EXCELLENT'}, + 'MEDIUM': {'code': 'EXCELLENT', 'text': 'Code quality (beta): EXCELLENT'}, + 'HARD': {'code': 'EXCELLENT', 'text': 'Code quality (beta): EXCELLENT'}, + }, + 'issues': [], +} + +HARD_ISSUES = { + 'quality': { + 'EASY': {'code': 'EXCELLENT', 'text': 'Code quality (beta): EXCELLENT'}, + 'MEDIUM': {'code': 'EXCELLENT', 'text': 'Code quality (beta): EXCELLENT'}, + 'HARD': {'code': 'MODERATE', 'text': 'Code quality (beta): MODERATE'}, + }, + 'issues': [ + { + 'category': 'COMPLEXITY', + 'code': 'H601', + 'column_number': 1, + 'difficulty': 'HARD', + 'influence_on_penalty': {'EASY': 0, 'HARD': 0, 'MEDIUM': 0}, + 'line': 'class BadClass:', + 'line_number': 4, + 'text': 'class has low (50.00%) cohesion', + }, + ], +} + +MEDIUM_ISSUES = { + 'quality': { + 'EASY': {'code': 'EXCELLENT', 'text': 'Code quality (beta): EXCELLENT'}, + 'HARD': {'code': 'MODERATE', 'text': 'Code quality (beta): MODERATE'}, + 'MEDIUM': {'code': 'MODERATE', 'text': 'Code quality (beta): MODERATE'}, + }, + 'issues': [ + { + 'category': 'BEST_PRACTICES', + 'code': 'WPS407', + 'column_number': 1, + 'difficulty': 'MEDIUM', + 'influence_on_penalty': {'EASY': 0, 'HARD': 0, 'MEDIUM': 0}, + 'line': 'MUTABLE_CONSTANT = {"1": 1, "2": 2}', + 'line_number': 1, + 'text': 'Found mutable module constant', + }, + { + 'category': 'BEST_PRACTICES', + 'code': 'WPS446', + 'column_number': 6, + 'difficulty': 'MEDIUM', + 'influence_on_penalty': {'EASY': 0, 'HARD': 0, 'MEDIUM': 0}, + 'line': 'PI = 3.14', + 'line_number': 3, + 'text': 'Found approximate constant: 3.14', + }, + { + 'category': 'BEST_PRACTICES', + 'code': 'WPS446', + 'column_number': 13, + 'difficulty': 'MEDIUM', + 'influence_on_penalty': {'EASY': 0, 'HARD': 0, 'MEDIUM': 0}, + 'line': 'DOUBLE_PI = 6.28', + 'line_number': 4, + 'text': 'Found approximate constant: 6.28', + }, + { + 'category': 'BEST_PRACTICES', + 'code': 'WPS446', + 'column_number': 5, + 'difficulty': 'MEDIUM', + 'influence_on_penalty': {'EASY': 0, 'HARD': 0, 'MEDIUM': 0}, + 'line': 'E = 2.71', + 'line_number': 5, + 'text': 'Found approximate constant: 2.71', + }, + { + 'category': 'BEST_PRACTICES', + 'code': 'W0703', + 'column_number': 12, + 'difficulty': 'MEDIUM', + 'influence_on_penalty': {'EASY': 0, 'HARD': 0, 'MEDIUM': 0}, + 'line': 'except Exception:', + 'line_number': 13, + 'text': 'Catching too general exception Exception', + }, + { + 'category': 'BEST_PRACTICES', + 'code': 'R504', + 'column_number': 12, + 'difficulty': 'MEDIUM', + 'influence_on_penalty': {'EASY': 0, 'HARD': 0, 'MEDIUM': 0}, + 'line': 'return result', + 'line_number': 16, + 'text': 'you shouldn`t assign value to variable if it will be use ' 'only as return value', + }, + { + 'category': 'BEST_PRACTICES', + 'code': 'R1708', + 'column_number': 9, + 'difficulty': 'MEDIUM', + 'influence_on_penalty': {'EASY': 0, 'HARD': 0, 'MEDIUM': 0}, + 'line': 'raise StopIteration', + 'line_number': 21, + 'text': 'Do not raise StopIteration in generator, use return ' 'statement instead', + }, + ], +} + +EASY_ISSUES = { + 'quality': { + 'EASY': {'code': 'MODERATE', 'text': 'Code quality (beta): MODERATE'}, + 'MEDIUM': {'code': 'MODERATE', 'text': 'Code quality (beta): MODERATE'}, + 'HARD': {'code': 'MODERATE', 'text': 'Code quality (beta): MODERATE'}, + }, + 'issues': [ + { + 'category': 'CODE_STYLE', + 'code': 'N802', + 'column_number': 6, + 'difficulty': 'EASY', + 'influence_on_penalty': {'EASY': 0, 'HARD': 0, 'MEDIUM': 0}, + 'line': 'def MAIN(Number):', + 'line_number': 1, + 'text': "function name 'MAIN' should be lowercase", + }, + { + 'category': 'CODE_STYLE', + 'code': 'N803', + 'column_number': 11, + 'difficulty': 'EASY', + 'influence_on_penalty': {'EASY': 0, 'HARD': 0, 'MEDIUM': 0}, + 'line': 'def MAIN(Number):', + 'line_number': 1, + 'text': "argument name 'Number' should be lowercase", + }, + { + 'category': 'CODE_STYLE', + 'code': 'E121', + 'column_number': 7, + 'difficulty': 'EASY', + 'influence_on_penalty': {'EASY': 0, 'HARD': 0, 'MEDIUM': 0}, + 'line': '"Hello, World")', + 'line_number': 10, + 'text': 'continuation line under-indented for hanging indent', + }, + { + 'category': 'CODE_STYLE', + 'code': 'WPS319', + 'column_number': 21, + 'difficulty': 'EASY', + 'influence_on_penalty': {'EASY': 0, 'HARD': 0, 'MEDIUM': 0}, + 'line': '"Hello, World")', + 'line_number': 10, + 'text': 'Found bracket in wrong position', + }, + ], +} + + +ALL_DIFFICULTY_LEVEL_ISSUES = { + 'quality': { + 'EASY': {'code': 'GOOD', 'text': 'Code quality (beta): GOOD'}, + 'MEDIUM': {'code': 'GOOD', 'text': 'Code quality (beta): GOOD'}, + 'HARD': {'code': 'MODERATE', 'text': 'Code quality (beta): MODERATE'}, + }, + 'issues': [ + { + 'category': 'BEST_PRACTICES', + 'code': 'WPS407', + 'column_number': 1, + 'difficulty': 'MEDIUM', + 'influence_on_penalty': {'EASY': 0, 'HARD': 0, 'MEDIUM': 0}, + 'line': 'MUTABLE_CONSTANT = {"1": 1, "2": 2}', + 'line_number': 3, + 'text': 'Found mutable module constant', + }, + { + 'category': 'COMPLEXITY', + 'code': 'H601', + 'column_number': 1, + 'difficulty': 'HARD', + 'influence_on_penalty': {'EASY': 0, 'HARD': 0, 'MEDIUM': 0}, + 'line': 'class BadClass:', + 'line_number': 5, + 'text': 'class has low (50.00%) cohesion', + }, + { + 'category': 'CODE_STYLE', + 'code': 'N802', + 'column_number': 10, + 'difficulty': 'EASY', + 'influence_on_penalty': {'EASY': 0, 'HARD': 0, 'MEDIUM': 0}, + 'line': 'def Length(x: int, y: int) -> float:', + 'line_number': 11, + 'text': "function name 'Length' should be lowercase", + }, + ], +} + + +DIFFICULTY_LEVELS_TEST_DATA = [ + ('file_without_issues.py', WITHOUT_ISSUES), + ('file_with_only_hard_issues.py', HARD_ISSUES), + ('file_with_only_medium_issues.py', MEDIUM_ISSUES), + ('file_with_only_easy_issues.py', EASY_ISSUES), + ('file_with_all_difficulty_levels.py', ALL_DIFFICULTY_LEVEL_ISSUES), +] + + +@pytest.mark.parametrize(('file', 'expected_json'), DIFFICULTY_LEVELS_TEST_DATA) +def test_difficulty_levels(local_command: LocalCommandBuilder, file: str, expected_json: Dict): + assert _get_output_json(local_command, file) == expected_json + + +HISTORY = { + 'python': [ + { + 'origin_class': 'N802', + 'number': 5, + }, + { + 'origin_class': 'WPS407', + 'number': 10, + }, + { + 'origin_class': 'H601', + 'number': 5, + }, + ], +} + +HARD_ISSUES_WITH_INFLUENCE = { + 'quality': { + 'EASY': {'code': 'EXCELLENT', 'text': 'Code quality (beta): EXCELLENT'}, + 'MEDIUM': {'code': 'EXCELLENT', 'text': 'Code quality (beta): EXCELLENT'}, + 'HARD': {'code': 'BAD', 'text': 'Code quality (beta): BAD'}, + }, + 'issues': [ + { + 'category': 'COMPLEXITY', + 'code': 'H601', + 'column_number': 1, + 'difficulty': 'HARD', + 'influence_on_penalty': {'EASY': 0, 'MEDIUM': 0, 'HARD': 100}, + 'line': 'class BadClass:', + 'line_number': 4, + 'text': 'class has low (50.00%) cohesion', + }, + ], +} + +MEDIUM_ISSUES_WITH_INFLUENCE = { + 'quality': { + 'EASY': {'code': 'EXCELLENT', 'text': 'Code quality (beta): EXCELLENT'}, + 'MEDIUM': {'code': 'BAD', 'text': 'Code quality (beta): BAD'}, + 'HARD': {'code': 'BAD', 'text': 'Code quality (beta): BAD'}, + }, + 'issues': [ + { + 'category': 'BEST_PRACTICES', + 'code': 'WPS407', + 'column_number': 1, + 'difficulty': 'MEDIUM', + 'influence_on_penalty': {'EASY': 0, 'MEDIUM': 100, 'HARD': 100}, + 'line': 'MUTABLE_CONSTANT = {"1": 1, "2": 2}', + 'line_number': 1, + 'text': 'Found mutable module constant', + }, + { + 'category': 'BEST_PRACTICES', + 'code': 'WPS446', + 'column_number': 6, + 'difficulty': 'MEDIUM', + 'influence_on_penalty': {'EASY': 0, 'MEDIUM': 0, 'HARD': 0}, + 'line': 'PI = 3.14', + 'line_number': 3, + 'text': 'Found approximate constant: 3.14', + }, + { + 'category': 'BEST_PRACTICES', + 'code': 'WPS446', + 'column_number': 13, + 'difficulty': 'MEDIUM', + 'influence_on_penalty': {'EASY': 0, 'MEDIUM': 0, 'HARD': 0}, + 'line': 'DOUBLE_PI = 6.28', + 'line_number': 4, + 'text': 'Found approximate constant: 6.28', + }, + { + 'category': 'BEST_PRACTICES', + 'code': 'WPS446', + 'column_number': 5, + 'difficulty': 'MEDIUM', + 'influence_on_penalty': {'EASY': 0, 'MEDIUM': 0, 'HARD': 0}, + 'line': 'E = 2.71', + 'line_number': 5, + 'text': 'Found approximate constant: 2.71', + }, + { + 'category': 'BEST_PRACTICES', + 'code': 'W0703', + 'column_number': 12, + 'difficulty': 'MEDIUM', + 'influence_on_penalty': {'EASY': 0, 'MEDIUM': 0, 'HARD': 0}, + 'line': 'except Exception:', + 'line_number': 13, + 'text': 'Catching too general exception Exception', + }, + { + 'category': 'BEST_PRACTICES', + 'code': 'R504', + 'column_number': 12, + 'difficulty': 'MEDIUM', + 'influence_on_penalty': {'EASY': 0, 'MEDIUM': 0, 'HARD': 0}, + 'line': 'return result', + 'line_number': 16, + 'text': 'you shouldn`t assign value to variable if it will be use ' 'only as return value', + }, + { + 'category': 'BEST_PRACTICES', + 'code': 'R1708', + 'column_number': 9, + 'difficulty': 'MEDIUM', + 'influence_on_penalty': {'EASY': 0, 'MEDIUM': 0, 'HARD': 0}, + 'line': 'raise StopIteration', + 'line_number': 21, + 'text': 'Do not raise StopIteration in generator, use return ' 'statement instead', + }, + ], +} + +EASY_ISSUES_WITH_INFLUENCE = { + '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': [ + { + 'category': 'CODE_STYLE', + 'code': 'N802', + 'column_number': 6, + 'difficulty': 'EASY', + 'influence_on_penalty': {'EASY': 100, 'MEDIUM': 100, 'HARD': 100}, + 'line': 'def MAIN(Number):', + 'line_number': 1, + 'text': "function name 'MAIN' should be lowercase", + }, + { + 'category': 'CODE_STYLE', + 'code': 'N803', + 'column_number': 11, + 'difficulty': 'EASY', + 'influence_on_penalty': {'EASY': 0, 'MEDIUM': 0, 'HARD': 0}, + 'line': 'def MAIN(Number):', + 'line_number': 1, + 'text': "argument name 'Number' should be lowercase", + }, + { + 'category': 'CODE_STYLE', + 'code': 'E121', + 'column_number': 7, + 'difficulty': 'EASY', + 'influence_on_penalty': {'EASY': 0, 'MEDIUM': 0, 'HARD': 0}, + 'line': '"Hello, World")', + 'line_number': 10, + 'text': 'continuation line under-indented for hanging indent', + }, + { + 'category': 'CODE_STYLE', + 'code': 'WPS319', + 'column_number': 21, + 'difficulty': 'EASY', + 'influence_on_penalty': {'EASY': 0, 'MEDIUM': 0, 'HARD': 0}, + 'line': '"Hello, World")', + 'line_number': 10, + 'text': 'Found bracket in wrong position', + }, + ], +} + +ALL_DIFFICULTY_LEVEL_ISSUES_WITH_INFLUENCE = { + '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': [ + { + 'category': 'BEST_PRACTICES', + 'code': 'WPS407', + 'column_number': 1, + 'difficulty': 'MEDIUM', + 'influence_on_penalty': {'EASY': 0, 'MEDIUM': 64, 'HARD': 52}, + 'line': 'MUTABLE_CONSTANT = {"1": 1, "2": 2}', + 'line_number': 3, + 'text': 'Found mutable module constant', + }, + { + 'category': 'COMPLEXITY', + 'code': 'H601', + 'column_number': 1, + 'difficulty': 'HARD', + 'influence_on_penalty': {'EASY': 0, 'MEDIUM': 0, 'HARD': 17}, + 'line': 'class BadClass:', + 'line_number': 5, + 'text': 'class has low (50.00%) cohesion', + }, + { + 'category': 'CODE_STYLE', + 'code': 'N802', + 'column_number': 10, + 'difficulty': 'EASY', + 'influence_on_penalty': {'EASY': 100, 'MEDIUM': 35, 'HARD': 29}, + 'line': 'def Length(x: int, y: int) -> float:', + 'line_number': 11, + 'text': "function name 'Length' should be lowercase", + }, + ], +} + +DIFFICULTY_LEVELS_WITH_HISTORY_TEST_DATA = [ + ('file_without_issues.py', WITHOUT_ISSUES), + ('file_with_only_hard_issues.py', HARD_ISSUES_WITH_INFLUENCE), + ('file_with_only_medium_issues.py', MEDIUM_ISSUES_WITH_INFLUENCE), + ('file_with_only_easy_issues.py', EASY_ISSUES_WITH_INFLUENCE), + ('file_with_all_difficulty_levels.py', ALL_DIFFICULTY_LEVEL_ISSUES_WITH_INFLUENCE), +] + + +@pytest.mark.parametrize(('file', 'expected_json'), DIFFICULTY_LEVELS_WITH_HISTORY_TEST_DATA) +def test_difficulty_levels_with_history(local_command: LocalCommandBuilder, file: str, expected_json: Dict): + assert _get_output_json(local_command, file, json.dumps(HISTORY)) == expected_json diff --git a/test/python/functional_tests/test_json_format.py b/test/python/functional_tests/test_json_format.py index ee5498d9..9190a4e2 100644 --- a/test/python/functional_tests/test_json_format.py +++ b/test/python/functional_tests/test_json_format.py @@ -1,18 +1,20 @@ import json import subprocess from test.python.functional_tests.conftest import DATA_PATH, LocalCommandBuilder +from typing import Dict import pytest from jsonschema import validate -def _get_output_json(local_command: LocalCommandBuilder, new_format: bool) -> str: +def _get_output_json(local_command: LocalCommandBuilder, new_format: bool, group_by_difficulty: bool) -> str: project_path = DATA_PATH / 'file_or_project' / 'project' local_command.verbosity = 0 local_command.format = 'json' local_command.path = project_path local_command.new_format = new_format + local_command.group_by_difficulty = group_by_difficulty process = subprocess.run( local_command.build(), @@ -24,98 +26,105 @@ def _get_output_json(local_command: LocalCommandBuilder, new_format: bool) -> st return json.loads(stdout) -OLD_FORMAT_SCHEMA = { +def _get_by_difficulty_schema(item_schema: Dict) -> Dict: + return { + 'type': 'object', + 'additionalProperties': False, + 'properties': { + 'EASY': item_schema, + 'MEDIUM': item_schema, + 'HARD': item_schema, + }, + } + + +QUALITY_SCHEMA = { 'type': 'object', 'additionalProperties': False, 'properties': { - 'quality': { - 'type': 'object', - 'additionalProperties': False, - 'properties': { - 'code': {'type': 'string'}, - 'text': {'type': 'string'}, - }, - }, - 'issues': { - 'type': 'array', - 'additionalItems': False, - 'items': { - 'type': 'object', - 'additionalProperties': False, - 'properties': { - 'category': {'type': 'string'}, - 'code': {'type': 'string'}, - 'column_number': {'type': 'integer'}, - 'line': {'type': 'string'}, - 'line_number': {'type': 'integer'}, - 'text': {'type': 'string'}, - 'influence_on_penalty': {'type': 'integer'}, - }, - }, - }, + 'code': {'type': 'string'}, + 'text': {'type': 'string'}, }, } -NEW_FORMAT_SCHEMA = { - 'type': 'object', - 'additionalProperties': False, - 'properties': { - 'quality': { +QUALITY_BY_DIFFICULTY_SCHEMA = _get_by_difficulty_schema(QUALITY_SCHEMA) + +INFLUENCE_ON_PENALTY_SCHEMA = {'type': 'integer'} + +INFLUENCE_ON_PENALTY_BY_DIFFICULTY_SCHEMA = _get_by_difficulty_schema(INFLUENCE_ON_PENALTY_SCHEMA) + + +def _get_issues_schema(influence_in_penalty_schema: Dict) -> Dict: + return { + 'type': 'array', + 'additionalItems': False, + 'items': { 'type': 'object', 'additionalProperties': False, 'properties': { + 'category': {'type': 'string'}, 'code': {'type': 'string'}, + 'column_number': {'type': 'integer'}, + 'line': {'type': 'string'}, + 'line_number': {'type': 'integer'}, 'text': {'type': 'string'}, + 'influence_on_penalty': influence_in_penalty_schema, + 'difficulty': {'type': 'string'}, }, }, - 'file_review_results': { - 'type': 'array', - 'additionalItems': False, - 'items': { - 'type': 'object', - 'additionalProperties': False, - 'properties': { - 'file_name': {'type': 'string'}, - 'quality': { - 'type': 'object', - 'additionalProperties': False, - 'properties': { - 'code': {'type': 'string'}, - 'text': {'type': 'string'}, - }, - }, - 'issues': { - 'type': 'array', - 'additionalItems': False, - 'items': { - 'type': 'object', - 'additionalProperties': False, - 'properties': { - 'code': {'type': 'string'}, - 'text': {'type': 'string'}, - 'line': {'type': 'string'}, - 'line_number': {'type': 'integer'}, - 'column_number': {'type': 'integer'}, - 'category': {'type': 'string'}, - 'influence_on_penalty': {'type': 'integer'}, - }, - }, + } + + +def _get_old_format_schema(quality_schema: Dict, influence_in_penalty_schema: Dict) -> Dict: + return { + 'type': 'object', + 'additionalProperties': False, + 'properties': { + 'quality': quality_schema, + 'issues': _get_issues_schema(influence_in_penalty_schema), + }, + } + + +def _get_new_format_schema(quality_schema: Dict, influence_in_penalty_schema: Dict) -> Dict: + return { + 'type': 'object', + 'additionalProperties': False, + 'properties': { + 'quality': quality_schema, + 'file_review_results': { + 'type': 'array', + 'additionalItems': False, + 'items': { + 'type': 'object', + 'additionalProperties': False, + 'properties': { + 'file_name': {'type': 'string'}, + 'quality': quality_schema, + 'issues': _get_issues_schema(influence_in_penalty_schema), }, }, }, }, - }, -} + } + JSON_FORMAT_SCHEMA_TEST_DATA = [ - (False, OLD_FORMAT_SCHEMA), - (True, NEW_FORMAT_SCHEMA), + (False, False, _get_old_format_schema(QUALITY_SCHEMA, INFLUENCE_ON_PENALTY_SCHEMA)), + (True, False, _get_new_format_schema(QUALITY_SCHEMA, INFLUENCE_ON_PENALTY_SCHEMA)), + (False, True, _get_old_format_schema(QUALITY_BY_DIFFICULTY_SCHEMA, INFLUENCE_ON_PENALTY_BY_DIFFICULTY_SCHEMA)), + (True, True, _get_new_format_schema(QUALITY_BY_DIFFICULTY_SCHEMA, INFLUENCE_ON_PENALTY_BY_DIFFICULTY_SCHEMA)), ] -@pytest.mark.parametrize(('new_format', 'schema'), JSON_FORMAT_SCHEMA_TEST_DATA) -def test_json_format_schema(local_command: LocalCommandBuilder, new_format: bool, schema: str): - validate(_get_output_json(local_command, new_format), schema) +@pytest.mark.parametrize(('new_format', 'group_by_difficulty', 'schema'), JSON_FORMAT_SCHEMA_TEST_DATA) +def test_json_format_schema( + local_command: LocalCommandBuilder, new_format: bool, group_by_difficulty: bool, schema: str, +): + validate(_get_output_json(local_command, new_format, group_by_difficulty), schema) + + +# ---------------------------------------------------------------------------------------------------------------------- ISSUES = [ @@ -127,6 +136,7 @@ def test_json_format_schema(local_command: LocalCommandBuilder, new_format: bool 'column_number': 5, 'category': 'BEST_PRACTICES', 'influence_on_penalty': 0, + 'difficulty': 'MEDIUM', }, { 'code': 'W0612', @@ -136,6 +146,7 @@ def test_json_format_schema(local_command: LocalCommandBuilder, new_format: bool 'column_number': 5, 'category': 'BEST_PRACTICES', 'influence_on_penalty': 0, + 'difficulty': 'MEDIUM', }, { 'code': 'W0612', @@ -145,6 +156,7 @@ def test_json_format_schema(local_command: LocalCommandBuilder, new_format: bool 'column_number': 5, 'category': 'BEST_PRACTICES', 'influence_on_penalty': 0, + 'difficulty': 'MEDIUM', }, ] @@ -189,12 +201,152 @@ def test_json_format_schema(local_command: LocalCommandBuilder, new_format: bool ], } +ISSUES_GROUP_BY_DIFFICULTY = [ + { + 'code': 'W0612', + 'text': 'Unused variable \'a\'', + 'line': 'a = 1', + 'line_number': 2, + 'column_number': 5, + 'category': 'BEST_PRACTICES', + 'influence_on_penalty': { + 'EASY': 0, + 'MEDIUM': 0, + 'HARD': 0, + }, + 'difficulty': 'MEDIUM', + }, + { + 'code': 'W0612', + 'text': 'Unused variable \'b\'', + 'line': 'b = 2', + 'line_number': 3, + 'column_number': 5, + 'category': 'BEST_PRACTICES', + 'influence_on_penalty': { + 'EASY': 0, + 'MEDIUM': 0, + 'HARD': 0, + }, + 'difficulty': 'MEDIUM', + }, + { + 'code': 'W0612', + 'text': 'Unused variable \'c\'', + 'line': 'c = 3', + 'line_number': 4, + 'column_number': 5, + 'category': 'BEST_PRACTICES', + 'influence_on_penalty': { + 'EASY': 0, + 'MEDIUM': 0, + 'HARD': 0, + }, + 'difficulty': 'MEDIUM', + }, +] + +OLD_FORMAT_GROUPED_BY_DIFFICULTY_EXPECTED_JSON = { + 'quality': { + 'EASY': { + 'code': 'EXCELLENT', + 'text': 'Code quality (beta): EXCELLENT', + }, + 'MEDIUM': { + 'code': 'EXCELLENT', + 'text': 'Code quality (beta): EXCELLENT', + }, + 'HARD': { + 'code': 'EXCELLENT', + 'text': 'Code quality (beta): EXCELLENT', + }, + }, + 'issues': ISSUES_GROUP_BY_DIFFICULTY, +} + +NEW_FORMAT_BY_DIFFICULTY_EXPECTED_JSON = { + 'quality': { + 'EASY': { + 'code': 'EXCELLENT', + 'text': 'Code quality (beta): EXCELLENT', + }, + 'MEDIUM': { + 'code': 'EXCELLENT', + 'text': 'Code quality (beta): EXCELLENT', + }, + 'HARD': { + 'code': 'EXCELLENT', + 'text': 'Code quality (beta): EXCELLENT', + }, + }, + 'file_review_results': [ + { + 'file_name': '__init__.py', + 'quality': { + 'EASY': { + 'code': 'EXCELLENT', + 'text': 'Code quality (beta): EXCELLENT', + }, + 'MEDIUM': { + 'code': 'EXCELLENT', + 'text': 'Code quality (beta): EXCELLENT', + }, + 'HARD': { + 'code': 'EXCELLENT', + 'text': 'Code quality (beta): EXCELLENT', + }, + }, + 'issues': [], + }, + { + 'file_name': 'one.py', + 'quality': { + 'EASY': { + 'code': 'EXCELLENT', + 'text': 'Code quality (beta): EXCELLENT', + }, + 'MEDIUM': { + 'code': 'EXCELLENT', + 'text': 'Code quality (beta): EXCELLENT', + }, + 'HARD': { + 'code': 'EXCELLENT', + 'text': 'Code quality (beta): EXCELLENT', + }, + }, + 'issues': [], + }, + { + 'file_name': 'other.py', + 'quality': { + 'EASY': { + 'code': 'EXCELLENT', + 'text': 'Code quality (beta): EXCELLENT', + }, + 'MEDIUM': { + 'code': 'GOOD', + 'text': 'Code quality (beta): GOOD', + }, + 'HARD': { + 'code': 'GOOD', + 'text': 'Code quality (beta): GOOD', + }, + }, + 'issues': ISSUES_GROUP_BY_DIFFICULTY, + }, + ], +} + JSON_FORMAT_TEST_DATA = [ - (False, OLD_FORMAT_EXPECTED_JSON), - (True, NEW_FORMAT_EXPECTED_JSON), + (False, False, OLD_FORMAT_EXPECTED_JSON), + (True, False, NEW_FORMAT_EXPECTED_JSON), + (False, True, OLD_FORMAT_GROUPED_BY_DIFFICULTY_EXPECTED_JSON), + (True, True, NEW_FORMAT_BY_DIFFICULTY_EXPECTED_JSON), ] -@pytest.mark.parametrize(('new_format', 'expected_json'), JSON_FORMAT_TEST_DATA) -def test_json_format(local_command: LocalCommandBuilder, new_format: bool, expected_json: str): - assert _get_output_json(local_command, new_format) == expected_json +@pytest.mark.parametrize(('new_format', 'group_by_difficulty', 'expected_json'), JSON_FORMAT_TEST_DATA) +def test_json_format( + local_command: LocalCommandBuilder, new_format: bool, group_by_difficulty: bool, expected_json: str, +): + assert _get_output_json(local_command, new_format, group_by_difficulty) == expected_json diff --git a/test/python/functional_tests/test_range_of_lines.py b/test/python/functional_tests/test_range_of_lines.py index 3d3e78bc..f20b83df 100644 --- a/test/python/functional_tests/test_range_of_lines.py +++ b/test/python/functional_tests/test_range_of_lines.py @@ -11,42 +11,47 @@ 'code': 'BAD', 'text': 'Code quality (beta): BAD', }, - 'issues': [{ - 'category': 'CODE_STYLE', - 'code': 'E225', - 'column_number': 2, - 'line': 'a=10', - 'line_number': 1, - 'text': 'missing whitespace around operator', - 'influence_on_penalty': 0}, - {'category': 'CODE_STYLE', - 'code': 'E225', - 'column_number': 2, - 'line': 'b=20', - 'line_number': 2, - 'text': 'missing whitespace around operator', - 'influence_on_penalty': 0}, - {'category': 'CODE_STYLE', - 'code': 'E225', - 'column_number': 2, - 'line': 'c=a + b', - 'line_number': 4, - 'text': 'missing whitespace around operator', - 'influence_on_penalty': 0, - }, + 'issues': [ + { + 'category': 'CODE_STYLE', + 'code': 'E225', + 'column_number': 2, + 'line': 'a=10', + 'line_number': 1, + 'text': 'missing whitespace around operator', + 'influence_on_penalty': 0, + 'difficulty': "EASY", + }, + { + 'category': 'CODE_STYLE', + 'code': 'E225', + 'column_number': 2, + 'line': 'b=20', + 'line_number': 2, + 'text': 'missing whitespace around operator', + 'influence_on_penalty': 0, + 'difficulty': "EASY", + }, + { + 'category': 'CODE_STYLE', + 'code': 'E225', + 'column_number': 2, + 'line': 'c=a + b', + 'line_number': 4, + 'text': 'missing whitespace around operator', + 'influence_on_penalty': 0, + 'difficulty': "EASY", + }, ], } NO_ISSUES_JSON = { - 'quality': { - 'code': 'EXCELLENT', - 'text': 'Code quality (beta): EXCELLENT'}, + 'quality': {'code': 'EXCELLENT', 'text': 'Code quality (beta): EXCELLENT'}, 'issues': [], } -def test_range_filter_when_no_range_specified( - local_command: LocalCommandBuilder) -> None: +def test_range_filter_when_no_range_specified(local_command: LocalCommandBuilder) -> None: local_command.path = PATH_TO_FILE local_command.format = 'json' @@ -56,8 +61,7 @@ def test_range_filter_when_no_range_specified( assert output_json == EXPECTED_JSON -def test_range_filter_when_start_line_is_first( - local_command: LocalCommandBuilder) -> None: +def test_range_filter_when_start_line_is_first(local_command: LocalCommandBuilder) -> None: local_command.path = PATH_TO_FILE local_command.format = 'json' local_command.start_line = 1 @@ -68,8 +72,7 @@ def test_range_filter_when_start_line_is_first( assert output_json == EXPECTED_JSON -def test_range_filter_when_start_line_is_not_first( - local_command: LocalCommandBuilder) -> None: +def test_range_filter_when_start_line_is_not_first(local_command: LocalCommandBuilder) -> None: local_command.path = PATH_TO_FILE local_command.format = 'json' local_command.start_line = 3 @@ -78,25 +81,25 @@ def test_range_filter_when_start_line_is_not_first( output_json = json.loads(output) expected_json_with_one_issue = { - 'quality': { - 'code': 'MODERATE', - 'text': 'Code quality (beta): MODERATE'}, - 'issues': [{ - 'code': 'E225', - 'text': 'missing whitespace around operator', - 'line': 'c=a + b', - 'line_number': 4, - 'column_number': 2, - 'category': 'CODE_STYLE', - 'influence_on_penalty': 0, - }], + 'quality': {'code': 'MODERATE', 'text': 'Code quality (beta): MODERATE'}, + 'issues': [ + { + 'code': 'E225', + 'text': 'missing whitespace around operator', + 'line': 'c=a + b', + 'line_number': 4, + 'column_number': 2, + 'category': 'CODE_STYLE', + 'influence_on_penalty': 0, + 'difficulty': "EASY", + }, + ], } assert output_json == expected_json_with_one_issue -def test_range_filter_when_start_out_of_range( - local_command: LocalCommandBuilder) -> None: +def test_range_filter_when_start_out_of_range(local_command: LocalCommandBuilder) -> None: local_command.path = PATH_TO_FILE local_command.format = 'json' local_command.start_line = 5 @@ -109,8 +112,7 @@ def test_range_filter_when_start_out_of_range( assert output_json == expected_json_without_issues -def test_range_filter_when_start_line_is_not_positive( - local_command: LocalCommandBuilder) -> None: +def test_range_filter_when_start_line_is_not_positive(local_command: LocalCommandBuilder) -> None: local_command.start_line = 0 with pytest.raises(Exception): @@ -124,8 +126,7 @@ def test_range_filter_when_start_line_is_not_positive( json.loads(output) -def test_range_filter_when_end_line_is_last( - local_command: LocalCommandBuilder) -> None: +def test_range_filter_when_end_line_is_last(local_command: LocalCommandBuilder) -> None: local_command.path = PATH_TO_FILE local_command.format = 'json' local_command.end_line = 4 # last line with an error @@ -136,8 +137,7 @@ def test_range_filter_when_end_line_is_last( assert output_json == EXPECTED_JSON -def test_range_filter_when_end_line_is_first( - local_command: LocalCommandBuilder) -> None: +def test_range_filter_when_end_line_is_first(local_command: LocalCommandBuilder) -> None: local_command.path = PATH_TO_FILE local_command.format = 'json' local_command.end_line = 1 @@ -150,22 +150,24 @@ def test_range_filter_when_end_line_is_first( 'code': 'MODERATE', 'text': 'Code quality (beta): MODERATE', }, - 'issues': [{ - 'code': 'E225', - 'text': 'missing whitespace around operator', - 'line': 'a=10', - 'line_number': 1, - 'column_number': 2, - 'category': 'CODE_STYLE', - 'influence_on_penalty': 0, - }], + 'issues': [ + { + 'code': 'E225', + 'text': 'missing whitespace around operator', + 'line': 'a=10', + 'line_number': 1, + 'column_number': 2, + 'category': 'CODE_STYLE', + 'influence_on_penalty': 0, + 'difficulty': "EASY", + }, + ], } assert output_json == expected_json_with_one_issue -def test_range_filter_when_end_line_out_of_range( - local_command: LocalCommandBuilder) -> None: +def test_range_filter_when_end_line_out_of_range(local_command: LocalCommandBuilder) -> None: local_command.path = PATH_TO_FILE local_command.format = 'json' local_command.end_line = 10 @@ -176,8 +178,7 @@ def test_range_filter_when_end_line_out_of_range( assert output_json == output_json -def test_range_filter_when_both_start_and_end_lines_specified( - local_command: LocalCommandBuilder) -> None: +def test_range_filter_when_both_start_and_end_lines_specified(local_command: LocalCommandBuilder) -> None: local_command.path = PATH_TO_FILE local_command.format = 'json' local_command.start_line = 1 @@ -189,8 +190,7 @@ def test_range_filter_when_both_start_and_end_lines_specified( assert output_json == EXPECTED_JSON -def test_range_filter_when_equal_start_and_end_lines( - local_command: LocalCommandBuilder) -> None: +def test_range_filter_when_equal_start_and_end_lines(local_command: LocalCommandBuilder) -> None: local_command.path = PATH_TO_FILE local_command.format = 'json' local_command.start_line = 3 @@ -203,7 +203,8 @@ def test_range_filter_when_equal_start_and_end_lines( def test_range_filter_when_both_start_and_end_lines_specified_not_equal_borders( - local_command: LocalCommandBuilder) -> None: + local_command: LocalCommandBuilder, +) -> None: local_command.path = PATH_TO_FILE local_command.format = 'json' local_command.start_line = 2 @@ -217,30 +218,34 @@ def test_range_filter_when_both_start_and_end_lines_specified_not_equal_borders( 'code': 'BAD', 'text': 'Code quality (beta): BAD', }, - 'issues': [{ - 'code': 'E225', - 'text': 'missing whitespace around operator', - 'line': 'b=20', - 'line_number': 2, - 'column_number': 2, - 'category': 'CODE_STYLE', - 'influence_on_penalty': 0, - }, { - 'code': 'E225', - 'text': 'missing whitespace around operator', - 'line': 'c=a + b', - 'line_number': 4, - 'column_number': 2, - 'category': 'CODE_STYLE', - 'influence_on_penalty': 0, - }], + 'issues': [ + { + 'code': 'E225', + 'text': 'missing whitespace around operator', + 'line': 'b=20', + 'line_number': 2, + 'column_number': 2, + 'category': 'CODE_STYLE', + 'influence_on_penalty': 0, + 'difficulty': "EASY", + }, + { + 'code': 'E225', + 'text': 'missing whitespace around operator', + 'line': 'c=a + b', + 'line_number': 4, + 'column_number': 2, + 'category': 'CODE_STYLE', + 'influence_on_penalty': 0, + 'difficulty': "EASY", + }, + ], } assert output_json == expected_json -def test_range_filter_when_both_start_and_end_lines_out_of_range( - local_command: LocalCommandBuilder) -> None: +def test_range_filter_when_both_start_and_end_lines_out_of_range(local_command: LocalCommandBuilder) -> None: local_command.path = PATH_TO_FILE local_command.format = 'json' local_command.start_line = 10 diff --git a/test/python/inspectors/test_checkstyle_inspector.py b/test/python/inspectors/test_checkstyle_inspector.py index d5069a5c..55bd84da 100644 --- a/test/python/inspectors/test_checkstyle_inspector.py +++ b/test/python/inspectors/test_checkstyle_inspector.py @@ -12,6 +12,7 @@ CodeIssue, CyclomaticComplexityIssue, FuncLenIssue, + IssueDifficulty, IssueType, LineLenIssue, ) @@ -36,18 +37,21 @@ description='The String "Howdy" appears 4 times in the file.', file_path=Path('/home/user/Desktop/some_project/main.java'), line_no=6, column_no=13, inspector_type=InspectorType.CHECKSTYLE, + difficulty=IssueDifficulty.MEDIUM, ), CodeIssue( origin_class='WhitespaceAroundCheck', type=IssueType.CODE_STYLE, description="'{' is not followed by whitespace.", file_path=Path('/home/user/Desktop/some_project/main.java'), line_no=12, column_no=32, inspector_type=InspectorType.CHECKSTYLE, + difficulty=IssueDifficulty.EASY, ), CodeIssue( origin_class='StringLiteralEqualityCheck', type=IssueType.ERROR_PRONE, description="Literal Strings should be compared using equals(), not '=='.", file_path=Path('/home/user/Desktop/some_project/main.java'), line_no=37, column_no=33, inspector_type=InspectorType.CHECKSTYLE, + difficulty=IssueDifficulty.HARD, ), ], ), @@ -59,20 +63,21 @@ description=get_func_len_tip(), file_path=Path('/home/user/Desktop/some_project/main.java'), line_no=5, column_no=5, inspector_type=InspectorType.CHECKSTYLE, - func_len=42, + func_len=42, difficulty=IssueDifficulty.EASY, ), CyclomaticComplexityIssue( origin_class='CyclomaticComplexityCheck', type=IssueType.CYCLOMATIC_COMPLEXITY, description=get_cyclomatic_complexity_tip(), file_path=Path('/home/user/Desktop/some_project/main.java'), line_no=5, column_no=5, inspector_type=InspectorType.CHECKSTYLE, - cc_value=69, + cc_value=69, difficulty=IssueDifficulty.HARD, ), CodeIssue( origin_class='WhitespaceAroundCheck', type=IssueType.CODE_STYLE, description="'switch' is not followed by whitespace.", file_path=Path('/home/user/Desktop/some_project/main.java'), line_no=31, column_no=25, inspector_type=InspectorType.CHECKSTYLE, + difficulty=IssueDifficulty.EASY, ), ], ), @@ -84,24 +89,28 @@ description='Must have at least one statement.', file_path=Path('/home/user/Desktop/some_project/main1.java'), line_no=62, column_no=38, inspector_type=InspectorType.CHECKSTYLE, + difficulty=IssueDifficulty.MEDIUM, ), CodeIssue( origin_class='CovariantEqualsCheck', type=IssueType.ERROR_PRONE, description='covariant equals without overriding equals(java.lang.Object).', file_path=Path('/home/user/Desktop/some_project/main1.java'), line_no=68, column_no=20, inspector_type=InspectorType.CHECKSTYLE, + difficulty=IssueDifficulty.HARD, ), CodeIssue( origin_class='IndentationCheck', type=IssueType.CODE_STYLE, description="'if' child has incorrect indentation level 2, expected level should be 12.", file_path=Path('/home/user/Desktop/some_project/main2.java'), line_no=116, column_no=3, inspector_type=InspectorType.CHECKSTYLE, + difficulty=IssueDifficulty.EASY, ), CodeIssue( origin_class='UpperEllCheck', type=IssueType.BEST_PRACTICES, description="Should use uppercase 'L'.", file_path=Path('/home/user/Desktop/some_project/main2.java'), line_no=123, column_no=15, inspector_type=InspectorType.CHECKSTYLE, + difficulty=IssueDifficulty.MEDIUM, ), ], ), @@ -113,24 +122,28 @@ description='Only one statement per line allowed.', file_path=Path('/home/user/Desktop/some_project/main1.java'), line_no=69, column_no=31, inspector_type=InspectorType.CHECKSTYLE, + difficulty=IssueDifficulty.EASY, ), BoolExprLenIssue( origin_class='BooleanExpressionComplexityCheck', type=IssueType.BOOL_EXPR_LEN, description=get_bool_expr_len_tip(), file_path=Path('/home/user/Desktop/some_project/main1.java'), line_no=112, column_no=9, inspector_type=InspectorType.CHECKSTYLE, bool_expr_len=77, + difficulty=IssueDifficulty.EASY, ), LineLenIssue( origin_class='LineLengthCheck', type=IssueType.LINE_LEN, description=get_line_len_tip(), file_path=Path('/home/user/Desktop/some_project/main2.java'), line_no=62, column_no=1, inspector_type=InspectorType.CHECKSTYLE, line_len=228, + difficulty=IssueDifficulty.EASY, ), CodeIssue( origin_class='WhitespaceAfterCheck', type=IssueType.CODE_STYLE, description="',' is not followed by whitespace.", file_path=Path('/home/user/Desktop/some_project/main2.java'), line_no=136, column_no=19, inspector_type=InspectorType.CHECKSTYLE, + difficulty=IssueDifficulty.EASY, ), ], ), @@ -144,6 +157,7 @@ def test_output_parsing(file_name: str, expected_issues: List[CodeIssue]): path_to_file, InspectorType.CHECKSTYLE, CheckstyleInspector.choose_issue_type, + IssueDifficulty.get_by_issue_type, CheckstyleInspector.origin_class_to_pattern, ) assert issues == expected_issues diff --git a/test/python/inspectors/test_filter_duplicate_issues.py b/test/python/inspectors/test_filter_duplicate_issues.py index 4b3b8887..26ce7683 100644 --- a/test/python/inspectors/test_filter_duplicate_issues.py +++ b/test/python/inspectors/test_filter_duplicate_issues.py @@ -1,40 +1,52 @@ from pathlib import Path from src.python.review.inspectors.inspector_type import InspectorType -from src.python.review.inspectors.issue import CodeIssue, IssueType +from src.python.review.inspectors.issue import CodeIssue, IssueDifficulty, IssueType from src.python.review.reviewers.utils.issues_filter import filter_duplicate_issues def test_filter_duplicate_issues_when_single_inspector() -> None: issues = [ - CodeIssue(file_path=Path('code.py'), - line_no=10, - description='', - inspector_type=InspectorType.FLAKE8, - type=IssueType.CODE_STYLE, - column_no=1, - origin_class=''), - CodeIssue(file_path=Path('code.py'), - line_no=11, - description='', - inspector_type=InspectorType.FLAKE8, - type=IssueType.CODE_STYLE, - column_no=1, - origin_class=''), - CodeIssue(file_path=Path('code.py'), - line_no=11, - description='', - inspector_type=InspectorType.FLAKE8, - type=IssueType.CODE_STYLE, - column_no=1, - origin_class=''), - CodeIssue(file_path=Path('code.py'), - line_no=11, - description='', - type=IssueType.CODE_STYLE, - inspector_type=InspectorType.FLAKE8, - column_no=1, - origin_class=''), + CodeIssue( + file_path=Path('code.py'), + line_no=10, + description='', + inspector_type=InspectorType.FLAKE8, + type=IssueType.CODE_STYLE, + column_no=1, + origin_class='', + difficulty=IssueDifficulty.EASY, + ), + CodeIssue( + file_path=Path('code.py'), + line_no=11, + description='', + inspector_type=InspectorType.FLAKE8, + type=IssueType.CODE_STYLE, + column_no=1, + origin_class='', + difficulty=IssueDifficulty.EASY, + ), + CodeIssue( + file_path=Path('code.py'), + line_no=11, + description='', + inspector_type=InspectorType.FLAKE8, + type=IssueType.CODE_STYLE, + column_no=1, + origin_class='', + difficulty=IssueDifficulty.EASY, + ), + CodeIssue( + file_path=Path('code.py'), + line_no=11, + description='', + type=IssueType.CODE_STYLE, + inspector_type=InspectorType.FLAKE8, + column_no=1, + origin_class='', + difficulty=IssueDifficulty.EASY, + ), ] filtered_issues = filter_duplicate_issues(issues) @@ -44,107 +56,137 @@ def test_filter_duplicate_issues_when_single_inspector() -> None: def test_filter_duplicate_issues_when_several_inspectors() -> None: issues = [ - CodeIssue(file_path=Path('code.py'), - line_no=10, - description='', - inspector_type=InspectorType.PYLINT, - column_no=1, - origin_class='', - type=IssueType.COMPLEXITY), - CodeIssue(file_path=Path('code.py'), - line_no=10, - description='', - inspector_type=InspectorType.FLAKE8, - column_no=1, - origin_class='', - type=IssueType.COMPLEXITY), - CodeIssue(file_path=Path('code.py'), - line_no=10, - description='', - inspector_type=InspectorType.INTELLIJ, - column_no=1, - origin_class='', - type=IssueType.COMPLEXITY), - CodeIssue(file_path=Path('code.py'), - line_no=11, - description='', - type=IssueType.CODE_STYLE, - inspector_type=InspectorType.PYLINT, - column_no=1, - origin_class=''), - CodeIssue(file_path=Path('code.py'), - line_no=11, - description='', - type=IssueType.BEST_PRACTICES, - inspector_type=InspectorType.FLAKE8, - column_no=1, - origin_class=''), - CodeIssue(file_path=Path('code.py'), - line_no=11, - description='', - type=IssueType.ERROR_PRONE, - inspector_type=InspectorType.INTELLIJ, - column_no=1, - origin_class=''), + CodeIssue( + file_path=Path('code.py'), + line_no=10, + description='', + inspector_type=InspectorType.PYLINT, + column_no=1, + origin_class='', + type=IssueType.COMPLEXITY, + difficulty=IssueDifficulty.HARD, + ), + CodeIssue( + file_path=Path('code.py'), + line_no=10, + description='', + inspector_type=InspectorType.FLAKE8, + column_no=1, + origin_class='', + type=IssueType.COMPLEXITY, + difficulty=IssueDifficulty.HARD, + ), + CodeIssue( + file_path=Path('code.py'), + line_no=10, + description='', + inspector_type=InspectorType.INTELLIJ, + column_no=1, + origin_class='', + type=IssueType.COMPLEXITY, + difficulty=IssueDifficulty.HARD, + ), + CodeIssue( + file_path=Path('code.py'), + line_no=11, + description='', + type=IssueType.CODE_STYLE, + inspector_type=InspectorType.PYLINT, + column_no=1, + origin_class='', + difficulty=IssueDifficulty.EASY, + ), + CodeIssue( + file_path=Path('code.py'), + line_no=11, + description='', + type=IssueType.BEST_PRACTICES, + inspector_type=InspectorType.FLAKE8, + column_no=1, + origin_class='', + difficulty=IssueDifficulty.MEDIUM, + ), + CodeIssue( + file_path=Path('code.py'), + line_no=11, + description='', + type=IssueType.ERROR_PRONE, + inspector_type=InspectorType.INTELLIJ, + column_no=1, + origin_class='', + difficulty=IssueDifficulty.HARD, + ), ] filtered_issues = filter_duplicate_issues(issues) - assert set(filtered_issues) == {issues[0], - issues[3], - issues[4], - issues[5]} + assert set(filtered_issues) == {issues[0], issues[3], issues[4], issues[5]} def test_filter_duplicate_issues_when_several_issues_in_line_no() -> None: issues = [ - CodeIssue(file_path=Path('code.py'), - line_no=10, - description='', - type=IssueType.CODE_STYLE, - inspector_type=InspectorType.PYLINT, - column_no=1, - origin_class=''), - CodeIssue(file_path=Path('code.py'), - line_no=10, - description='', - type=IssueType.CODE_STYLE, - inspector_type=InspectorType.FLAKE8, - column_no=1, - origin_class=''), - CodeIssue(file_path=Path('code.py'), - line_no=10, - description='', - type=IssueType.CODE_STYLE, - inspector_type=InspectorType.FLAKE8, - column_no=1, - origin_class=''), - CodeIssue(file_path=Path('code.py'), - line_no=10, - description='', - inspector_type=InspectorType.FLAKE8, - column_no=1, - origin_class='', - type=IssueType.COMPLEXITY), - CodeIssue(file_path=Path('code.py'), - line_no=10, - description='', - inspector_type=InspectorType.INTELLIJ, - column_no=1, - origin_class='', - type=IssueType.COMPLEXITY), - CodeIssue(file_path=Path('code.py'), - line_no=10, - description='', - inspector_type=InspectorType.INTELLIJ, - column_no=1, - origin_class='', - type=IssueType.COMPLEXITY), + CodeIssue( + file_path=Path('code.py'), + line_no=10, + description='', + type=IssueType.CODE_STYLE, + inspector_type=InspectorType.PYLINT, + column_no=1, + origin_class='', + difficulty=IssueDifficulty.EASY, + ), + CodeIssue( + file_path=Path('code.py'), + line_no=10, + description='', + type=IssueType.CODE_STYLE, + inspector_type=InspectorType.FLAKE8, + column_no=1, + origin_class='', + difficulty=IssueDifficulty.EASY, + ), + CodeIssue( + file_path=Path('code.py'), + line_no=10, + description='', + type=IssueType.CODE_STYLE, + inspector_type=InspectorType.FLAKE8, + column_no=1, + origin_class='', + difficulty=IssueDifficulty.EASY, + ), + CodeIssue( + file_path=Path('code.py'), + line_no=10, + description='', + inspector_type=InspectorType.FLAKE8, + column_no=1, + origin_class='', + type=IssueType.COMPLEXITY, + difficulty=IssueDifficulty.HARD, + ), + CodeIssue( + file_path=Path('code.py'), + line_no=10, + description='', + inspector_type=InspectorType.INTELLIJ, + column_no=1, + origin_class='', + type=IssueType.COMPLEXITY, + difficulty=IssueDifficulty.HARD, + ), + CodeIssue( + file_path=Path('code.py'), + line_no=10, + description='', + inspector_type=InspectorType.INTELLIJ, + column_no=1, + origin_class='', + type=IssueType.COMPLEXITY, + difficulty=IssueDifficulty.HARD, + ), ] filtered_issues = filter_duplicate_issues(issues) - assert set(filtered_issues) == {issues[1], - issues[2], - issues[4], - issues[5]} + assert set(filtered_issues) == {issues[1], issues[2], issues[4], issues[5]} diff --git a/test/python/inspectors/test_out_of_range_issues.py b/test/python/inspectors/test_out_of_range_issues.py index 3f73d63d..b5751d05 100644 --- a/test/python/inspectors/test_out_of_range_issues.py +++ b/test/python/inspectors/test_out_of_range_issues.py @@ -1,20 +1,23 @@ from pathlib import Path from src.python.review.inspectors.inspector_type import InspectorType -from src.python.review.inspectors.issue import BaseIssue, CodeIssue, IssueType +from src.python.review.inspectors.issue import BaseIssue, CodeIssue, IssueDifficulty, IssueType from src.python.review.reviewers.common import filter_out_of_range_issues DEFAULT_PATH = Path('test_out_of_range_issues.py') def create_code_issue_by_line(line_no: int) -> BaseIssue: - return CodeIssue(file_path=DEFAULT_PATH, - line_no=line_no, - description='', - inspector_type=InspectorType.FLAKE8, - type=IssueType.CODE_STYLE, - column_no=1, - origin_class='') + return CodeIssue( + file_path=DEFAULT_PATH, + line_no=line_no, + description='', + inspector_type=InspectorType.FLAKE8, + type=IssueType.CODE_STYLE, + column_no=1, + origin_class='', + difficulty=IssueDifficulty.EASY, + ) def test_out_of_range_issues_when_no_issues() -> None: diff --git a/test/python/inspectors/test_pmd_inspector.py b/test/python/inspectors/test_pmd_inspector.py index 4a8001e6..ad7db75f 100644 --- a/test/python/inspectors/test_pmd_inspector.py +++ b/test/python/inspectors/test_pmd_inspector.py @@ -4,7 +4,7 @@ import pytest from src.python.review.inspectors.inspector_type import InspectorType -from src.python.review.inspectors.issue import CodeIssue, IssueType +from src.python.review.inspectors.issue import CodeIssue, IssueDifficulty, IssueType from src.python.review.inspectors.pmd.pmd import PMDInspector from .conftest import use_file_metadata @@ -21,24 +21,28 @@ "the first occurrence is on line 6", file_path=Path('/home/user/Desktop/some_project/main.java'), line_no=6, column_no=1, inspector_type=InspectorType.PMD, + difficulty=IssueDifficulty.MEDIUM, ), CodeIssue( origin_class='UncommentedEmptyMethodBody', type=IssueType.BEST_PRACTICES, description='Document empty method body', file_path=Path('/home/user/Desktop/some_project/main.java'), line_no=12, column_no=1, inspector_type=InspectorType.PMD, + difficulty=IssueDifficulty.MEDIUM, ), CodeIssue( origin_class='UnusedLocalVariable', type=IssueType.BEST_PRACTICES, description="Avoid unused local variables such as 'result'.", file_path=Path('/home/user/Desktop/some_project/main.java'), line_no=31, column_no=1, inspector_type=InspectorType.PMD, + difficulty=IssueDifficulty.MEDIUM, ), CodeIssue( origin_class='UnusedPrivateMethod', type=IssueType.BEST_PRACTICES, description="Avoid unused private methods such as 'emptyLoop()'.", file_path=Path('/home/user/Desktop/some_project/main.java'), line_no=61, column_no=1, inspector_type=InspectorType.PMD, + difficulty=IssueDifficulty.MEDIUM, ), ], ), @@ -50,24 +54,28 @@ description='Use equals() to compare object references.', file_path=Path('/home/user/Desktop/some_project/main1.java'), line_no=37, column_no=1, inspector_type=InspectorType.PMD, + difficulty=IssueDifficulty.HARD, ), CodeIssue( origin_class='SuspiciousEqualsMethodName', type=IssueType.ERROR_PRONE, description='The method name and parameter number are suspiciously close to equals(Object)', file_path=Path('/home/user/Desktop/some_project/main1.java'), line_no=68, column_no=1, inspector_type=InspectorType.PMD, + difficulty=IssueDifficulty.HARD, ), CodeIssue( origin_class='UselessParentheses', type=IssueType.CODE_STYLE, description='Useless parentheses.', file_path=Path('/home/user/Desktop/some_project/main2.java'), line_no=113, column_no=1, inspector_type=InspectorType.PMD, + difficulty=IssueDifficulty.EASY, ), CodeIssue( origin_class='EmptyIfStmt', type=IssueType.BEST_PRACTICES, description='Avoid empty if statements', file_path=Path('/home/user/Desktop/some_project/main2.java'), line_no=131, column_no=1, inspector_type=InspectorType.PMD, + difficulty=IssueDifficulty.MEDIUM, ), ], ), diff --git a/test/python/quality/test_penalty.py b/test/python/quality/test_penalty.py index 57493d41..a596531b 100644 --- a/test/python/quality/test_penalty.py +++ b/test/python/quality/test_penalty.py @@ -3,7 +3,7 @@ import pytest from src.python.review.inspectors.inspector_type import InspectorType -from src.python.review.inspectors.issue import BaseIssue, IssueType +from src.python.review.inspectors.issue import BaseIssue, IssueDifficulty, IssueType from src.python.review.quality.penalty import categorize, PreviousIssue, Punisher punisher = Punisher([], []) @@ -17,6 +17,7 @@ origin_class="SC200", inspector_type=InspectorType.FLAKE8, type=IssueType.BEST_PRACTICES, + difficulty=IssueDifficulty.MEDIUM, ), BaseIssue( file_path=Path("."), @@ -26,6 +27,7 @@ origin_class="W0108", inspector_type=InspectorType.FLAKE8, type=IssueType.CODE_STYLE, + difficulty=IssueDifficulty.EASY, ), ] diff --git a/test/resources/evaluation/common/inspectors/diffs_between_df/new_1.csv b/test/resources/evaluation/common/inspectors/diffs_between_df/new_1.csv index c415b91a..466ee3a1 100644 --- a/test/resources/evaluation/common/inspectors/diffs_between_df/new_1.csv +++ b/test/resources/evaluation/common/inspectors/diffs_between_df/new_1.csv @@ -1,10 +1,10 @@ id,time,code,lang,grade,traceback 1,1617455906,"print (""Learn Python to be great!"") -",python3,MODERATE,"{""quality"": {""code"": ""MODERATE"", ""text"": ""Code quality (beta): MODERATE""}, ""issues"": [{""code"": ""E215"", ""text"": ""whitespace before '('"", ""line"": ""print (\""Learn Python to be great!\"")"", ""line_number"": 1, ""column_number"": 6, ""category"": ""CODE_STYLE"", ""influence_on_penalty"": 0}]} +",python3,MODERATE,"{""quality"": {""code"": ""MODERATE"", ""text"": ""Code quality (beta): MODERATE""}, ""issues"": [{""code"": ""E215"", ""text"": ""whitespace before '('"", ""line"": ""print (\""Learn Python to be great!\"")"", ""line_number"": 1, ""column_number"": 6, ""category"": ""CODE_STYLE"", ""influence_on_penalty"": 0, ""difficulty"": ""EASY""}]} " 2,1617455906,"print (""Learn Python to be great!"") -",python3,MODERATE,"{""quality"": {""code"": ""MODERATE"", ""text"": ""Code quality (beta): MODERATE""}, ""issues"": [{""code"": ""E215"", ""text"": ""whitespace before '('"", ""line"": ""print (\""Learn Python to be great!\"")"", ""line_number"": 1, ""column_number"": 6, ""category"": ""CODE_STYLE"", ""influence_on_penalty"": 0}]} +",python3,MODERATE,"{""quality"": {""code"": ""MODERATE"", ""text"": ""Code quality (beta): MODERATE""}, ""issues"": [{""code"": ""E215"", ""text"": ""whitespace before '('"", ""line"": ""print (\""Learn Python to be great!\"")"", ""line_number"": 1, ""column_number"": 6, ""category"": ""CODE_STYLE"", ""influence_on_penalty"": 0, ""difficulty"": ""EASY""}]} " 3,1617455906,"print (""Learn Python to be great!"") -",python3,MODERATE,"{""quality"": {""code"": ""MODERATE"", ""text"": ""Code quality (beta): MODERATE""}, ""issues"": [{""code"": ""E215"", ""text"": ""whitespace before '('"", ""line"": ""print (\""Learn Python to be great!\"")"", ""line_number"": 1, ""column_number"": 6, ""category"": ""CODE_STYLE"", ""influence_on_penalty"": 0}]} +",python3,MODERATE,"{""quality"": {""code"": ""MODERATE"", ""text"": ""Code quality (beta): MODERATE""}, ""issues"": [{""code"": ""E215"", ""text"": ""whitespace before '('"", ""line"": ""print (\""Learn Python to be great!\"")"", ""line_number"": 1, ""column_number"": 6, ""category"": ""CODE_STYLE"", ""influence_on_penalty"": 0, ""difficulty"": ""EASY""}]} " \ No newline at end of file diff --git a/test/resources/evaluation/common/inspectors/diffs_between_df/new_2.csv b/test/resources/evaluation/common/inspectors/diffs_between_df/new_2.csv index 2ccfe8aa..67eb2099 100644 --- a/test/resources/evaluation/common/inspectors/diffs_between_df/new_2.csv +++ b/test/resources/evaluation/common/inspectors/diffs_between_df/new_2.csv @@ -1,10 +1,10 @@ id,time,code,lang,grade,traceback 1,1617455906,"print (""Learn Python to be great!"") -",python3,GOOD,"{""quality"": {""code"": ""GOOD"", ""text"": ""Code quality (beta): GOOD""}, ""issues"": [{""code"": ""E215"", ""text"": ""whitespace before '('"", ""line"": ""print (\""Learn Python to be great!\"")"", ""line_number"": 1, ""column_number"": 6, ""category"": ""CODE_STYLE"", ""influence_on_penalty"": 0}]} +",python3,GOOD,"{""quality"": {""code"": ""GOOD"", ""text"": ""Code quality (beta): GOOD""}, ""issues"": [{""code"": ""E215"", ""text"": ""whitespace before '('"", ""line"": ""print (\""Learn Python to be great!\"")"", ""line_number"": 1, ""column_number"": 6, ""category"": ""CODE_STYLE"", ""influence_on_penalty"": 0, ""difficulty"": ""EASY""}]} " 2,1617455906,"print (""Learn Python to be great!"") -",python3,GOOD,"{""quality"": {""code"": ""GOOD"", ""text"": ""Code quality (beta): GOOD""}, ""issues"": [{""code"": ""E215"", ""text"": ""whitespace before '('"", ""line"": ""print (\""Learn Python to be great!\"")"", ""line_number"": 1, ""column_number"": 6, ""category"": ""CODE_STYLE"", ""influence_on_penalty"": 0}]} +",python3,GOOD,"{""quality"": {""code"": ""GOOD"", ""text"": ""Code quality (beta): GOOD""}, ""issues"": [{""code"": ""E215"", ""text"": ""whitespace before '('"", ""line"": ""print (\""Learn Python to be great!\"")"", ""line_number"": 1, ""column_number"": 6, ""category"": ""CODE_STYLE"", ""influence_on_penalty"": 0, ""difficulty"": ""EASY""}]} " 3,1617455906,"print (""Learn Python to be great!"") -",python3,MODERATE,"{""quality"": {""code"": ""MODERATE"", ""text"": ""Code quality (beta): MODERATE""}, ""issues"": [{""code"": ""E215"", ""text"": ""whitespace before '('"", ""line"": ""print (\""Learn Python to be great!\"")"", ""line_number"": 1, ""column_number"": 6, ""category"": ""CODE_STYLE"", ""influence_on_penalty"": 0}]} +",python3,MODERATE,"{""quality"": {""code"": ""MODERATE"", ""text"": ""Code quality (beta): MODERATE""}, ""issues"": [{""code"": ""E215"", ""text"": ""whitespace before '('"", ""line"": ""print (\""Learn Python to be great!\"")"", ""line_number"": 1, ""column_number"": 6, ""category"": ""CODE_STYLE"", ""influence_on_penalty"": 0, ""difficulty"": ""EASY""}]} " \ No newline at end of file diff --git a/test/resources/evaluation/common/inspectors/diffs_between_df/new_3.csv b/test/resources/evaluation/common/inspectors/diffs_between_df/new_3.csv index d8b2addc..e0a8bd98 100644 --- a/test/resources/evaluation/common/inspectors/diffs_between_df/new_3.csv +++ b/test/resources/evaluation/common/inspectors/diffs_between_df/new_3.csv @@ -1,10 +1,10 @@ id,time,code,lang,grade,traceback 1,1617455906,"print (""Learn Python to be great!"") -",python3,MODERATE,"{""quality"": {""code"": ""MODERATE"", ""text"": ""Code quality (beta): MODERATE""}, ""issues"": [{""code"": ""E215"", ""text"": ""whitespace before '('"", ""line"": ""print (\""Learn Python to be great!\"")"", ""line_number"": 1, ""column_number"": 6, ""category"": ""CODE_STYLE"", ""influence_on_penalty"": 0},{""code"": ""C0305"", ""text"": ""Trailing newlines"", ""line"": """", ""line_number"": 15, ""column_number"": 1, ""category"": ""CODE_STYLE"", ""influence_on_penalty"": 0},{""code"": ""E211"", ""text"": ""whitespace before '('"", ""line"": ""print (\""Learn Python to be great!\"")"", ""line_number"": 1, ""column_number"": 6, ""category"": ""CODE_STYLE"", ""influence_on_penalty"": 0}]} +",python3,MODERATE,"{""quality"": {""code"": ""MODERATE"", ""text"": ""Code quality (beta): MODERATE""}, ""issues"": [{""code"": ""E215"", ""text"": ""whitespace before '('"", ""line"": ""print (\""Learn Python to be great!\"")"", ""line_number"": 1, ""column_number"": 6, ""category"": ""CODE_STYLE"", ""influence_on_penalty"": 0, ""difficulty"": ""EASY""},{""code"": ""C0305"", ""text"": ""Trailing newlines"", ""line"": """", ""line_number"": 15, ""column_number"": 1, ""category"": ""CODE_STYLE"", ""influence_on_penalty"": 0, ""difficulty"": ""EASY""},{""code"": ""E211"", ""text"": ""whitespace before '('"", ""line"": ""print (\""Learn Python to be great!\"")"", ""line_number"": 1, ""column_number"": 6, ""category"": ""CODE_STYLE"", ""influence_on_penalty"": 0, ""difficulty"": ""EASY""}]} " 2,1617455906,"print (""Learn Python to be great!"") -",python3,MODERATE,"{""quality"": {""code"": ""MODERATE"", ""text"": ""Code quality (beta): MODERATE""}, ""issues"": [{""code"": ""E215"", ""text"": ""whitespace before '('"", ""line"": ""print (\""Learn Python to be great!\"")"", ""line_number"": 1, ""column_number"": 6, ""category"": ""CODE_STYLE"", ""influence_on_penalty"": 0}]} +",python3,MODERATE,"{""quality"": {""code"": ""MODERATE"", ""text"": ""Code quality (beta): MODERATE""}, ""issues"": [{""code"": ""E215"", ""text"": ""whitespace before '('"", ""line"": ""print (\""Learn Python to be great!\"")"", ""line_number"": 1, ""column_number"": 6, ""category"": ""CODE_STYLE"", ""influence_on_penalty"": 0, ""difficulty"": ""EASY""}]} " 3,1617455906,"print (""Learn Python to be great!"") -",python3,MODERATE,"{""quality"": {""code"": ""MODERATE"", ""text"": ""Code quality (beta): MODERATE""}, ""issues"": [{""code"": ""E215"", ""text"": ""whitespace before '('"", ""line"": ""print (\""Learn Python to be great!\"")"", ""line_number"": 1, ""column_number"": 6, ""category"": ""CODE_STYLE"", ""influence_on_penalty"": 0}]} +",python3,MODERATE,"{""quality"": {""code"": ""MODERATE"", ""text"": ""Code quality (beta): MODERATE""}, ""issues"": [{""code"": ""E215"", ""text"": ""whitespace before '('"", ""line"": ""print (\""Learn Python to be great!\"")"", ""line_number"": 1, ""column_number"": 6, ""category"": ""CODE_STYLE"", ""influence_on_penalty"": 0, ""difficulty"": ""EASY""}]} " \ No newline at end of file diff --git a/test/resources/evaluation/common/inspectors/diffs_between_df/new_4.csv b/test/resources/evaluation/common/inspectors/diffs_between_df/new_4.csv index b77ae579..32a594b4 100644 --- a/test/resources/evaluation/common/inspectors/diffs_between_df/new_4.csv +++ b/test/resources/evaluation/common/inspectors/diffs_between_df/new_4.csv @@ -1,10 +1,10 @@ id,time,code,lang,grade,traceback 1,1617455906,"print (""Learn Python to be great!"") -",python3,MODERATE,"{""quality"": {""code"": ""MODERATE"", ""text"": ""Code quality (beta): MODERATE""}, ""issues"": [{""code"": ""E215"", ""text"": ""whitespace before '('"", ""line"": ""print (\""Learn Python to be great!\"")"", ""line_number"": 1, ""column_number"": 6, ""category"": ""CODE_STYLE"", ""influence_on_penalty"": 0},{""code"": ""C0305"", ""text"": ""Trailing newlines"", ""line"": """", ""line_number"": 15, ""column_number"": 1, ""category"": ""CODE_STYLE"", ""influence_on_penalty"": 0},{""code"": ""E211"", ""text"": ""whitespace before '('"", ""line"": ""print (\""Learn Python to be great!\"")"", ""line_number"": 1, ""column_number"": 6, ""category"": ""CODE_STYLE"", ""influence_on_penalty"": 0}]} +",python3,MODERATE,"{""quality"": {""code"": ""MODERATE"", ""text"": ""Code quality (beta): MODERATE""}, ""issues"": [{""code"": ""E215"", ""text"": ""whitespace before '('"", ""line"": ""print (\""Learn Python to be great!\"")"", ""line_number"": 1, ""column_number"": 6, ""category"": ""CODE_STYLE"", ""influence_on_penalty"": 0, ""difficulty"": ""EASY""},{""code"": ""C0305"", ""text"": ""Trailing newlines"", ""line"": """", ""line_number"": 15, ""column_number"": 1, ""category"": ""CODE_STYLE"", ""influence_on_penalty"": 0, ""difficulty"": ""EASY""},{""code"": ""E211"", ""text"": ""whitespace before '('"", ""line"": ""print (\""Learn Python to be great!\"")"", ""line_number"": 1, ""column_number"": 6, ""category"": ""CODE_STYLE"", ""influence_on_penalty"": 0, ""difficulty"": ""EASY""}]} " 2,1617455906,"print (""Learn Python to be great!"") -",python3,GOOD,"{""quality"": {""code"": ""GOOD"", ""text"": ""Code quality (beta): MODERATE""}, ""issues"": [{""code"": ""E215"", ""text"": ""whitespace before '('"", ""line"": ""print (\""Learn Python to be great!\"")"", ""line_number"": 1, ""column_number"": 6, ""category"": ""CODE_STYLE"", ""influence_on_penalty"": 0}]} +",python3,GOOD,"{""quality"": {""code"": ""GOOD"", ""text"": ""Code quality (beta): MODERATE""}, ""issues"": [{""code"": ""E215"", ""text"": ""whitespace before '('"", ""line"": ""print (\""Learn Python to be great!\"")"", ""line_number"": 1, ""column_number"": 6, ""category"": ""CODE_STYLE"", ""influence_on_penalty"": 0, ""difficulty"": ""EASY""}]} " 3,1617455906,"print (""Learn Python to be great!"") -",python3,GOOD,"{""quality"": {""code"": ""GOOD"", ""text"": ""Code quality (beta): MODERATE""}, ""issues"": [{""code"": ""E215"", ""text"": ""whitespace before '('"", ""line"": ""print (\""Learn Python to be great!\"")"", ""line_number"": 1, ""column_number"": 6, ""category"": ""CODE_STYLE"", ""influence_on_penalty"": 0}]} +",python3,GOOD,"{""quality"": {""code"": ""GOOD"", ""text"": ""Code quality (beta): MODERATE""}, ""issues"": [{""code"": ""E215"", ""text"": ""whitespace before '('"", ""line"": ""print (\""Learn Python to be great!\"")"", ""line_number"": 1, ""column_number"": 6, ""category"": ""CODE_STYLE"", ""influence_on_penalty"": 0, ""difficulty"": ""EASY""}]} " \ No newline at end of file diff --git a/test/resources/evaluation/common/inspectors/diffs_between_df/new_5.csv b/test/resources/evaluation/common/inspectors/diffs_between_df/new_5.csv index 98da9077..cf5344c3 100644 --- a/test/resources/evaluation/common/inspectors/diffs_between_df/new_5.csv +++ b/test/resources/evaluation/common/inspectors/diffs_between_df/new_5.csv @@ -1,10 +1,10 @@ id,time,code,lang,grade,traceback 1,1617455906,"print (""Learn Python to be great!"") -",python3,MODERATE,"{""quality"": {""code"": ""MODERATE"", ""text"": ""Code quality (beta): MODERATE""}, ""issues"": [{""code"": ""E215"", ""text"": ""whitespace before '('"", ""line"": ""print (\""Learn Python to be great!\"")"", ""line_number"": 1, ""column_number"": 6, ""category"": ""CODE_STYLE"", ""influence_on_penalty"": 0}]} +",python3,MODERATE,"{""quality"": {""code"": ""MODERATE"", ""text"": ""Code quality (beta): MODERATE""}, ""issues"": [{""code"": ""E215"", ""text"": ""whitespace before '('"", ""line"": ""print (\""Learn Python to be great!\"")"", ""line_number"": 1, ""column_number"": 6, ""category"": ""CODE_STYLE"", ""influence_on_penalty"": 0, ""difficulty"": ""EASY""}]} " 2,1617455906,"print (""Learn Python to be great!"") -",python3,BAD,"{""quality"": {""code"": ""BAD"", ""text"": ""Code quality (beta): MODERATE""}, ""issues"": [{""code"": ""E215"", ""text"": ""whitespace before '('"", ""line"": ""print (\""Learn Python to be great!\"")"", ""line_number"": 1, ""column_number"": 6, ""category"": ""CODE_STYLE"", ""influence_on_penalty"": 0}]} +",python3,BAD,"{""quality"": {""code"": ""BAD"", ""text"": ""Code quality (beta): MODERATE""}, ""issues"": [{""code"": ""E215"", ""text"": ""whitespace before '('"", ""line"": ""print (\""Learn Python to be great!\"")"", ""line_number"": 1, ""column_number"": 6, ""category"": ""CODE_STYLE"", ""influence_on_penalty"": 0, ""difficulty"": ""EASY""}]} " 3,1617455906,"print (""Learn Python to be great!"") -",python3,BAD,"{""quality"": {""code"": ""BAD"", ""text"": ""Code quality (beta): MODERATE""}, ""issues"": [{""code"": ""E215"", ""text"": ""whitespace before '('"", ""line"": ""print (\""Learn Python to be great!\"")"", ""line_number"": 1, ""column_number"": 6, ""category"": ""CODE_STYLE"", ""influence_on_penalty"": 0}]} +",python3,BAD,"{""quality"": {""code"": ""BAD"", ""text"": ""Code quality (beta): MODERATE""}, ""issues"": [{""code"": ""E215"", ""text"": ""whitespace before '('"", ""line"": ""print (\""Learn Python to be great!\"")"", ""line_number"": 1, ""column_number"": 6, ""category"": ""CODE_STYLE"", ""influence_on_penalty"": 0, ""difficulty"": ""EASY""}]} " \ No newline at end of file diff --git a/test/resources/evaluation/common/inspectors/diffs_between_df/old_1.csv b/test/resources/evaluation/common/inspectors/diffs_between_df/old_1.csv index c415b91a..466ee3a1 100644 --- a/test/resources/evaluation/common/inspectors/diffs_between_df/old_1.csv +++ b/test/resources/evaluation/common/inspectors/diffs_between_df/old_1.csv @@ -1,10 +1,10 @@ id,time,code,lang,grade,traceback 1,1617455906,"print (""Learn Python to be great!"") -",python3,MODERATE,"{""quality"": {""code"": ""MODERATE"", ""text"": ""Code quality (beta): MODERATE""}, ""issues"": [{""code"": ""E215"", ""text"": ""whitespace before '('"", ""line"": ""print (\""Learn Python to be great!\"")"", ""line_number"": 1, ""column_number"": 6, ""category"": ""CODE_STYLE"", ""influence_on_penalty"": 0}]} +",python3,MODERATE,"{""quality"": {""code"": ""MODERATE"", ""text"": ""Code quality (beta): MODERATE""}, ""issues"": [{""code"": ""E215"", ""text"": ""whitespace before '('"", ""line"": ""print (\""Learn Python to be great!\"")"", ""line_number"": 1, ""column_number"": 6, ""category"": ""CODE_STYLE"", ""influence_on_penalty"": 0, ""difficulty"": ""EASY""}]} " 2,1617455906,"print (""Learn Python to be great!"") -",python3,MODERATE,"{""quality"": {""code"": ""MODERATE"", ""text"": ""Code quality (beta): MODERATE""}, ""issues"": [{""code"": ""E215"", ""text"": ""whitespace before '('"", ""line"": ""print (\""Learn Python to be great!\"")"", ""line_number"": 1, ""column_number"": 6, ""category"": ""CODE_STYLE"", ""influence_on_penalty"": 0}]} +",python3,MODERATE,"{""quality"": {""code"": ""MODERATE"", ""text"": ""Code quality (beta): MODERATE""}, ""issues"": [{""code"": ""E215"", ""text"": ""whitespace before '('"", ""line"": ""print (\""Learn Python to be great!\"")"", ""line_number"": 1, ""column_number"": 6, ""category"": ""CODE_STYLE"", ""influence_on_penalty"": 0, ""difficulty"": ""EASY""}]} " 3,1617455906,"print (""Learn Python to be great!"") -",python3,MODERATE,"{""quality"": {""code"": ""MODERATE"", ""text"": ""Code quality (beta): MODERATE""}, ""issues"": [{""code"": ""E215"", ""text"": ""whitespace before '('"", ""line"": ""print (\""Learn Python to be great!\"")"", ""line_number"": 1, ""column_number"": 6, ""category"": ""CODE_STYLE"", ""influence_on_penalty"": 0}]} +",python3,MODERATE,"{""quality"": {""code"": ""MODERATE"", ""text"": ""Code quality (beta): MODERATE""}, ""issues"": [{""code"": ""E215"", ""text"": ""whitespace before '('"", ""line"": ""print (\""Learn Python to be great!\"")"", ""line_number"": 1, ""column_number"": 6, ""category"": ""CODE_STYLE"", ""influence_on_penalty"": 0, ""difficulty"": ""EASY""}]} " \ No newline at end of file diff --git a/test/resources/evaluation/common/inspectors/diffs_between_df/old_2.csv b/test/resources/evaluation/common/inspectors/diffs_between_df/old_2.csv index c415b91a..466ee3a1 100644 --- a/test/resources/evaluation/common/inspectors/diffs_between_df/old_2.csv +++ b/test/resources/evaluation/common/inspectors/diffs_between_df/old_2.csv @@ -1,10 +1,10 @@ id,time,code,lang,grade,traceback 1,1617455906,"print (""Learn Python to be great!"") -",python3,MODERATE,"{""quality"": {""code"": ""MODERATE"", ""text"": ""Code quality (beta): MODERATE""}, ""issues"": [{""code"": ""E215"", ""text"": ""whitespace before '('"", ""line"": ""print (\""Learn Python to be great!\"")"", ""line_number"": 1, ""column_number"": 6, ""category"": ""CODE_STYLE"", ""influence_on_penalty"": 0}]} +",python3,MODERATE,"{""quality"": {""code"": ""MODERATE"", ""text"": ""Code quality (beta): MODERATE""}, ""issues"": [{""code"": ""E215"", ""text"": ""whitespace before '('"", ""line"": ""print (\""Learn Python to be great!\"")"", ""line_number"": 1, ""column_number"": 6, ""category"": ""CODE_STYLE"", ""influence_on_penalty"": 0, ""difficulty"": ""EASY""}]} " 2,1617455906,"print (""Learn Python to be great!"") -",python3,MODERATE,"{""quality"": {""code"": ""MODERATE"", ""text"": ""Code quality (beta): MODERATE""}, ""issues"": [{""code"": ""E215"", ""text"": ""whitespace before '('"", ""line"": ""print (\""Learn Python to be great!\"")"", ""line_number"": 1, ""column_number"": 6, ""category"": ""CODE_STYLE"", ""influence_on_penalty"": 0}]} +",python3,MODERATE,"{""quality"": {""code"": ""MODERATE"", ""text"": ""Code quality (beta): MODERATE""}, ""issues"": [{""code"": ""E215"", ""text"": ""whitespace before '('"", ""line"": ""print (\""Learn Python to be great!\"")"", ""line_number"": 1, ""column_number"": 6, ""category"": ""CODE_STYLE"", ""influence_on_penalty"": 0, ""difficulty"": ""EASY""}]} " 3,1617455906,"print (""Learn Python to be great!"") -",python3,MODERATE,"{""quality"": {""code"": ""MODERATE"", ""text"": ""Code quality (beta): MODERATE""}, ""issues"": [{""code"": ""E215"", ""text"": ""whitespace before '('"", ""line"": ""print (\""Learn Python to be great!\"")"", ""line_number"": 1, ""column_number"": 6, ""category"": ""CODE_STYLE"", ""influence_on_penalty"": 0}]} +",python3,MODERATE,"{""quality"": {""code"": ""MODERATE"", ""text"": ""Code quality (beta): MODERATE""}, ""issues"": [{""code"": ""E215"", ""text"": ""whitespace before '('"", ""line"": ""print (\""Learn Python to be great!\"")"", ""line_number"": 1, ""column_number"": 6, ""category"": ""CODE_STYLE"", ""influence_on_penalty"": 0, ""difficulty"": ""EASY""}]} " \ No newline at end of file diff --git a/test/resources/evaluation/common/inspectors/diffs_between_df/old_3.csv b/test/resources/evaluation/common/inspectors/diffs_between_df/old_3.csv index c415b91a..466ee3a1 100644 --- a/test/resources/evaluation/common/inspectors/diffs_between_df/old_3.csv +++ b/test/resources/evaluation/common/inspectors/diffs_between_df/old_3.csv @@ -1,10 +1,10 @@ id,time,code,lang,grade,traceback 1,1617455906,"print (""Learn Python to be great!"") -",python3,MODERATE,"{""quality"": {""code"": ""MODERATE"", ""text"": ""Code quality (beta): MODERATE""}, ""issues"": [{""code"": ""E215"", ""text"": ""whitespace before '('"", ""line"": ""print (\""Learn Python to be great!\"")"", ""line_number"": 1, ""column_number"": 6, ""category"": ""CODE_STYLE"", ""influence_on_penalty"": 0}]} +",python3,MODERATE,"{""quality"": {""code"": ""MODERATE"", ""text"": ""Code quality (beta): MODERATE""}, ""issues"": [{""code"": ""E215"", ""text"": ""whitespace before '('"", ""line"": ""print (\""Learn Python to be great!\"")"", ""line_number"": 1, ""column_number"": 6, ""category"": ""CODE_STYLE"", ""influence_on_penalty"": 0, ""difficulty"": ""EASY""}]} " 2,1617455906,"print (""Learn Python to be great!"") -",python3,MODERATE,"{""quality"": {""code"": ""MODERATE"", ""text"": ""Code quality (beta): MODERATE""}, ""issues"": [{""code"": ""E215"", ""text"": ""whitespace before '('"", ""line"": ""print (\""Learn Python to be great!\"")"", ""line_number"": 1, ""column_number"": 6, ""category"": ""CODE_STYLE"", ""influence_on_penalty"": 0}]} +",python3,MODERATE,"{""quality"": {""code"": ""MODERATE"", ""text"": ""Code quality (beta): MODERATE""}, ""issues"": [{""code"": ""E215"", ""text"": ""whitespace before '('"", ""line"": ""print (\""Learn Python to be great!\"")"", ""line_number"": 1, ""column_number"": 6, ""category"": ""CODE_STYLE"", ""influence_on_penalty"": 0, ""difficulty"": ""EASY""}]} " 3,1617455906,"print (""Learn Python to be great!"") -",python3,MODERATE,"{""quality"": {""code"": ""MODERATE"", ""text"": ""Code quality (beta): MODERATE""}, ""issues"": [{""code"": ""E215"", ""text"": ""whitespace before '('"", ""line"": ""print (\""Learn Python to be great!\"")"", ""line_number"": 1, ""column_number"": 6, ""category"": ""CODE_STYLE"", ""influence_on_penalty"": 0}]} +",python3,MODERATE,"{""quality"": {""code"": ""MODERATE"", ""text"": ""Code quality (beta): MODERATE""}, ""issues"": [{""code"": ""E215"", ""text"": ""whitespace before '('"", ""line"": ""print (\""Learn Python to be great!\"")"", ""line_number"": 1, ""column_number"": 6, ""category"": ""CODE_STYLE"", ""influence_on_penalty"": 0, ""difficulty"": ""EASY""}]} " \ No newline at end of file diff --git a/test/resources/evaluation/common/inspectors/diffs_between_df/old_4.csv b/test/resources/evaluation/common/inspectors/diffs_between_df/old_4.csv index c415b91a..466ee3a1 100644 --- a/test/resources/evaluation/common/inspectors/diffs_between_df/old_4.csv +++ b/test/resources/evaluation/common/inspectors/diffs_between_df/old_4.csv @@ -1,10 +1,10 @@ id,time,code,lang,grade,traceback 1,1617455906,"print (""Learn Python to be great!"") -",python3,MODERATE,"{""quality"": {""code"": ""MODERATE"", ""text"": ""Code quality (beta): MODERATE""}, ""issues"": [{""code"": ""E215"", ""text"": ""whitespace before '('"", ""line"": ""print (\""Learn Python to be great!\"")"", ""line_number"": 1, ""column_number"": 6, ""category"": ""CODE_STYLE"", ""influence_on_penalty"": 0}]} +",python3,MODERATE,"{""quality"": {""code"": ""MODERATE"", ""text"": ""Code quality (beta): MODERATE""}, ""issues"": [{""code"": ""E215"", ""text"": ""whitespace before '('"", ""line"": ""print (\""Learn Python to be great!\"")"", ""line_number"": 1, ""column_number"": 6, ""category"": ""CODE_STYLE"", ""influence_on_penalty"": 0, ""difficulty"": ""EASY""}]} " 2,1617455906,"print (""Learn Python to be great!"") -",python3,MODERATE,"{""quality"": {""code"": ""MODERATE"", ""text"": ""Code quality (beta): MODERATE""}, ""issues"": [{""code"": ""E215"", ""text"": ""whitespace before '('"", ""line"": ""print (\""Learn Python to be great!\"")"", ""line_number"": 1, ""column_number"": 6, ""category"": ""CODE_STYLE"", ""influence_on_penalty"": 0}]} +",python3,MODERATE,"{""quality"": {""code"": ""MODERATE"", ""text"": ""Code quality (beta): MODERATE""}, ""issues"": [{""code"": ""E215"", ""text"": ""whitespace before '('"", ""line"": ""print (\""Learn Python to be great!\"")"", ""line_number"": 1, ""column_number"": 6, ""category"": ""CODE_STYLE"", ""influence_on_penalty"": 0, ""difficulty"": ""EASY""}]} " 3,1617455906,"print (""Learn Python to be great!"") -",python3,MODERATE,"{""quality"": {""code"": ""MODERATE"", ""text"": ""Code quality (beta): MODERATE""}, ""issues"": [{""code"": ""E215"", ""text"": ""whitespace before '('"", ""line"": ""print (\""Learn Python to be great!\"")"", ""line_number"": 1, ""column_number"": 6, ""category"": ""CODE_STYLE"", ""influence_on_penalty"": 0}]} +",python3,MODERATE,"{""quality"": {""code"": ""MODERATE"", ""text"": ""Code quality (beta): MODERATE""}, ""issues"": [{""code"": ""E215"", ""text"": ""whitespace before '('"", ""line"": ""print (\""Learn Python to be great!\"")"", ""line_number"": 1, ""column_number"": 6, ""category"": ""CODE_STYLE"", ""influence_on_penalty"": 0, ""difficulty"": ""EASY""}]} " \ No newline at end of file diff --git a/test/resources/evaluation/common/inspectors/diffs_between_df/old_5.csv b/test/resources/evaluation/common/inspectors/diffs_between_df/old_5.csv index c415b91a..466ee3a1 100644 --- a/test/resources/evaluation/common/inspectors/diffs_between_df/old_5.csv +++ b/test/resources/evaluation/common/inspectors/diffs_between_df/old_5.csv @@ -1,10 +1,10 @@ id,time,code,lang,grade,traceback 1,1617455906,"print (""Learn Python to be great!"") -",python3,MODERATE,"{""quality"": {""code"": ""MODERATE"", ""text"": ""Code quality (beta): MODERATE""}, ""issues"": [{""code"": ""E215"", ""text"": ""whitespace before '('"", ""line"": ""print (\""Learn Python to be great!\"")"", ""line_number"": 1, ""column_number"": 6, ""category"": ""CODE_STYLE"", ""influence_on_penalty"": 0}]} +",python3,MODERATE,"{""quality"": {""code"": ""MODERATE"", ""text"": ""Code quality (beta): MODERATE""}, ""issues"": [{""code"": ""E215"", ""text"": ""whitespace before '('"", ""line"": ""print (\""Learn Python to be great!\"")"", ""line_number"": 1, ""column_number"": 6, ""category"": ""CODE_STYLE"", ""influence_on_penalty"": 0, ""difficulty"": ""EASY""}]} " 2,1617455906,"print (""Learn Python to be great!"") -",python3,MODERATE,"{""quality"": {""code"": ""MODERATE"", ""text"": ""Code quality (beta): MODERATE""}, ""issues"": [{""code"": ""E215"", ""text"": ""whitespace before '('"", ""line"": ""print (\""Learn Python to be great!\"")"", ""line_number"": 1, ""column_number"": 6, ""category"": ""CODE_STYLE"", ""influence_on_penalty"": 0}]} +",python3,MODERATE,"{""quality"": {""code"": ""MODERATE"", ""text"": ""Code quality (beta): MODERATE""}, ""issues"": [{""code"": ""E215"", ""text"": ""whitespace before '('"", ""line"": ""print (\""Learn Python to be great!\"")"", ""line_number"": 1, ""column_number"": 6, ""category"": ""CODE_STYLE"", ""influence_on_penalty"": 0, ""difficulty"": ""EASY""}]} " 3,1617455906,"print (""Learn Python to be great!"") -",python3,MODERATE,"{""quality"": {""code"": ""MODERATE"", ""text"": ""Code quality (beta): MODERATE""}, ""issues"": [{""code"": ""E215"", ""text"": ""whitespace before '('"", ""line"": ""print (\""Learn Python to be great!\"")"", ""line_number"": 1, ""column_number"": 6, ""category"": ""CODE_STYLE"", ""influence_on_penalty"": 0}]} +",python3,MODERATE,"{""quality"": {""code"": ""MODERATE"", ""text"": ""Code quality (beta): MODERATE""}, ""issues"": [{""code"": ""E215"", ""text"": ""whitespace before '('"", ""line"": ""print (\""Learn Python to be great!\"")"", ""line_number"": 1, ""column_number"": 6, ""category"": ""CODE_STYLE"", ""influence_on_penalty"": 0, ""difficulty"": ""EASY""}]} " \ No newline at end of file diff --git a/test/resources/evaluation/issues_statistics/get_raw_issues/target_files/target_fragment_per_language.csv b/test/resources/evaluation/issues_statistics/get_raw_issues/target_files/target_fragment_per_language.csv index aab03d07..fc35e03f 100644 --- a/test/resources/evaluation/issues_statistics/get_raw_issues/target_files/target_fragment_per_language.csv +++ b/test/resources/evaluation/issues_statistics/get_raw_issues/target_files/target_fragment_per_language.csv @@ -126,7 +126,7 @@ public class Main { } } } -","[{""origin_class"": ""CyclomaticComplexityCheck"", ""type"": ""CYCLOMATIC_COMPLEXITY"", ""description"": ""Too complex function. You can figure out how to simplify this code or split it into a set of small functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 9, ""column_no"": 9, ""inspector_type"": ""CHECKSTYLE"", ""measure"": 1}, {""origin_class"": ""JavaNCSSCheck"", ""type"": ""FUNC_LEN"", ""description"": ""Too long function. Try to split it into smaller functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 9, ""column_no"": 9, ""inspector_type"": ""CHECKSTYLE"", ""measure"": 3}, {""origin_class"": ""CyclomaticComplexityCheck"", ""type"": ""CYCLOMATIC_COMPLEXITY"", ""description"": ""Too complex function. You can figure out how to simplify this code or split it into a set of small functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 14, ""column_no"": 9, ""inspector_type"": ""CHECKSTYLE"", ""measure"": 1}, {""origin_class"": ""JavaNCSSCheck"", ""type"": ""FUNC_LEN"", ""description"": ""Too long function. Try to split it into smaller functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 14, ""column_no"": 9, ""inspector_type"": ""CHECKSTYLE"", ""measure"": 2}, {""origin_class"": ""CyclomaticComplexityCheck"", ""type"": ""CYCLOMATIC_COMPLEXITY"", ""description"": ""Too complex function. You can figure out how to simplify this code or split it into a set of small functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 18, ""column_no"": 9, ""inspector_type"": ""CHECKSTYLE"", ""measure"": 1}, {""origin_class"": ""JavaNCSSCheck"", ""type"": ""FUNC_LEN"", ""description"": ""Too long function. Try to split it into smaller functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 18, ""column_no"": 9, ""inspector_type"": ""CHECKSTYLE"", ""measure"": 2}, {""origin_class"": ""CyclomaticComplexityCheck"", ""type"": ""CYCLOMATIC_COMPLEXITY"", ""description"": ""Too complex function. You can figure out how to simplify this code or split it into a set of small functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 27, ""column_no"": 9, ""inspector_type"": ""CHECKSTYLE"", ""measure"": 1}, {""origin_class"": ""JavaNCSSCheck"", ""type"": ""FUNC_LEN"", ""description"": ""Too long function. Try to split it into smaller functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 27, ""column_no"": 9, ""inspector_type"": ""CHECKSTYLE"", ""measure"": 3}, {""origin_class"": ""CyclomaticComplexityCheck"", ""type"": ""CYCLOMATIC_COMPLEXITY"", ""description"": ""Too complex function. You can figure out how to simplify this code or split it into a set of small functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 32, ""column_no"": 9, ""inspector_type"": ""CHECKSTYLE"", ""measure"": 2}, {""origin_class"": ""JavaNCSSCheck"", ""type"": ""FUNC_LEN"", ""description"": ""Too long function. Try to split it into smaller functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 32, ""column_no"": 9, ""inspector_type"": ""CHECKSTYLE"", ""measure"": 8}, {""origin_class"": ""CyclomaticComplexityCheck"", ""type"": ""CYCLOMATIC_COMPLEXITY"", ""description"": ""Too complex function. You can figure out how to simplify this code or split it into a set of small functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 45, ""column_no"": 9, ""inspector_type"": ""CHECKSTYLE"", ""measure"": 3}, {""origin_class"": ""JavaNCSSCheck"", ""type"": ""FUNC_LEN"", ""description"": ""Too long function. Try to split it into smaller functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 45, ""column_no"": 9, ""inspector_type"": ""CHECKSTYLE"", ""measure"": 5}, {""origin_class"": ""BooleanExpressionComplexityCheck"", ""type"": ""BOOL_EXPR_LEN"", ""description"": ""Too long boolean expression. Try to split it into smaller expressions."", ""file_path"": """", ""line_no"": 48, ""column_no"": 13, ""inspector_type"": ""CHECKSTYLE"", ""measure"": 1}, {""origin_class"": ""CyclomaticComplexityCheck"", ""type"": ""CYCLOMATIC_COMPLEXITY"", ""description"": ""Too complex function. You can figure out how to simplify this code or split it into a set of small functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 55, ""column_no"": 9, ""inspector_type"": ""CHECKSTYLE"", ""measure"": 1}, {""origin_class"": ""JavaNCSSCheck"", ""type"": ""FUNC_LEN"", ""description"": ""Too long function. Try to split it into smaller functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 55, ""column_no"": 9, ""inspector_type"": ""CHECKSTYLE"", ""measure"": 2}, {""origin_class"": ""CyclomaticComplexityCheck"", ""type"": ""CYCLOMATIC_COMPLEXITY"", ""description"": ""Too complex function. You can figure out how to simplify this code or split it into a set of small functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 59, ""column_no"": 9, ""inspector_type"": ""CHECKSTYLE"", ""measure"": 4}, {""origin_class"": ""JavaNCSSCheck"", ""type"": ""FUNC_LEN"", ""description"": ""Too long function. Try to split it into smaller functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 59, ""column_no"": 9, ""inspector_type"": ""CHECKSTYLE"", ""measure"": 7}, {""origin_class"": ""BooleanExpressionComplexityCheck"", ""type"": ""BOOL_EXPR_LEN"", ""description"": ""Too long boolean expression. Try to split it into smaller expressions."", ""file_path"": """", ""line_no"": 62, ""column_no"": 13, ""inspector_type"": ""CHECKSTYLE"", ""measure"": 1}, {""origin_class"": ""JavaNCSSCheck"", ""type"": ""FUNC_LEN"", ""description"": ""Too long function. Try to split it into smaller functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 73, ""column_no"": 9, ""inspector_type"": ""CHECKSTYLE"", ""measure"": 6}, {""origin_class"": ""CyclomaticComplexityCheck"", ""type"": ""CYCLOMATIC_COMPLEXITY"", ""description"": ""Too complex function. You can figure out how to simplify this code or split it into a set of small functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 73, ""column_no"": 9, ""inspector_type"": ""CHECKSTYLE"", ""measure"": 2}, {""origin_class"": ""UnusedPrivateMethod"", ""type"": ""BEST_PRACTICES"", ""description"": ""Avoid unused private methods such as 'rehash()'."", ""file_path"": """", ""line_no"": 73, ""column_no"": 1, ""inspector_type"": ""PMD""}, {""origin_class"": ""CyclomaticComplexityCheck"", ""type"": ""CYCLOMATIC_COMPLEXITY"", ""description"": ""Too complex function. You can figure out how to simplify this code or split it into a set of small functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 84, ""column_no"": 9, ""inspector_type"": ""CHECKSTYLE"", ""measure"": 4}, {""origin_class"": ""JavaNCSSCheck"", ""type"": ""FUNC_LEN"", ""description"": ""Too long function. Try to split it into smaller functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 84, ""column_no"": 9, ""inspector_type"": ""CHECKSTYLE"", ""measure"": 10}, {""origin_class"": ""CyclomaticComplexityCheck"", ""type"": ""CYCLOMATIC_COMPLEXITY"", ""description"": ""Too complex function. You can figure out how to simplify this code or split it into a set of small functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 105, ""column_no"": 5, ""inspector_type"": ""CHECKSTYLE"", ""measure"": 4}, {""origin_class"": ""JavaNCSSCheck"", ""type"": ""FUNC_LEN"", ""description"": ""Too long function. Try to split it into smaller functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 105, ""column_no"": 5, ""inspector_type"": ""CHECKSTYLE"", ""measure"": 18}, {""origin_class"": ""MissingSwitchDefaultCheck"", ""type"": ""ERROR_PRONE"", ""description"": ""switch without \""default\"" clause."", ""file_path"": """", ""line_no"": 112, ""column_no"": 13, ""inspector_type"": ""CHECKSTYLE""}, {""origin_class"": ""NoWhitespaceAfterCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'-' is followed by whitespace."", ""file_path"": """", ""line_no"": 118, ""column_no"": 54, ""inspector_type"": ""CHECKSTYLE""}, {""origin_class"": ""WhitespaceAroundCheck"", ""type"": ""CODE_STYLE"", ""description"": ""':' is not preceded with whitespace."", ""file_path"": """", ""line_no"": 118, ""column_no"": 57, ""inspector_type"": ""CHECKSTYLE""}, {""origin_class"": ""InefficientStringBuffering"", ""type"": ""BEST_PRACTICES"", ""description"": ""Avoid concatenating nonliterals in a StringBuffer/StringBuilder constructor or append()."", ""file_path"": """", ""line_no"": 90, ""column_no"": 1, ""inspector_type"": ""PMD""}, {""origin_class"": ""InefficientStringBuffering"", ""type"": ""BEST_PRACTICES"", ""description"": ""Avoid concatenating nonliterals in a StringBuffer/StringBuilder constructor or append()."", ""file_path"": """", ""line_no"": 92, ""column_no"": 1, ""inspector_type"": ""PMD""}]" +","[{""origin_class"": ""CyclomaticComplexityCheck"", ""type"": ""CYCLOMATIC_COMPLEXITY"", ""description"": ""Too complex function. You can figure out how to simplify this code or split it into a set of small functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 9, ""column_no"": 9, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""HARD"", ""measure"": 1}, {""origin_class"": ""JavaNCSSCheck"", ""type"": ""FUNC_LEN"", ""description"": ""Too long function. Try to split it into smaller functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 9, ""column_no"": 9, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY"", ""measure"": 3}, {""origin_class"": ""CyclomaticComplexityCheck"", ""type"": ""CYCLOMATIC_COMPLEXITY"", ""description"": ""Too complex function. You can figure out how to simplify this code or split it into a set of small functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 14, ""column_no"": 9, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""HARD"", ""measure"": 1}, {""origin_class"": ""JavaNCSSCheck"", ""type"": ""FUNC_LEN"", ""description"": ""Too long function. Try to split it into smaller functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 14, ""column_no"": 9, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY"", ""measure"": 2}, {""origin_class"": ""CyclomaticComplexityCheck"", ""type"": ""CYCLOMATIC_COMPLEXITY"", ""description"": ""Too complex function. You can figure out how to simplify this code or split it into a set of small functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 18, ""column_no"": 9, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""HARD"", ""measure"": 1}, {""origin_class"": ""JavaNCSSCheck"", ""type"": ""FUNC_LEN"", ""description"": ""Too long function. Try to split it into smaller functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 18, ""column_no"": 9, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY"", ""measure"": 2}, {""origin_class"": ""CyclomaticComplexityCheck"", ""type"": ""CYCLOMATIC_COMPLEXITY"", ""description"": ""Too complex function. You can figure out how to simplify this code or split it into a set of small functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 27, ""column_no"": 9, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""HARD"", ""measure"": 1}, {""origin_class"": ""JavaNCSSCheck"", ""type"": ""FUNC_LEN"", ""description"": ""Too long function. Try to split it into smaller functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 27, ""column_no"": 9, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY"", ""measure"": 3}, {""origin_class"": ""CyclomaticComplexityCheck"", ""type"": ""CYCLOMATIC_COMPLEXITY"", ""description"": ""Too complex function. You can figure out how to simplify this code or split it into a set of small functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 32, ""column_no"": 9, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""HARD"", ""measure"": 2}, {""origin_class"": ""JavaNCSSCheck"", ""type"": ""FUNC_LEN"", ""description"": ""Too long function. Try to split it into smaller functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 32, ""column_no"": 9, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY"", ""measure"": 8}, {""origin_class"": ""CyclomaticComplexityCheck"", ""type"": ""CYCLOMATIC_COMPLEXITY"", ""description"": ""Too complex function. You can figure out how to simplify this code or split it into a set of small functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 45, ""column_no"": 9, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""HARD"", ""measure"": 3}, {""origin_class"": ""JavaNCSSCheck"", ""type"": ""FUNC_LEN"", ""description"": ""Too long function. Try to split it into smaller functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 45, ""column_no"": 9, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY"", ""measure"": 5}, {""origin_class"": ""BooleanExpressionComplexityCheck"", ""type"": ""BOOL_EXPR_LEN"", ""description"": ""Too long boolean expression. Try to split it into smaller expressions."", ""file_path"": """", ""line_no"": 48, ""column_no"": 13, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY"", ""measure"": 1}, {""origin_class"": ""CyclomaticComplexityCheck"", ""type"": ""CYCLOMATIC_COMPLEXITY"", ""description"": ""Too complex function. You can figure out how to simplify this code or split it into a set of small functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 55, ""column_no"": 9, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""HARD"", ""measure"": 1}, {""origin_class"": ""JavaNCSSCheck"", ""type"": ""FUNC_LEN"", ""description"": ""Too long function. Try to split it into smaller functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 55, ""column_no"": 9, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY"", ""measure"": 2}, {""origin_class"": ""CyclomaticComplexityCheck"", ""type"": ""CYCLOMATIC_COMPLEXITY"", ""description"": ""Too complex function. You can figure out how to simplify this code or split it into a set of small functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 59, ""column_no"": 9, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""HARD"", ""measure"": 4}, {""origin_class"": ""JavaNCSSCheck"", ""type"": ""FUNC_LEN"", ""description"": ""Too long function. Try to split it into smaller functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 59, ""column_no"": 9, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY"", ""measure"": 7}, {""origin_class"": ""BooleanExpressionComplexityCheck"", ""type"": ""BOOL_EXPR_LEN"", ""description"": ""Too long boolean expression. Try to split it into smaller expressions."", ""file_path"": """", ""line_no"": 62, ""column_no"": 13, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY"", ""measure"": 1}, {""origin_class"": ""JavaNCSSCheck"", ""type"": ""FUNC_LEN"", ""description"": ""Too long function. Try to split it into smaller functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 73, ""column_no"": 9, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY"", ""measure"": 6}, {""origin_class"": ""CyclomaticComplexityCheck"", ""type"": ""CYCLOMATIC_COMPLEXITY"", ""description"": ""Too complex function. You can figure out how to simplify this code or split it into a set of small functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 73, ""column_no"": 9, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""HARD"", ""measure"": 2}, {""origin_class"": ""UnusedPrivateMethod"", ""type"": ""BEST_PRACTICES"", ""description"": ""Avoid unused private methods such as 'rehash()'."", ""file_path"": """", ""line_no"": 73, ""column_no"": 1, ""inspector_type"": ""PMD"", ""difficulty"": ""MEDIUM""}, {""origin_class"": ""CyclomaticComplexityCheck"", ""type"": ""CYCLOMATIC_COMPLEXITY"", ""description"": ""Too complex function. You can figure out how to simplify this code or split it into a set of small functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 84, ""column_no"": 9, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""HARD"", ""measure"": 4}, {""origin_class"": ""JavaNCSSCheck"", ""type"": ""FUNC_LEN"", ""description"": ""Too long function. Try to split it into smaller functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 84, ""column_no"": 9, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY"", ""measure"": 10}, {""origin_class"": ""CyclomaticComplexityCheck"", ""type"": ""CYCLOMATIC_COMPLEXITY"", ""description"": ""Too complex function. You can figure out how to simplify this code or split it into a set of small functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 105, ""column_no"": 5, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""HARD"", ""measure"": 4}, {""origin_class"": ""JavaNCSSCheck"", ""type"": ""FUNC_LEN"", ""description"": ""Too long function. Try to split it into smaller functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 105, ""column_no"": 5, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY"", ""measure"": 18}, {""origin_class"": ""MissingSwitchDefaultCheck"", ""type"": ""ERROR_PRONE"", ""description"": ""switch without \""default\"" clause."", ""file_path"": """", ""line_no"": 112, ""column_no"": 13, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""HARD""}, {""origin_class"": ""NoWhitespaceAfterCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'-' is followed by whitespace."", ""file_path"": """", ""line_no"": 118, ""column_no"": 54, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY""}, {""origin_class"": ""WhitespaceAroundCheck"", ""type"": ""CODE_STYLE"", ""description"": ""':' is not preceded with whitespace."", ""file_path"": """", ""line_no"": 118, ""column_no"": 57, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY""}, {""origin_class"": ""InefficientStringBuffering"", ""type"": ""BEST_PRACTICES"", ""description"": ""Avoid concatenating nonliterals in a StringBuffer/StringBuilder constructor or append()."", ""file_path"": """", ""line_no"": 90, ""column_no"": 1, ""inspector_type"": ""PMD"", ""difficulty"": ""MEDIUM""}, {""origin_class"": ""InefficientStringBuffering"", ""type"": ""BEST_PRACTICES"", ""description"": ""Avoid concatenating nonliterals in a StringBuffer/StringBuilder constructor or append()."", ""file_path"": """", ""line_no"": 92, ""column_no"": 1, ""inspector_type"": ""PMD"", ""difficulty"": ""MEDIUM""}]" 2760103,kotlin,"import java.util.*; fun main(args: Array) { @@ -136,7 +136,7 @@ fun main(args: Array) { val sqrt = Math.sqrt(Math.sqrt(sq)) println(sqrt) } -","[{""origin_class"": ""LongMethod"", ""type"": ""FUNC_LEN"", ""description"": ""Too long function. Try to split it into smaller functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 3, ""column_no"": 5, ""inspector_type"": ""DETEKT"", ""measure"": 6}, {""origin_class"": ""ComplexMethod"", ""type"": ""CYCLOMATIC_COMPLEXITY"", ""description"": ""Too complex function. You can figure out how to simplify this code or split it into a set of small functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 3, ""column_no"": 5, ""inspector_type"": ""DETEKT"", ""measure"": 1}, {""origin_class"": ""NoSemicolons"", ""type"": ""CODE_STYLE"", ""description"": ""Unnecessary semicolon"", ""file_path"": """", ""line_no"": 1, ""column_no"": 19, ""inspector_type"": ""DETEKT""}]" +","[{""origin_class"": ""LongMethod"", ""type"": ""FUNC_LEN"", ""description"": ""Too long function. Try to split it into smaller functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 3, ""column_no"": 5, ""inspector_type"": ""DETEKT"", ""difficulty"": ""EASY"", ""measure"": 6}, {""origin_class"": ""ComplexMethod"", ""type"": ""CYCLOMATIC_COMPLEXITY"", ""description"": ""Too complex function. You can figure out how to simplify this code or split it into a set of small functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 3, ""column_no"": 5, ""inspector_type"": ""DETEKT"", ""difficulty"": ""HARD"", ""measure"": 1}, {""origin_class"": ""NoSemicolons"", ""type"": ""CODE_STYLE"", ""description"": ""Unnecessary semicolon"", ""file_path"": """", ""line_no"": 1, ""column_no"": 19, ""inspector_type"": ""DETEKT"", ""difficulty"": ""EASY""}]" 2760563,python3,"text = input() words = text.split() for word in words: @@ -155,7 +155,7 @@ for word in words: print(word) else: continue -","[{""origin_class"": ""C901"", ""type"": ""CYCLOMATIC_COMPLEXITY"", ""description"": ""Too complex function. You can figure out how to simplify this code or split it into a set of small functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 3, ""column_no"": 1, ""inspector_type"": ""FLAKE8"", ""measure"": 8}, {""origin_class"": ""WPS327"", ""type"": ""BEST_PRACTICES"", ""description"": ""Found useless `continue` at the end of the loop"", ""file_path"": """", ""line_no"": 3, ""column_no"": 1, ""inspector_type"": ""FLAKE8""}, {""origin_class"": ""WPS223"", ""type"": ""COMPLEXITY"", ""description"": ""Found too many `elif` branches: 5 > 3"", ""file_path"": """", ""line_no"": 5, ""column_no"": 5, ""inspector_type"": ""FLAKE8""}]" +","[{""origin_class"": ""C901"", ""type"": ""CYCLOMATIC_COMPLEXITY"", ""description"": ""Too complex function. You can figure out how to simplify this code or split it into a set of small functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 3, ""column_no"": 1, ""inspector_type"": ""FLAKE8"", ""difficulty"": ""HARD"", ""measure"": 8}, {""origin_class"": ""WPS327"", ""type"": ""BEST_PRACTICES"", ""description"": ""Found useless `continue` at the end of the loop"", ""file_path"": """", ""line_no"": 3, ""column_no"": 1, ""inspector_type"": ""FLAKE8"", ""difficulty"": ""MEDIUM""}, {""origin_class"": ""WPS223"", ""type"": ""COMPLEXITY"", ""description"": ""Found too many `elif` branches: 5 > 3"", ""file_path"": """", ""line_no"": 5, ""column_no"": 5, ""inspector_type"": ""FLAKE8"", ""difficulty"": ""HARD""}]" 47580013,javascript,"async function rockBand(str) { return new Promise(function(resolve, reject) { if (str == 'Linkin Park') { @@ -165,4 +165,4 @@ for word in words: } }); } -","[{""origin_class"": ""no-unused-vars"", ""type"": ""CODE_STYLE"", ""description"": ""'rockBand' is defined but never used. (no-unused-vars)"", ""file_path"": """", ""line_no"": 1, ""column_no"": 16, ""inspector_type"": ""ESLINT""}, {""origin_class"": ""no-unused-vars"", ""type"": ""CODE_STYLE"", ""description"": ""'reject' is defined but never used. (no-unused-vars)"", ""file_path"": """", ""line_no"": 2, ""column_no"": 40, ""inspector_type"": ""ESLINT""}, {""origin_class"": ""eqeqeq"", ""type"": ""BEST_PRACTICES"", ""description"": ""Expected '===' and instead saw '=='. (eqeqeq)"", ""file_path"": """", ""line_no"": 3, ""column_no"": 15, ""inspector_type"": ""ESLINT""}]" +","[{""origin_class"": ""no-unused-vars"", ""type"": ""CODE_STYLE"", ""description"": ""'rockBand' is defined but never used. (no-unused-vars)"", ""file_path"": """", ""line_no"": 1, ""column_no"": 16, ""inspector_type"": ""ESLINT"", ""difficulty"": ""EASY""}, {""origin_class"": ""no-unused-vars"", ""type"": ""CODE_STYLE"", ""description"": ""'reject' is defined but never used. (no-unused-vars)"", ""file_path"": """", ""line_no"": 2, ""column_no"": 40, ""inspector_type"": ""ESLINT"", ""difficulty"": ""EASY""}, {""origin_class"": ""eqeqeq"", ""type"": ""BEST_PRACTICES"", ""description"": ""Expected '===' and instead saw '=='. (eqeqeq)"", ""file_path"": """", ""line_no"": 3, ""column_no"": 15, ""inspector_type"": ""ESLINT"", ""difficulty"": ""MEDIUM""}]" diff --git a/test/resources/evaluation/issues_statistics/get_raw_issues/target_files/target_incorrect_language.csv b/test/resources/evaluation/issues_statistics/get_raw_issues/target_files/target_incorrect_language.csv index 70c14e1b..0749f8a7 100644 --- a/test/resources/evaluation/issues_statistics/get_raw_issues/target_files/target_incorrect_language.csv +++ b/test/resources/evaluation/issues_statistics/get_raw_issues/target_files/target_incorrect_language.csv @@ -27,4 +27,4 @@ for word in words: print(word) else: continue -","[{""origin_class"": ""C901"", ""type"": ""CYCLOMATIC_COMPLEXITY"", ""description"": ""Too complex function. You can figure out how to simplify this code or split it into a set of small functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 3, ""column_no"": 1, ""inspector_type"": ""FLAKE8"", ""measure"": 8}, {""origin_class"": ""WPS327"", ""type"": ""BEST_PRACTICES"", ""description"": ""Found useless `continue` at the end of the loop"", ""file_path"": """", ""line_no"": 3, ""column_no"": 1, ""inspector_type"": ""FLAKE8""}, {""origin_class"": ""WPS223"", ""type"": ""COMPLEXITY"", ""description"": ""Found too many `elif` branches: 5 > 3"", ""file_path"": """", ""line_no"": 5, ""column_no"": 5, ""inspector_type"": ""FLAKE8""}]" +","[{""origin_class"": ""C901"", ""type"": ""CYCLOMATIC_COMPLEXITY"", ""description"": ""Too complex function. You can figure out how to simplify this code or split it into a set of small functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 3, ""column_no"": 1, ""inspector_type"": ""FLAKE8"", ""difficulty"": ""HARD"", ""measure"": 8}, {""origin_class"": ""WPS327"", ""type"": ""BEST_PRACTICES"", ""description"": ""Found useless `continue` at the end of the loop"", ""file_path"": """", ""line_no"": 3, ""column_no"": 1, ""inspector_type"": ""FLAKE8"", ""difficulty"": ""MEDIUM""}, {""origin_class"": ""WPS223"", ""type"": ""COMPLEXITY"", ""description"": ""Found too many `elif` branches: 5 > 3"", ""file_path"": """", ""line_no"": 5, ""column_no"": 5, ""inspector_type"": ""FLAKE8"", ""difficulty"": ""HARD""}]" diff --git a/test/resources/evaluation/issues_statistics/get_raw_issues_statistics/test_files/test_df_multi_lang.csv b/test/resources/evaluation/issues_statistics/get_raw_issues_statistics/test_files/test_df_multi_lang.csv index 129a8b51..d01cf2d5 100644 --- a/test/resources/evaluation/issues_statistics/get_raw_issues_statistics/test_files/test_df_multi_lang.csv +++ b/test/resources/evaluation/issues_statistics/get_raw_issues_statistics/test_files/test_df_multi_lang.csv @@ -20,7 +20,7 @@ class Main { System.out.println(""""); } } -}","[{""origin_class"": ""UnusedImportsCheck"", ""type"": ""BEST_PRACTICES"", ""description"": ""Unused import - java.util.Arrays."", ""file_path"": """", ""line_no"": 2, ""column_no"": 8, ""inspector_type"": ""CHECKSTYLE""}, {""origin_class"": ""CyclomaticComplexityCheck"", ""type"": ""CYCLOMATIC_COMPLEXITY"", ""description"": ""Too complex function. You can figure out how to simplify this code or split it into a set of small functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 5, ""column_no"": 5, ""inspector_type"": ""CHECKSTYLE"", ""measure"": 7}, {""origin_class"": ""JavaNCSSCheck"", ""type"": ""FUNC_LEN"", ""description"": ""Too long function. Try to split it into smaller functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 5, ""column_no"": 5, ""inspector_type"": ""CHECKSTYLE"", ""measure"": 11}, {""origin_class"": ""BooleanExpressionComplexityCheck"", ""type"": ""BOOL_EXPR_LEN"", ""description"": ""Too long boolean expression. Try to split it into smaller expressions."", ""file_path"": """", ""line_no"": 14, ""column_no"": 17, ""inspector_type"": ""CHECKSTYLE"", ""measure"": 3}]" +}","[{""origin_class"": ""UnusedImportsCheck"", ""type"": ""BEST_PRACTICES"", ""description"": ""Unused import - java.util.Arrays."", ""file_path"": """", ""line_no"": 2, ""column_no"": 8, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""MEDIUM""}, {""origin_class"": ""CyclomaticComplexityCheck"", ""type"": ""CYCLOMATIC_COMPLEXITY"", ""description"": ""Too complex function. You can figure out how to simplify this code or split it into a set of small functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 5, ""column_no"": 5, ""inspector_type"": ""CHECKSTYLE"", ""measure"": 7, ""difficulty"": ""HARD""}, {""origin_class"": ""JavaNCSSCheck"", ""type"": ""FUNC_LEN"", ""description"": ""Too long function. Try to split it into smaller functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 5, ""column_no"": 5, ""inspector_type"": ""CHECKSTYLE"", ""measure"": 11, ""difficulty"": ""EASY""}, {""origin_class"": ""BooleanExpressionComplexityCheck"", ""type"": ""BOOL_EXPR_LEN"", ""description"": ""Too long boolean expression. Try to split it into smaller expressions."", ""file_path"": """", ""line_no"": 14, ""column_no"": 17, ""inspector_type"": ""CHECKSTYLE"", ""measure"": 3, ""difficulty"": ""EASY""}]" 2,java9,"import java.util.Scanner; public class Main { @@ -56,7 +56,7 @@ public class Main { System.out.println(); } } -}","[{""origin_class"": ""EmptyLineSeparatorCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'CLASS_DEF' should be separated from previous line."", ""file_path"": """", ""line_no"": 2, ""column_no"": 1, ""inspector_type"": ""CHECKSTYLE""}, {""origin_class"": ""CyclomaticComplexityCheck"", ""type"": ""CYCLOMATIC_COMPLEXITY"", ""description"": ""Too complex function. You can figure out how to simplify this code or split it into a set of small functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 4, ""column_no"": 5, ""inspector_type"": ""CHECKSTYLE"", ""measure"": 5}, {""origin_class"": ""JavaNCSSCheck"", ""type"": ""FUNC_LEN"", ""description"": ""Too long function. Try to split it into smaller functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 4, ""column_no"": 5, ""inspector_type"": ""CHECKSTYLE"", ""measure"": 14}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'method def' child has incorrect indentation level 16, expected level should be 8."", ""file_path"": """", ""line_no"": 5, ""column_no"": 17, ""inspector_type"": ""CHECKSTYLE""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'method def' child has incorrect indentation level 16, expected level should be 8."", ""file_path"": """", ""line_no"": 7, ""column_no"": 17, ""inspector_type"": ""CHECKSTYLE""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'method def' child has incorrect indentation level 16, expected level should be 8."", ""file_path"": """", ""line_no"": 8, ""column_no"": 17, ""inspector_type"": ""CHECKSTYLE""}, {""origin_class"": ""ArrayTypeStyleCheck"", ""type"": ""CODE_STYLE"", ""description"": ""Array brackets at illegal position."", ""file_path"": """", ""line_no"": 8, ""column_no"": 24, ""inspector_type"": ""CHECKSTYLE""}, {""origin_class"": ""ArrayTypeStyleCheck"", ""type"": ""CODE_STYLE"", ""description"": ""Array brackets at illegal position."", ""file_path"": """", ""line_no"": 8, ""column_no"": 26, ""inspector_type"": ""CHECKSTYLE""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'method def' child has incorrect indentation level 16, expected level should be 8."", ""file_path"": """", ""line_no"": 9, ""column_no"": 17, ""inspector_type"": ""CHECKSTYLE""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'method def' child has incorrect indentation level 16, expected level should be 8."", ""file_path"": """", ""line_no"": 10, ""column_no"": 17, ""inspector_type"": ""CHECKSTYLE""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'for' has incorrect indentation level 16, expected level should be 8."", ""file_path"": """", ""line_no"": 11, ""column_no"": 17, ""inspector_type"": ""CHECKSTYLE""}, {""origin_class"": ""WhitespaceAfterCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'for' is not followed by whitespace."", ""file_path"": """", ""line_no"": 11, ""column_no"": 17, ""inspector_type"": ""CHECKSTYLE""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'for' child has incorrect indentation level 24, expected level should be 12."", ""file_path"": """", ""line_no"": 12, ""column_no"": 25, ""inspector_type"": ""CHECKSTYLE""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'for rcurly' has incorrect indentation level 16, expected level should be 8."", ""file_path"": """", ""line_no"": 13, ""column_no"": 17, ""inspector_type"": ""CHECKSTYLE""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'for' has incorrect indentation level 16, expected level should be 8."", ""file_path"": """", ""line_no"": 14, ""column_no"": 17, ""inspector_type"": ""CHECKSTYLE""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'for' child has incorrect indentation level 24, expected level should be 12."", ""file_path"": """", ""line_no"": 15, ""column_no"": 25, ""inspector_type"": ""CHECKSTYLE""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'for rcurly' has incorrect indentation level 16, expected level should be 8."", ""file_path"": """", ""line_no"": 16, ""column_no"": 17, ""inspector_type"": ""CHECKSTYLE""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'for' has incorrect indentation level 16, expected level should be 8."", ""file_path"": """", ""line_no"": 17, ""column_no"": 17, ""inspector_type"": ""CHECKSTYLE""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'for' has incorrect indentation level 24, expected level should be 12."", ""file_path"": """", ""line_no"": 18, ""column_no"": 25, ""inspector_type"": ""CHECKSTYLE""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'for' child has incorrect indentation level 32, expected level should be 16."", ""file_path"": """", ""line_no"": 19, ""column_no"": 33, ""inspector_type"": ""CHECKSTYLE""}, {""origin_class"": ""WhitespaceAroundCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'-' is not followed by whitespace."", ""file_path"": """", ""line_no"": 19, ""column_no"": 54, ""inspector_type"": ""CHECKSTYLE""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'for rcurly' has incorrect indentation level 24, expected level should be 12."", ""file_path"": """", ""line_no"": 20, ""column_no"": 25, ""inspector_type"": ""CHECKSTYLE""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'for rcurly' has incorrect indentation level 16, expected level should be 8."", ""file_path"": """", ""line_no"": 21, ""column_no"": 17, ""inspector_type"": ""CHECKSTYLE""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'method def' child has incorrect indentation level 16, expected level should be 8."", ""file_path"": """", ""line_no"": 22, ""column_no"": 17, ""inspector_type"": ""CHECKSTYLE""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'method def rcurly' has incorrect indentation level 8, expected level should be 4."", ""file_path"": """", ""line_no"": 23, ""column_no"": 9, ""inspector_type"": ""CHECKSTYLE""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'method def modifier' has incorrect indentation level 8, expected level should be 4."", ""file_path"": """", ""line_no"": 25, ""column_no"": 9, ""inspector_type"": ""CHECKSTYLE""}, {""origin_class"": ""CyclomaticComplexityCheck"", ""type"": ""CYCLOMATIC_COMPLEXITY"", ""description"": ""Too complex function. You can figure out how to simplify this code or split it into a set of small functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 25, ""column_no"": 9, ""inspector_type"": ""CHECKSTYLE"", ""measure"": 4}, {""origin_class"": ""JavaNCSSCheck"", ""type"": ""FUNC_LEN"", ""description"": ""Too long function. Try to split it into smaller functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 25, ""column_no"": 9, ""inspector_type"": ""CHECKSTYLE"", ""measure"": 7}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'for' has incorrect indentation level 12, expected level should be 8."", ""file_path"": """", ""line_no"": 26, ""column_no"": 13, ""inspector_type"": ""CHECKSTYLE""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'for' has incorrect indentation level 20, expected level should be 12."", ""file_path"": """", ""line_no"": 27, ""column_no"": 21, ""inspector_type"": ""CHECKSTYLE""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'if' has incorrect indentation level 28, expected level should be 16."", ""file_path"": """", ""line_no"": 28, ""column_no"": 29, ""inspector_type"": ""CHECKSTYLE""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'if' child has incorrect indentation level 36, expected level should be 20."", ""file_path"": """", ""line_no"": 29, ""column_no"": 37, ""inspector_type"": ""CHECKSTYLE""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'if rcurly' has incorrect indentation level 32, expected level should be 16."", ""file_path"": """", ""line_no"": 30, ""column_no"": 33, ""inspector_type"": ""CHECKSTYLE""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'for' child has incorrect indentation level 32, expected level should be 16."", ""file_path"": """", ""line_no"": 31, ""column_no"": 33, ""inspector_type"": ""CHECKSTYLE""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'for rcurly' has incorrect indentation level 24, expected level should be 12."", ""file_path"": """", ""line_no"": 32, ""column_no"": 25, ""inspector_type"": ""CHECKSTYLE""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'for' child has incorrect indentation level 20, expected level should be 12."", ""file_path"": """", ""line_no"": 33, ""column_no"": 21, ""inspector_type"": ""CHECKSTYLE""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'for rcurly' has incorrect indentation level 16, expected level should be 8."", ""file_path"": """", ""line_no"": 34, ""column_no"": 17, ""inspector_type"": ""CHECKSTYLE""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'method def rcurly' has incorrect indentation level 8, expected level should be 4."", ""file_path"": """", ""line_no"": 35, ""column_no"": 9, ""inspector_type"": ""CHECKSTYLE""}]" +}","[{""origin_class"": ""EmptyLineSeparatorCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'CLASS_DEF' should be separated from previous line."", ""file_path"": """", ""line_no"": 2, ""column_no"": 1, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY""}, {""origin_class"": ""CyclomaticComplexityCheck"", ""type"": ""CYCLOMATIC_COMPLEXITY"", ""description"": ""Too complex function. You can figure out how to simplify this code or split it into a set of small functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 4, ""column_no"": 5, ""inspector_type"": ""CHECKSTYLE"", ""measure"": 5, ""difficulty"": ""HARD""}, {""origin_class"": ""JavaNCSSCheck"", ""type"": ""FUNC_LEN"", ""description"": ""Too long function. Try to split it into smaller functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 4, ""column_no"": 5, ""inspector_type"": ""CHECKSTYLE"", ""measure"": 14, ""difficulty"": ""EASY""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'method def' child has incorrect indentation level 16, expected level should be 8."", ""file_path"": """", ""line_no"": 5, ""column_no"": 17, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'method def' child has incorrect indentation level 16, expected level should be 8."", ""file_path"": """", ""line_no"": 7, ""column_no"": 17, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'method def' child has incorrect indentation level 16, expected level should be 8."", ""file_path"": """", ""line_no"": 8, ""column_no"": 17, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY""}, {""origin_class"": ""ArrayTypeStyleCheck"", ""type"": ""CODE_STYLE"", ""description"": ""Array brackets at illegal position."", ""file_path"": """", ""line_no"": 8, ""column_no"": 24, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY""}, {""origin_class"": ""ArrayTypeStyleCheck"", ""type"": ""CODE_STYLE"", ""description"": ""Array brackets at illegal position."", ""file_path"": """", ""line_no"": 8, ""column_no"": 26, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'method def' child has incorrect indentation level 16, expected level should be 8."", ""file_path"": """", ""line_no"": 9, ""column_no"": 17, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'method def' child has incorrect indentation level 16, expected level should be 8."", ""file_path"": """", ""line_no"": 10, ""column_no"": 17, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'for' has incorrect indentation level 16, expected level should be 8."", ""file_path"": """", ""line_no"": 11, ""column_no"": 17, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY""}, {""origin_class"": ""WhitespaceAfterCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'for' is not followed by whitespace."", ""file_path"": """", ""line_no"": 11, ""column_no"": 17, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'for' child has incorrect indentation level 24, expected level should be 12."", ""file_path"": """", ""line_no"": 12, ""column_no"": 25, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'for rcurly' has incorrect indentation level 16, expected level should be 8."", ""file_path"": """", ""line_no"": 13, ""column_no"": 17, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'for' has incorrect indentation level 16, expected level should be 8."", ""file_path"": """", ""line_no"": 14, ""column_no"": 17, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'for' child has incorrect indentation level 24, expected level should be 12."", ""file_path"": """", ""line_no"": 15, ""column_no"": 25, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'for rcurly' has incorrect indentation level 16, expected level should be 8."", ""file_path"": """", ""line_no"": 16, ""column_no"": 17, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'for' has incorrect indentation level 16, expected level should be 8."", ""file_path"": """", ""line_no"": 17, ""column_no"": 17, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'for' has incorrect indentation level 24, expected level should be 12."", ""file_path"": """", ""line_no"": 18, ""column_no"": 25, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'for' child has incorrect indentation level 32, expected level should be 16."", ""file_path"": """", ""line_no"": 19, ""column_no"": 33, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY""}, {""origin_class"": ""WhitespaceAroundCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'-' is not followed by whitespace."", ""file_path"": """", ""line_no"": 19, ""column_no"": 54, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'for rcurly' has incorrect indentation level 24, expected level should be 12."", ""file_path"": """", ""line_no"": 20, ""column_no"": 25, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'for rcurly' has incorrect indentation level 16, expected level should be 8."", ""file_path"": """", ""line_no"": 21, ""column_no"": 17, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'method def' child has incorrect indentation level 16, expected level should be 8."", ""file_path"": """", ""line_no"": 22, ""column_no"": 17, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'method def rcurly' has incorrect indentation level 8, expected level should be 4."", ""file_path"": """", ""line_no"": 23, ""column_no"": 9, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'method def modifier' has incorrect indentation level 8, expected level should be 4."", ""file_path"": """", ""line_no"": 25, ""column_no"": 9, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY""}, {""origin_class"": ""CyclomaticComplexityCheck"", ""type"": ""CYCLOMATIC_COMPLEXITY"", ""description"": ""Too complex function. You can figure out how to simplify this code or split it into a set of small functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 25, ""column_no"": 9, ""inspector_type"": ""CHECKSTYLE"", ""measure"": 4, ""difficulty"": ""HARD""}, {""origin_class"": ""JavaNCSSCheck"", ""type"": ""FUNC_LEN"", ""description"": ""Too long function. Try to split it into smaller functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 25, ""column_no"": 9, ""inspector_type"": ""CHECKSTYLE"", ""measure"": 7, ""difficulty"": ""EASY""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'for' has incorrect indentation level 12, expected level should be 8."", ""file_path"": """", ""line_no"": 26, ""column_no"": 13, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'for' has incorrect indentation level 20, expected level should be 12."", ""file_path"": """", ""line_no"": 27, ""column_no"": 21, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'if' has incorrect indentation level 28, expected level should be 16."", ""file_path"": """", ""line_no"": 28, ""column_no"": 29, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'if' child has incorrect indentation level 36, expected level should be 20."", ""file_path"": """", ""line_no"": 29, ""column_no"": 37, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'if rcurly' has incorrect indentation level 32, expected level should be 16."", ""file_path"": """", ""line_no"": 30, ""column_no"": 33, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'for' child has incorrect indentation level 32, expected level should be 16."", ""file_path"": """", ""line_no"": 31, ""column_no"": 33, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'for rcurly' has incorrect indentation level 24, expected level should be 12."", ""file_path"": """", ""line_no"": 32, ""column_no"": 25, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'for' child has incorrect indentation level 20, expected level should be 12."", ""file_path"": """", ""line_no"": 33, ""column_no"": 21, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'for rcurly' has incorrect indentation level 16, expected level should be 8."", ""file_path"": """", ""line_no"": 34, ""column_no"": 17, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'method def rcurly' has incorrect indentation level 8, expected level should be 4."", ""file_path"": """", ""line_no"": 35, ""column_no"": 9, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY""}]" 3,java11,"public class Main { public static void main(String[] args) { @@ -65,7 +65,7 @@ public class Main { System.out.println(variable); } } -","[{""origin_class"": ""CyclomaticComplexityCheck"", ""type"": ""CYCLOMATIC_COMPLEXITY"", ""description"": ""Too complex function. You can figure out how to simplify this code or split it into a set of small functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 2, ""column_no"": 5, ""inspector_type"": ""CHECKSTYLE"", ""measure"": 1}, {""origin_class"": ""JavaNCSSCheck"", ""type"": ""FUNC_LEN"", ""description"": ""Too long function. Try to split it into smaller functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 2, ""column_no"": 5, ""inspector_type"": ""CHECKSTYLE"", ""measure"": 3}]" +","[{""origin_class"": ""CyclomaticComplexityCheck"", ""type"": ""CYCLOMATIC_COMPLEXITY"", ""description"": ""Too complex function. You can figure out how to simplify this code or split it into a set of small functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 2, ""column_no"": 5, ""inspector_type"": ""CHECKSTYLE"", ""measure"": 1, ""difficulty"": ""HARD""}, {""origin_class"": ""JavaNCSSCheck"", ""type"": ""FUNC_LEN"", ""description"": ""Too long function. Try to split it into smaller functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 2, ""column_no"": 5, ""inspector_type"": ""CHECKSTYLE"", ""measure"": 3, ""difficulty"": ""EASY""}]" 4,python3,"class ComplexNumber: def __init__(self, real_part, im_part): self.real_part = real_part @@ -101,7 +101,7 @@ public class Main { def __sub__(self, other): real = self.real_part - other.real_part imaginary = self.im_part - other.im_part - return ComplexNumber(real, imaginary)","[{""origin_class"": ""C0325"", ""type"": ""CODE_STYLE"", ""description"": ""Unnecessary parens after 'return' keyword"", ""file_path"": """", ""line_no"": 17, ""column_no"": 1, ""inspector_type"": ""PYLINT""}, {""origin_class"": ""C001"", ""type"": ""BOOL_EXPR_LEN"", ""description"": ""Too long boolean expression. Try to split it into smaller expressions."", ""file_path"": """", ""line_no"": 17, ""column_no"": 16, ""inspector_type"": ""PYTHON_AST"", ""measure"": 1}, {""origin_class"": ""H601"", ""type"": ""COHESION"", ""description"": ""class has low (85.71%) cohesion"", ""file_path"": """", ""line_no"": 1, ""column_no"": 1, ""inspector_type"": ""FLAKE8"", ""measure"": 14}, {""origin_class"": ""RAD100"", ""type"": ""MAINTAINABILITY"", ""description"": ""The maintainability index is too low."", ""file_path"": """", ""line_no"": 1, ""column_no"": 1, ""inspector_type"": ""RADON"", ""measure"": 50}, {""origin_class"": ""C901"", ""type"": ""CYCLOMATIC_COMPLEXITY"", ""description"": ""Too complex function. You can figure out how to simplify this code or split it into a set of small functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 2, ""column_no"": 5, ""inspector_type"": ""FLAKE8"", ""measure"": 1}, {""origin_class"": ""C002"", ""type"": ""FUNC_LEN"", ""description"": ""Too long function. Try to split it into smaller functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 2, ""column_no"": 4, ""inspector_type"": ""PYTHON_AST"", ""measure"": 2}, {""origin_class"": ""C901"", ""type"": ""CYCLOMATIC_COMPLEXITY"", ""description"": ""Too complex function. You can figure out how to simplify this code or split it into a set of small functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 6, ""column_no"": 5, ""inspector_type"": ""FLAKE8"", ""measure"": 1}, {""origin_class"": ""C002"", ""type"": ""FUNC_LEN"", ""description"": ""Too long function. Try to split it into smaller functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 6, ""column_no"": 4, ""inspector_type"": ""PYTHON_AST"", ""measure"": 3}, {""origin_class"": ""C901"", ""type"": ""CYCLOMATIC_COMPLEXITY"", ""description"": ""Too complex function. You can figure out how to simplify this code or split it into a set of small functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 11, ""column_no"": 5, ""inspector_type"": ""FLAKE8"", ""measure"": 1}, {""origin_class"": ""C002"", ""type"": ""FUNC_LEN"", ""description"": ""Too long function. Try to split it into smaller functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 11, ""column_no"": 4, ""inspector_type"": ""PYTHON_AST"", ""measure"": 3}, {""origin_class"": ""C901"", ""type"": ""CYCLOMATIC_COMPLEXITY"", ""description"": ""Too complex function. You can figure out how to simplify this code or split it into a set of small functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 16, ""column_no"": 5, ""inspector_type"": ""FLAKE8"", ""measure"": 1}, {""origin_class"": ""C002"", ""type"": ""FUNC_LEN"", ""description"": ""Too long function. Try to split it into smaller functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 16, ""column_no"": 4, ""inspector_type"": ""PYTHON_AST"", ""measure"": 1}, {""origin_class"": ""C901"", ""type"": ""CYCLOMATIC_COMPLEXITY"", ""description"": ""Too complex function. You can figure out how to simplify this code or split it into a set of small functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 19, ""column_no"": 5, ""inspector_type"": ""FLAKE8"", ""measure"": 2}, {""origin_class"": ""C002"", ""type"": ""FUNC_LEN"", ""description"": ""Too long function. Try to split it into smaller functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 19, ""column_no"": 4, ""inspector_type"": ""PYTHON_AST"", ""measure"": 5}, {""origin_class"": ""C901"", ""type"": ""CYCLOMATIC_COMPLEXITY"", ""description"": ""Too complex function. You can figure out how to simplify this code or split it into a set of small functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 26, ""column_no"": 5, ""inspector_type"": ""FLAKE8"", ""measure"": 1}, {""origin_class"": ""C002"", ""type"": ""FUNC_LEN"", ""description"": ""Too long function. Try to split it into smaller functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 26, ""column_no"": 4, ""inspector_type"": ""PYTHON_AST"", ""measure"": 5}, {""origin_class"": ""WPS331"", ""type"": ""BEST_PRACTICES"", ""description"": ""Found variables that are only used for `return`: result"", ""file_path"": """", ""line_no"": 31, ""column_no"": 9, ""inspector_type"": ""FLAKE8""}, {""origin_class"": ""R504"", ""type"": ""BEST_PRACTICES"", ""description"": ""you shouldn`t assign value to variable if it will be use only as return value"", ""file_path"": """", ""line_no"": 31, ""column_no"": 16, ""inspector_type"": ""FLAKE8""}, {""origin_class"": ""C901"", ""type"": ""CYCLOMATIC_COMPLEXITY"", ""description"": ""Too complex function. You can figure out how to simplify this code or split it into a set of small functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 33, ""column_no"": 5, ""inspector_type"": ""FLAKE8"", ""measure"": 1}, {""origin_class"": ""C002"", ""type"": ""FUNC_LEN"", ""description"": ""Too long function. Try to split it into smaller functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 33, ""column_no"": 4, ""inspector_type"": ""PYTHON_AST"", ""measure"": 3}]" + return ComplexNumber(real, imaginary)","[{""origin_class"": ""C0325"", ""type"": ""CODE_STYLE"", ""description"": ""Unnecessary parens after 'return' keyword"", ""file_path"": """", ""line_no"": 17, ""column_no"": 1, ""inspector_type"": ""PYLINT"", ""difficulty"": ""EASY""}, {""origin_class"": ""C001"", ""type"": ""BOOL_EXPR_LEN"", ""description"": ""Too long boolean expression. Try to split it into smaller expressions."", ""file_path"": """", ""line_no"": 17, ""column_no"": 16, ""inspector_type"": ""PYTHON_AST"", ""measure"": 1, ""difficulty"": ""EASY""}, {""origin_class"": ""H601"", ""type"": ""COHESION"", ""description"": ""class has low (85.71%) cohesion"", ""file_path"": """", ""line_no"": 1, ""column_no"": 1, ""inspector_type"": ""FLAKE8"", ""measure"": 14, ""difficulty"": ""HARD""}, {""origin_class"": ""RAD100"", ""type"": ""MAINTAINABILITY"", ""description"": ""The maintainability index is too low."", ""file_path"": """", ""line_no"": 1, ""column_no"": 1, ""inspector_type"": ""RADON"", ""measure"": 50, ""difficulty"": ""HARD""}, {""origin_class"": ""C901"", ""type"": ""CYCLOMATIC_COMPLEXITY"", ""description"": ""Too complex function. You can figure out how to simplify this code or split it into a set of small functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 2, ""column_no"": 5, ""inspector_type"": ""FLAKE8"", ""measure"": 1, ""difficulty"": ""HARD""}, {""origin_class"": ""C002"", ""type"": ""FUNC_LEN"", ""description"": ""Too long function. Try to split it into smaller functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 2, ""column_no"": 4, ""inspector_type"": ""PYTHON_AST"", ""measure"": 2, ""difficulty"": ""EASY""}, {""origin_class"": ""C901"", ""type"": ""CYCLOMATIC_COMPLEXITY"", ""description"": ""Too complex function. You can figure out how to simplify this code or split it into a set of small functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 6, ""column_no"": 5, ""inspector_type"": ""FLAKE8"", ""measure"": 1, ""difficulty"": ""HARD""}, {""origin_class"": ""C002"", ""type"": ""FUNC_LEN"", ""description"": ""Too long function. Try to split it into smaller functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 6, ""column_no"": 4, ""inspector_type"": ""PYTHON_AST"", ""measure"": 3, ""difficulty"": ""EASY""}, {""origin_class"": ""C901"", ""type"": ""CYCLOMATIC_COMPLEXITY"", ""description"": ""Too complex function. You can figure out how to simplify this code or split it into a set of small functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 11, ""column_no"": 5, ""inspector_type"": ""FLAKE8"", ""measure"": 1, ""difficulty"": ""HARD""}, {""origin_class"": ""C002"", ""type"": ""FUNC_LEN"", ""description"": ""Too long function. Try to split it into smaller functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 11, ""column_no"": 4, ""inspector_type"": ""PYTHON_AST"", ""measure"": 3, ""difficulty"": ""EASY""}, {""origin_class"": ""C901"", ""type"": ""CYCLOMATIC_COMPLEXITY"", ""description"": ""Too complex function. You can figure out how to simplify this code or split it into a set of small functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 16, ""column_no"": 5, ""inspector_type"": ""FLAKE8"", ""measure"": 1, ""difficulty"": ""HARD""}, {""origin_class"": ""C002"", ""type"": ""FUNC_LEN"", ""description"": ""Too long function. Try to split it into smaller functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 16, ""column_no"": 4, ""inspector_type"": ""PYTHON_AST"", ""measure"": 1, ""difficulty"": ""EASY""}, {""origin_class"": ""C901"", ""type"": ""CYCLOMATIC_COMPLEXITY"", ""description"": ""Too complex function. You can figure out how to simplify this code or split it into a set of small functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 19, ""column_no"": 5, ""inspector_type"": ""FLAKE8"", ""measure"": 2, ""difficulty"": ""HARD""}, {""origin_class"": ""C002"", ""type"": ""FUNC_LEN"", ""description"": ""Too long function. Try to split it into smaller functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 19, ""column_no"": 4, ""inspector_type"": ""PYTHON_AST"", ""measure"": 5, ""difficulty"": ""EASY""}, {""origin_class"": ""C901"", ""type"": ""CYCLOMATIC_COMPLEXITY"", ""description"": ""Too complex function. You can figure out how to simplify this code or split it into a set of small functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 26, ""column_no"": 5, ""inspector_type"": ""FLAKE8"", ""measure"": 1, ""difficulty"": ""HARD""}, {""origin_class"": ""C002"", ""type"": ""FUNC_LEN"", ""description"": ""Too long function. Try to split it into smaller functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 26, ""column_no"": 4, ""inspector_type"": ""PYTHON_AST"", ""measure"": 5, ""difficulty"": ""EASY""}, {""origin_class"": ""WPS331"", ""type"": ""BEST_PRACTICES"", ""description"": ""Found variables that are only used for `return`: result"", ""file_path"": """", ""line_no"": 31, ""column_no"": 9, ""inspector_type"": ""FLAKE8"", ""difficulty"": ""MEDIUM""}, {""origin_class"": ""R504"", ""type"": ""BEST_PRACTICES"", ""description"": ""you shouldn`t assign value to variable if it will be use only as return value"", ""file_path"": """", ""line_no"": 31, ""column_no"": 16, ""inspector_type"": ""FLAKE8"", ""difficulty"": ""MEDIUM""}, {""origin_class"": ""C901"", ""type"": ""CYCLOMATIC_COMPLEXITY"", ""description"": ""Too complex function. You can figure out how to simplify this code or split it into a set of small functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 33, ""column_no"": 5, ""inspector_type"": ""FLAKE8"", ""measure"": 1, ""difficulty"": ""HARD""}, {""origin_class"": ""C002"", ""type"": ""FUNC_LEN"", ""description"": ""Too long function. Try to split it into smaller functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 33, ""column_no"": 4, ""inspector_type"": ""PYTHON_AST"", ""measure"": 3, ""difficulty"": ""EASY""}]" 5,python3,"n = int(input()) def even(): i = 0 @@ -114,7 +114,7 @@ for _ in range(n): # Don't forget to print out the first n numbers one by one here -","[{""origin_class"": ""C901"", ""type"": ""CYCLOMATIC_COMPLEXITY"", ""description"": ""Too complex function. You can figure out how to simplify this code or split it into a set of small functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 2, ""column_no"": 1, ""inspector_type"": ""FLAKE8"", ""measure"": 2}, {""origin_class"": ""C002"", ""type"": ""FUNC_LEN"", ""description"": ""Too long function. Try to split it into smaller functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 2, ""column_no"": 0, ""inspector_type"": ""PYTHON_AST"", ""measure"": 4}, {""origin_class"": ""C901"", ""type"": ""CYCLOMATIC_COMPLEXITY"", ""description"": ""Too complex function. You can figure out how to simplify this code or split it into a set of small functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 8, ""column_no"": 1, ""inspector_type"": ""FLAKE8"", ""measure"": 2}, {""origin_class"": ""RAD100"", ""type"": ""MAINTAINABILITY"", ""description"": ""The maintainability index is too low."", ""file_path"": """", ""line_no"": 1, ""column_no"": 1, ""inspector_type"": ""RADON"", ""measure"": 12}]" +","[{""origin_class"": ""C901"", ""type"": ""CYCLOMATIC_COMPLEXITY"", ""description"": ""Too complex function. You can figure out how to simplify this code or split it into a set of small functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 2, ""column_no"": 1, ""inspector_type"": ""FLAKE8"", ""measure"": 2, ""difficulty"": ""HARD""}, {""origin_class"": ""C002"", ""type"": ""FUNC_LEN"", ""description"": ""Too long function. Try to split it into smaller functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 2, ""column_no"": 0, ""inspector_type"": ""PYTHON_AST"", ""measure"": 4, ""difficulty"": ""EASY""}, {""origin_class"": ""C901"", ""type"": ""CYCLOMATIC_COMPLEXITY"", ""description"": ""Too complex function. You can figure out how to simplify this code or split it into a set of small functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 8, ""column_no"": 1, ""inspector_type"": ""FLAKE8"", ""measure"": 2, ""difficulty"": ""HARD""}, {""origin_class"": ""RAD100"", ""type"": ""MAINTAINABILITY"", ""description"": ""The maintainability index is too low."", ""file_path"": """", ""line_no"": 1, ""column_no"": 1, ""inspector_type"": ""RADON"", ""measure"": 12, ""difficulty"": ""HARD""}]" 6,javascript,"async function rockBand(str) { return new Promise(function(resolve, reject) { if (str == 'Linkin Park') { @@ -124,4 +124,4 @@ for _ in range(n): } }); } -","[{""origin_class"": ""no-unused-vars"", ""type"": ""CODE_STYLE"", ""description"": ""'rockBand' is defined but never used. (no-unused-vars)"", ""file_path"": """", ""line_no"": 1, ""column_no"": 16, ""inspector_type"": ""ESLINT""}, {""origin_class"": ""no-unused-vars"", ""type"": ""CODE_STYLE"", ""description"": ""'reject' is defined but never used. (no-unused-vars)"", ""file_path"": """", ""line_no"": 2, ""column_no"": 40, ""inspector_type"": ""ESLINT""}, {""origin_class"": ""eqeqeq"", ""type"": ""BEST_PRACTICES"", ""description"": ""Expected '===' and instead saw '=='. (eqeqeq)"", ""file_path"": """", ""line_no"": 3, ""column_no"": 15, ""inspector_type"": ""ESLINT""}]" \ No newline at end of file +","[{""origin_class"": ""no-unused-vars"", ""type"": ""CODE_STYLE"", ""description"": ""'rockBand' is defined but never used. (no-unused-vars)"", ""file_path"": """", ""line_no"": 1, ""column_no"": 16, ""inspector_type"": ""ESLINT"", ""difficulty"": ""EASY""}, {""origin_class"": ""no-unused-vars"", ""type"": ""CODE_STYLE"", ""description"": ""'reject' is defined but never used. (no-unused-vars)"", ""file_path"": """", ""line_no"": 2, ""column_no"": 40, ""inspector_type"": ""ESLINT"", ""difficulty"": ""EASY""}, {""origin_class"": ""eqeqeq"", ""type"": ""BEST_PRACTICES"", ""description"": ""Expected '===' and instead saw '=='. (eqeqeq)"", ""file_path"": """", ""line_no"": 3, ""column_no"": 15, ""inspector_type"": ""ESLINT"", ""difficulty"": ""MEDIUM""}]" \ No newline at end of file diff --git a/test/resources/evaluation/issues_statistics/get_raw_issues_statistics/test_files/test_df_single_lang.csv b/test/resources/evaluation/issues_statistics/get_raw_issues_statistics/test_files/test_df_single_lang.csv index b1662148..b22596a6 100644 --- a/test/resources/evaluation/issues_statistics/get_raw_issues_statistics/test_files/test_df_single_lang.csv +++ b/test/resources/evaluation/issues_statistics/get_raw_issues_statistics/test_files/test_df_single_lang.csv @@ -20,7 +20,7 @@ class Main { System.out.println(""""); } } -}","[{""origin_class"": ""UnusedImportsCheck"", ""type"": ""BEST_PRACTICES"", ""description"": ""Unused import - java.util.Arrays."", ""file_path"": """", ""line_no"": 2, ""column_no"": 8, ""inspector_type"": ""CHECKSTYLE""}, {""origin_class"": ""CyclomaticComplexityCheck"", ""type"": ""CYCLOMATIC_COMPLEXITY"", ""description"": ""Too complex function. You can figure out how to simplify this code or split it into a set of small functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 5, ""column_no"": 5, ""inspector_type"": ""CHECKSTYLE"", ""measure"": 7}, {""origin_class"": ""JavaNCSSCheck"", ""type"": ""FUNC_LEN"", ""description"": ""Too long function. Try to split it into smaller functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 5, ""column_no"": 5, ""inspector_type"": ""CHECKSTYLE"", ""measure"": 11}, {""origin_class"": ""BooleanExpressionComplexityCheck"", ""type"": ""BOOL_EXPR_LEN"", ""description"": ""Too long boolean expression. Try to split it into smaller expressions."", ""file_path"": """", ""line_no"": 14, ""column_no"": 17, ""inspector_type"": ""CHECKSTYLE"", ""measure"": 3}]" +}","[{""origin_class"": ""UnusedImportsCheck"", ""type"": ""BEST_PRACTICES"", ""description"": ""Unused import - java.util.Arrays."", ""file_path"": """", ""line_no"": 2, ""column_no"": 8, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""MEDIUM""}, {""origin_class"": ""CyclomaticComplexityCheck"", ""type"": ""CYCLOMATIC_COMPLEXITY"", ""description"": ""Too complex function. You can figure out how to simplify this code or split it into a set of small functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 5, ""column_no"": 5, ""inspector_type"": ""CHECKSTYLE"", ""measure"": 7, ""difficulty"": ""HARD""}, {""origin_class"": ""JavaNCSSCheck"", ""type"": ""FUNC_LEN"", ""description"": ""Too long function. Try to split it into smaller functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 5, ""column_no"": 5, ""inspector_type"": ""CHECKSTYLE"", ""measure"": 11, ""difficulty"": ""EASY""}, {""origin_class"": ""BooleanExpressionComplexityCheck"", ""type"": ""BOOL_EXPR_LEN"", ""description"": ""Too long boolean expression. Try to split it into smaller expressions."", ""file_path"": """", ""line_no"": 14, ""column_no"": 17, ""inspector_type"": ""CHECKSTYLE"", ""measure"": 3, ""difficulty"": ""EASY""}]" 2,java11,"import java.util.Scanner; public class Main { @@ -56,7 +56,7 @@ public class Main { System.out.println(); } } -}","[{""origin_class"": ""EmptyLineSeparatorCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'CLASS_DEF' should be separated from previous line."", ""file_path"": """", ""line_no"": 2, ""column_no"": 1, ""inspector_type"": ""CHECKSTYLE""}, {""origin_class"": ""CyclomaticComplexityCheck"", ""type"": ""CYCLOMATIC_COMPLEXITY"", ""description"": ""Too complex function. You can figure out how to simplify this code or split it into a set of small functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 4, ""column_no"": 5, ""inspector_type"": ""CHECKSTYLE"", ""measure"": 5}, {""origin_class"": ""JavaNCSSCheck"", ""type"": ""FUNC_LEN"", ""description"": ""Too long function. Try to split it into smaller functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 4, ""column_no"": 5, ""inspector_type"": ""CHECKSTYLE"", ""measure"": 14}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'method def' child has incorrect indentation level 16, expected level should be 8."", ""file_path"": """", ""line_no"": 5, ""column_no"": 17, ""inspector_type"": ""CHECKSTYLE""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'method def' child has incorrect indentation level 16, expected level should be 8."", ""file_path"": """", ""line_no"": 7, ""column_no"": 17, ""inspector_type"": ""CHECKSTYLE""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'method def' child has incorrect indentation level 16, expected level should be 8."", ""file_path"": """", ""line_no"": 8, ""column_no"": 17, ""inspector_type"": ""CHECKSTYLE""}, {""origin_class"": ""ArrayTypeStyleCheck"", ""type"": ""CODE_STYLE"", ""description"": ""Array brackets at illegal position."", ""file_path"": """", ""line_no"": 8, ""column_no"": 24, ""inspector_type"": ""CHECKSTYLE""}, {""origin_class"": ""ArrayTypeStyleCheck"", ""type"": ""CODE_STYLE"", ""description"": ""Array brackets at illegal position."", ""file_path"": """", ""line_no"": 8, ""column_no"": 26, ""inspector_type"": ""CHECKSTYLE""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'method def' child has incorrect indentation level 16, expected level should be 8."", ""file_path"": """", ""line_no"": 9, ""column_no"": 17, ""inspector_type"": ""CHECKSTYLE""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'method def' child has incorrect indentation level 16, expected level should be 8."", ""file_path"": """", ""line_no"": 10, ""column_no"": 17, ""inspector_type"": ""CHECKSTYLE""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'for' has incorrect indentation level 16, expected level should be 8."", ""file_path"": """", ""line_no"": 11, ""column_no"": 17, ""inspector_type"": ""CHECKSTYLE""}, {""origin_class"": ""WhitespaceAfterCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'for' is not followed by whitespace."", ""file_path"": """", ""line_no"": 11, ""column_no"": 17, ""inspector_type"": ""CHECKSTYLE""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'for' child has incorrect indentation level 24, expected level should be 12."", ""file_path"": """", ""line_no"": 12, ""column_no"": 25, ""inspector_type"": ""CHECKSTYLE""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'for rcurly' has incorrect indentation level 16, expected level should be 8."", ""file_path"": """", ""line_no"": 13, ""column_no"": 17, ""inspector_type"": ""CHECKSTYLE""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'for' has incorrect indentation level 16, expected level should be 8."", ""file_path"": """", ""line_no"": 14, ""column_no"": 17, ""inspector_type"": ""CHECKSTYLE""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'for' child has incorrect indentation level 24, expected level should be 12."", ""file_path"": """", ""line_no"": 15, ""column_no"": 25, ""inspector_type"": ""CHECKSTYLE""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'for rcurly' has incorrect indentation level 16, expected level should be 8."", ""file_path"": """", ""line_no"": 16, ""column_no"": 17, ""inspector_type"": ""CHECKSTYLE""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'for' has incorrect indentation level 16, expected level should be 8."", ""file_path"": """", ""line_no"": 17, ""column_no"": 17, ""inspector_type"": ""CHECKSTYLE""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'for' has incorrect indentation level 24, expected level should be 12."", ""file_path"": """", ""line_no"": 18, ""column_no"": 25, ""inspector_type"": ""CHECKSTYLE""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'for' child has incorrect indentation level 32, expected level should be 16."", ""file_path"": """", ""line_no"": 19, ""column_no"": 33, ""inspector_type"": ""CHECKSTYLE""}, {""origin_class"": ""WhitespaceAroundCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'-' is not followed by whitespace."", ""file_path"": """", ""line_no"": 19, ""column_no"": 54, ""inspector_type"": ""CHECKSTYLE""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'for rcurly' has incorrect indentation level 24, expected level should be 12."", ""file_path"": """", ""line_no"": 20, ""column_no"": 25, ""inspector_type"": ""CHECKSTYLE""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'for rcurly' has incorrect indentation level 16, expected level should be 8."", ""file_path"": """", ""line_no"": 21, ""column_no"": 17, ""inspector_type"": ""CHECKSTYLE""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'method def' child has incorrect indentation level 16, expected level should be 8."", ""file_path"": """", ""line_no"": 22, ""column_no"": 17, ""inspector_type"": ""CHECKSTYLE""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'method def rcurly' has incorrect indentation level 8, expected level should be 4."", ""file_path"": """", ""line_no"": 23, ""column_no"": 9, ""inspector_type"": ""CHECKSTYLE""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'method def modifier' has incorrect indentation level 8, expected level should be 4."", ""file_path"": """", ""line_no"": 25, ""column_no"": 9, ""inspector_type"": ""CHECKSTYLE""}, {""origin_class"": ""CyclomaticComplexityCheck"", ""type"": ""CYCLOMATIC_COMPLEXITY"", ""description"": ""Too complex function. You can figure out how to simplify this code or split it into a set of small functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 25, ""column_no"": 9, ""inspector_type"": ""CHECKSTYLE"", ""measure"": 4}, {""origin_class"": ""JavaNCSSCheck"", ""type"": ""FUNC_LEN"", ""description"": ""Too long function. Try to split it into smaller functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 25, ""column_no"": 9, ""inspector_type"": ""CHECKSTYLE"", ""measure"": 7}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'for' has incorrect indentation level 12, expected level should be 8."", ""file_path"": """", ""line_no"": 26, ""column_no"": 13, ""inspector_type"": ""CHECKSTYLE""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'for' has incorrect indentation level 20, expected level should be 12."", ""file_path"": """", ""line_no"": 27, ""column_no"": 21, ""inspector_type"": ""CHECKSTYLE""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'if' has incorrect indentation level 28, expected level should be 16."", ""file_path"": """", ""line_no"": 28, ""column_no"": 29, ""inspector_type"": ""CHECKSTYLE""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'if' child has incorrect indentation level 36, expected level should be 20."", ""file_path"": """", ""line_no"": 29, ""column_no"": 37, ""inspector_type"": ""CHECKSTYLE""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'if rcurly' has incorrect indentation level 32, expected level should be 16."", ""file_path"": """", ""line_no"": 30, ""column_no"": 33, ""inspector_type"": ""CHECKSTYLE""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'for' child has incorrect indentation level 32, expected level should be 16."", ""file_path"": """", ""line_no"": 31, ""column_no"": 33, ""inspector_type"": ""CHECKSTYLE""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'for rcurly' has incorrect indentation level 24, expected level should be 12."", ""file_path"": """", ""line_no"": 32, ""column_no"": 25, ""inspector_type"": ""CHECKSTYLE""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'for' child has incorrect indentation level 20, expected level should be 12."", ""file_path"": """", ""line_no"": 33, ""column_no"": 21, ""inspector_type"": ""CHECKSTYLE""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'for rcurly' has incorrect indentation level 16, expected level should be 8."", ""file_path"": """", ""line_no"": 34, ""column_no"": 17, ""inspector_type"": ""CHECKSTYLE""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'method def rcurly' has incorrect indentation level 8, expected level should be 4."", ""file_path"": """", ""line_no"": 35, ""column_no"": 9, ""inspector_type"": ""CHECKSTYLE""}]" +}","[{""origin_class"": ""EmptyLineSeparatorCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'CLASS_DEF' should be separated from previous line."", ""file_path"": """", ""line_no"": 2, ""column_no"": 1, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY""}, {""origin_class"": ""CyclomaticComplexityCheck"", ""type"": ""CYCLOMATIC_COMPLEXITY"", ""description"": ""Too complex function. You can figure out how to simplify this code or split it into a set of small functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 4, ""column_no"": 5, ""inspector_type"": ""CHECKSTYLE"", ""measure"": 5, ""difficulty"": ""HARD""}, {""origin_class"": ""JavaNCSSCheck"", ""type"": ""FUNC_LEN"", ""description"": ""Too long function. Try to split it into smaller functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 4, ""column_no"": 5, ""inspector_type"": ""CHECKSTYLE"", ""measure"": 14, ""difficulty"": ""EASY""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'method def' child has incorrect indentation level 16, expected level should be 8."", ""file_path"": """", ""line_no"": 5, ""column_no"": 17, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'method def' child has incorrect indentation level 16, expected level should be 8."", ""file_path"": """", ""line_no"": 7, ""column_no"": 17, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'method def' child has incorrect indentation level 16, expected level should be 8."", ""file_path"": """", ""line_no"": 8, ""column_no"": 17, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY""}, {""origin_class"": ""ArrayTypeStyleCheck"", ""type"": ""CODE_STYLE"", ""description"": ""Array brackets at illegal position."", ""file_path"": """", ""line_no"": 8, ""column_no"": 24, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY""}, {""origin_class"": ""ArrayTypeStyleCheck"", ""type"": ""CODE_STYLE"", ""description"": ""Array brackets at illegal position."", ""file_path"": """", ""line_no"": 8, ""column_no"": 26, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'method def' child has incorrect indentation level 16, expected level should be 8."", ""file_path"": """", ""line_no"": 9, ""column_no"": 17, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'method def' child has incorrect indentation level 16, expected level should be 8."", ""file_path"": """", ""line_no"": 10, ""column_no"": 17, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'for' has incorrect indentation level 16, expected level should be 8."", ""file_path"": """", ""line_no"": 11, ""column_no"": 17, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY""}, {""origin_class"": ""WhitespaceAfterCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'for' is not followed by whitespace."", ""file_path"": """", ""line_no"": 11, ""column_no"": 17, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'for' child has incorrect indentation level 24, expected level should be 12."", ""file_path"": """", ""line_no"": 12, ""column_no"": 25, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'for rcurly' has incorrect indentation level 16, expected level should be 8."", ""file_path"": """", ""line_no"": 13, ""column_no"": 17, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'for' has incorrect indentation level 16, expected level should be 8."", ""file_path"": """", ""line_no"": 14, ""column_no"": 17, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'for' child has incorrect indentation level 24, expected level should be 12."", ""file_path"": """", ""line_no"": 15, ""column_no"": 25, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'for rcurly' has incorrect indentation level 16, expected level should be 8."", ""file_path"": """", ""line_no"": 16, ""column_no"": 17, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'for' has incorrect indentation level 16, expected level should be 8."", ""file_path"": """", ""line_no"": 17, ""column_no"": 17, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'for' has incorrect indentation level 24, expected level should be 12."", ""file_path"": """", ""line_no"": 18, ""column_no"": 25, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'for' child has incorrect indentation level 32, expected level should be 16."", ""file_path"": """", ""line_no"": 19, ""column_no"": 33, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY""}, {""origin_class"": ""WhitespaceAroundCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'-' is not followed by whitespace."", ""file_path"": """", ""line_no"": 19, ""column_no"": 54, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'for rcurly' has incorrect indentation level 24, expected level should be 12."", ""file_path"": """", ""line_no"": 20, ""column_no"": 25, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'for rcurly' has incorrect indentation level 16, expected level should be 8."", ""file_path"": """", ""line_no"": 21, ""column_no"": 17, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'method def' child has incorrect indentation level 16, expected level should be 8."", ""file_path"": """", ""line_no"": 22, ""column_no"": 17, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'method def rcurly' has incorrect indentation level 8, expected level should be 4."", ""file_path"": """", ""line_no"": 23, ""column_no"": 9, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'method def modifier' has incorrect indentation level 8, expected level should be 4."", ""file_path"": """", ""line_no"": 25, ""column_no"": 9, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY""}, {""origin_class"": ""CyclomaticComplexityCheck"", ""type"": ""CYCLOMATIC_COMPLEXITY"", ""description"": ""Too complex function. You can figure out how to simplify this code or split it into a set of small functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 25, ""column_no"": 9, ""inspector_type"": ""CHECKSTYLE"", ""measure"": 4, ""difficulty"": ""HARD""}, {""origin_class"": ""JavaNCSSCheck"", ""type"": ""FUNC_LEN"", ""description"": ""Too long function. Try to split it into smaller functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 25, ""column_no"": 9, ""inspector_type"": ""CHECKSTYLE"", ""measure"": 7, ""difficulty"": ""EASY""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'for' has incorrect indentation level 12, expected level should be 8."", ""file_path"": """", ""line_no"": 26, ""column_no"": 13, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'for' has incorrect indentation level 20, expected level should be 12."", ""file_path"": """", ""line_no"": 27, ""column_no"": 21, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'if' has incorrect indentation level 28, expected level should be 16."", ""file_path"": """", ""line_no"": 28, ""column_no"": 29, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'if' child has incorrect indentation level 36, expected level should be 20."", ""file_path"": """", ""line_no"": 29, ""column_no"": 37, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'if rcurly' has incorrect indentation level 32, expected level should be 16."", ""file_path"": """", ""line_no"": 30, ""column_no"": 33, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'for' child has incorrect indentation level 32, expected level should be 16."", ""file_path"": """", ""line_no"": 31, ""column_no"": 33, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'for rcurly' has incorrect indentation level 24, expected level should be 12."", ""file_path"": """", ""line_no"": 32, ""column_no"": 25, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'for' child has incorrect indentation level 20, expected level should be 12."", ""file_path"": """", ""line_no"": 33, ""column_no"": 21, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'for rcurly' has incorrect indentation level 16, expected level should be 8."", ""file_path"": """", ""line_no"": 34, ""column_no"": 17, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY""}, {""origin_class"": ""IndentationCheck"", ""type"": ""CODE_STYLE"", ""description"": ""'method def rcurly' has incorrect indentation level 8, expected level should be 4."", ""file_path"": """", ""line_no"": 35, ""column_no"": 9, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""EASY""}]" 3,java11,"public class Main { public static void main(String[] args) { @@ -65,4 +65,4 @@ public class Main { System.out.println(variable); } } -","[{""origin_class"": ""CyclomaticComplexityCheck"", ""type"": ""CYCLOMATIC_COMPLEXITY"", ""description"": ""Too complex function. You can figure out how to simplify this code or split it into a set of small functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 2, ""column_no"": 5, ""inspector_type"": ""CHECKSTYLE"", ""measure"": 1}, {""origin_class"": ""JavaNCSSCheck"", ""type"": ""FUNC_LEN"", ""description"": ""Too long function. Try to split it into smaller functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 2, ""column_no"": 5, ""inspector_type"": ""CHECKSTYLE"", ""measure"": 3}]" \ No newline at end of file +","[{""origin_class"": ""CyclomaticComplexityCheck"", ""type"": ""CYCLOMATIC_COMPLEXITY"", ""description"": ""Too complex function. You can figure out how to simplify this code or split it into a set of small functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 2, ""column_no"": 5, ""inspector_type"": ""CHECKSTYLE"", ""measure"": 1, ""difficulty"": ""HARD""}, {""origin_class"": ""JavaNCSSCheck"", ""type"": ""FUNC_LEN"", ""description"": ""Too long function. Try to split it into smaller functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 2, ""column_no"": 5, ""inspector_type"": ""CHECKSTYLE"", ""measure"": 3, ""difficulty"": ""EASY""}]" \ No newline at end of file diff --git a/test/resources/evaluation/issues_statistics/get_raw_issues_statistics/test_files/test_df_with_incorrect_language.csv b/test/resources/evaluation/issues_statistics/get_raw_issues_statistics/test_files/test_df_with_incorrect_language.csv index e98834c0..e078b9a3 100644 --- a/test/resources/evaluation/issues_statistics/get_raw_issues_statistics/test_files/test_df_with_incorrect_language.csv +++ b/test/resources/evaluation/issues_statistics/get_raw_issues_statistics/test_files/test_df_with_incorrect_language.csv @@ -20,4 +20,4 @@ class Main { System.out.println(""""); } } -}","[{""origin_class"": ""UnusedImportsCheck"", ""type"": ""BEST_PRACTICES"", ""description"": ""Unused import - java.util.Arrays."", ""file_path"": """", ""line_no"": 2, ""column_no"": 8, ""inspector_type"": ""CHECKSTYLE""}, {""origin_class"": ""CyclomaticComplexityCheck"", ""type"": ""CYCLOMATIC_COMPLEXITY"", ""description"": ""Too complex function. You can figure out how to simplify this code or split it into a set of small functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 5, ""column_no"": 5, ""inspector_type"": ""CHECKSTYLE"", ""measure"": 7}, {""origin_class"": ""JavaNCSSCheck"", ""type"": ""FUNC_LEN"", ""description"": ""Too long function. Try to split it into smaller functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 5, ""column_no"": 5, ""inspector_type"": ""CHECKSTYLE"", ""measure"": 11}, {""origin_class"": ""BooleanExpressionComplexityCheck"", ""type"": ""BOOL_EXPR_LEN"", ""description"": ""Too long boolean expression. Try to split it into smaller expressions."", ""file_path"": """", ""line_no"": 14, ""column_no"": 17, ""inspector_type"": ""CHECKSTYLE"", ""measure"": 3}]" \ No newline at end of file +}","[{""origin_class"": ""UnusedImportsCheck"", ""type"": ""BEST_PRACTICES"", ""description"": ""Unused import - java.util.Arrays."", ""file_path"": """", ""line_no"": 2, ""column_no"": 8, ""inspector_type"": ""CHECKSTYLE"", ""difficulty"": ""MEDIUM""}, {""origin_class"": ""CyclomaticComplexityCheck"", ""type"": ""CYCLOMATIC_COMPLEXITY"", ""description"": ""Too complex function. You can figure out how to simplify this code or split it into a set of small functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 5, ""column_no"": 5, ""inspector_type"": ""CHECKSTYLE"", ""measure"": 7, ""difficulty"": ""HARD""}, {""origin_class"": ""JavaNCSSCheck"", ""type"": ""FUNC_LEN"", ""description"": ""Too long function. Try to split it into smaller functions / methods. It will make your code easy to understand and less error prone."", ""file_path"": """", ""line_no"": 5, ""column_no"": 5, ""inspector_type"": ""CHECKSTYLE"", ""measure"": 11, ""difficulty"": ""EASY""}, {""origin_class"": ""BooleanExpressionComplexityCheck"", ""type"": ""BOOL_EXPR_LEN"", ""description"": ""Too long boolean expression. Try to split it into smaller expressions."", ""file_path"": """", ""line_no"": 14, ""column_no"": 17, ""inspector_type"": ""CHECKSTYLE"", ""measure"": 3, ""difficulty"": ""EASY""}]" \ No newline at end of file diff --git a/test/resources/evaluation/xlsx_target_files/target_sorted_order.xlsx b/test/resources/evaluation/xlsx_target_files/target_sorted_order.xlsx index 289925fa..8ac7efa8 100644 Binary files a/test/resources/evaluation/xlsx_target_files/target_sorted_order.xlsx and b/test/resources/evaluation/xlsx_target_files/target_sorted_order.xlsx differ diff --git a/test/resources/evaluation/xlsx_target_files/target_unsorted_order.xlsx b/test/resources/evaluation/xlsx_target_files/target_unsorted_order.xlsx index f3ff97b6..8ce11d71 100644 Binary files a/test/resources/evaluation/xlsx_target_files/target_unsorted_order.xlsx and b/test/resources/evaluation/xlsx_target_files/target_unsorted_order.xlsx differ diff --git a/test/resources/functional_tests/difficulty_levels/file_with_all_difficulty_levels.py b/test/resources/functional_tests/difficulty_levels/file_with_all_difficulty_levels.py new file mode 100644 index 00000000..a2ddefa4 --- /dev/null +++ b/test/resources/functional_tests/difficulty_levels/file_with_all_difficulty_levels.py @@ -0,0 +1,12 @@ +from math import sqrt + +MUTABLE_CONSTANT = {"1": 1, "2": 2} + +class BadClass: + def __init__(self, x: int, y: int): + self.x = x + self.y = y + + @staticmethod + def Length(x: int, y: int) -> float: + return sqrt(x ** 2 + y ** 2) diff --git a/test/resources/functional_tests/difficulty_levels/file_with_only_easy_issues.py b/test/resources/functional_tests/difficulty_levels/file_with_only_easy_issues.py new file mode 100644 index 00000000..0358a23e --- /dev/null +++ b/test/resources/functional_tests/difficulty_levels/file_with_only_easy_issues.py @@ -0,0 +1,12 @@ +def MAIN(Number): + if Number > 0: + return Number + + return 0 + + +if __name__ == "__main__": + print( + "Hello, World") + + MAIN(0) diff --git a/test/resources/functional_tests/difficulty_levels/file_with_only_hard_issues.py b/test/resources/functional_tests/difficulty_levels/file_with_only_hard_issues.py new file mode 100644 index 00000000..ce35caf3 --- /dev/null +++ b/test/resources/functional_tests/difficulty_levels/file_with_only_hard_issues.py @@ -0,0 +1,15 @@ +from math import sqrt + + +class BadClass: + def __init__(self, x: int, y: int): + self.x = x + self.y = y + + @staticmethod + def length(x: int, y: int) -> float: + return sqrt(x ** 2 + y ** 2) + + +if __name__ == "__main__": + print("Hello, World!") diff --git a/test/resources/functional_tests/difficulty_levels/file_with_only_medium_issues.py b/test/resources/functional_tests/difficulty_levels/file_with_only_medium_issues.py new file mode 100644 index 00000000..7e160cc5 --- /dev/null +++ b/test/resources/functional_tests/difficulty_levels/file_with_only_medium_issues.py @@ -0,0 +1,27 @@ +MUTABLE_CONSTANT = {"1": 1, "2": 2} + +PI = 3.14 +DOUBLE_PI = 6.28 +E = 2.71 + + +def function_with_bad_try(b, c): + result = None + + try: + result = b / c + except Exception: + print("It's fine") + + return result + + +def bad_generator(some_value): + if some_value: + raise StopIteration + yield 1 + + +if __name__ == "__main__": + + print("Hello, World!") diff --git a/test/resources/functional_tests/difficulty_levels/file_without_issues.py b/test/resources/functional_tests/difficulty_levels/file_without_issues.py new file mode 100644 index 00000000..34bc455b --- /dev/null +++ b/test/resources/functional_tests/difficulty_levels/file_without_issues.py @@ -0,0 +1,2 @@ +if __name__ == '__main__': + print("Hello, world") \ No newline at end of file