Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 0 additions & 31 deletions src/python/evaluation/README.md

This file was deleted.

Empty file removed src/python/evaluation/__init__.py
Empty file.
Empty file.
34 changes: 0 additions & 34 deletions src/python/evaluation/common/util.py

This file was deleted.

42 changes: 0 additions & 42 deletions src/python/evaluation/common/xlsx_util.py

This file was deleted.

43 changes: 0 additions & 43 deletions src/python/evaluation/evaluation_config.py

This file was deleted.

169 changes: 0 additions & 169 deletions src/python/evaluation/xlsx_run_tool.py

This file was deleted.

8 changes: 8 additions & 0 deletions src/python/review/application_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,11 @@ def language_to_extension_dict(cls) -> dict:
@classmethod
def language_by_extension(cls, lang: str) -> str:
return cls.language_to_extension_dict()[lang]

def is_java(self) -> bool:
return (
self == LanguageVersion.JAVA_7
or self == LanguageVersion.JAVA_8
or self == LanguageVersion.JAVA_9
or self == LanguageVersion.JAVA_11
)
11 changes: 11 additions & 0 deletions src/python/review/inspectors/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,14 @@ def convert_percentage_of_value_to_lack_of_value(percentage_of_value: float) ->
:return: lack of value.
"""
return floor(100 - percentage_of_value)


# TODO: When upgrading to python 3.9+, replace it with removeprefix.
# See: https://docs.python.org/3.9/library/stdtypes.html#str.removeprefix
def remove_prefix(text: str, prefix: str) -> str:
"""
Removes the prefix if it is present, otherwise returns the original string.
"""
if text.startswith(prefix):
return text[len(prefix):]
return text
2 changes: 1 addition & 1 deletion src/python/review/inspectors/detekt/issue_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# complexity:
'ComplexCondition': IssueType.BOOL_EXPR_LEN,
'ComplexInterface': IssueType.COMPLEXITY,
'ComplexMethod': IssueType.COMPLEXITY,
'ComplexMethod': IssueType.CYCLOMATIC_COMPLEXITY,
'LabeledExpression': IssueType.COMPLEXITY,
'LargeClass': IssueType.COMPLEXITY,
'LongMethod': IssueType.FUNC_LEN,
Expand Down
5 changes: 5 additions & 0 deletions src/python/review/inspectors/flake8/flake8.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
logger = logging.getLogger(__name__)

PATH_FLAKE8_CONFIG = Path(__file__).parent / '.flake8'
# To make the whitelist, a list of words was examined based on students' solutions
# that were flagged by flake8-spellcheck as erroneous. In general, the whitelist included those words
# that belonged to library methods and which were common abbreviations.
PATH_FLAKE8_SPELLCHECK_WHITELIST = Path(__file__).parent / 'whitelist.txt'
FORMAT = '%(path)s:%(row)d:%(col)d:%(code)s:%(text)s'
INSPECTOR_NAME = 'flake8'

Expand All @@ -34,6 +38,7 @@ def inspect(cls, path: Path, config: dict) -> List[BaseIssue]:
'flake8',
f'--format={FORMAT}',
f'--config={PATH_FLAKE8_CONFIG}',
f'--whitelist={PATH_FLAKE8_SPELLCHECK_WHITELIST}',
'--max-complexity', '0',
'--cohesion-below', '100',
path,
Expand Down
2 changes: 2 additions & 0 deletions src/python/review/inspectors/flake8/issue_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
'C818': IssueType.CODE_STYLE,
'C819': IssueType.CODE_STYLE,

# The categorization for WPS was created using the following document: https://bit.ly/3yms06n

# WPS: Naming
'WPS117': IssueType.CODE_STYLE, # Forbid naming variables self, cls, or mcs.
'WPS125': IssueType.ERROR_PRONE, # Forbid variable or module names which shadow builtin names.
Expand Down
Loading