Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into refactoring
Browse files Browse the repository at this point in the history
# Conflicts:
#	.github/workflows/build.yml
#	requirements.txt
  • Loading branch information
meanmail committed Sep 18, 2024
2 parents 160ae0d + 8c59347 commit f7d30fd
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 10 deletions.
3 changes: 3 additions & 0 deletions hyperstyle/src/python/review/inspectors/pylint/pylint.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,11 @@
BASE_COMMAND = [
'pylint',
'--load-plugins', 'pylint_django',
# TODO: ask about django settings via an cli argument?
'--disable=django-not-configured',
f'--rcfile={PATH_PYLINT_CONFIG}',
f'--msg-template={MSG_TEMPLATE}',
'--recursive=true',
]


Expand Down
4 changes: 4 additions & 0 deletions hyperstyle/src/python/review/inspectors/pylint/pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,10 @@ disable=invalid-name,
W0614,
W0622,
W0511,
R1718, # conflicts with R1735
R1717, # conflicts with R1734
W1514, # Using open without explicitly specifying an encoding


# Enable the message, report, category or checker with the given id(s). You can
# either give multiple identifier separated by comma (,) or put this option
Expand Down
2 changes: 0 additions & 2 deletions test/python/functional_tests/test_file_or_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,4 @@ def test_inspect_project_with_unknown_extensions_works(local_command: LocalComma
output = process.stdout.decode()

assert process.returncode == 1
assert 'file.abc' not in output
assert 'file.xyz' not in output
assert 'file.py' in output
14 changes: 14 additions & 0 deletions test/python/inspectors/test_pylint_inspector.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,20 @@
]


FOLDER_NAMES_AND_N_ISSUES = [
('case0_folder_without_init', 0),
]


@pytest.mark.parametrize(('folder_name', 'n_issues'), FOLDER_NAMES_AND_N_ISSUES)
def test_folder_with_issues(folder_name: str, n_issues: int):
inspector = PylintInspector()
path_to_folder = PYTHON_DATA_FOLDER / folder_name
issues = inspector.inspect(path_to_folder, {})

assert len(issues) == n_issues


@pytest.mark.parametrize(('file_name', 'n_issues'), FILE_NAMES_AND_N_ISSUES)
def test_file_with_issues(file_name: str, n_issues: int):
inspector = PylintInspector()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
def FunctionWithIssue():
pass

answer = 42
print(answer)
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
if __name__ == '__main__':
print('hello world!')
8 changes: 1 addition & 7 deletions test/resources/inspectors/python/case39_no_issues.py
Original file line number Diff line number Diff line change
@@ -1,7 +1 @@
a, b, c = (input(), input(), input())
print(f'{a} {b} {c}')

print('1', '2', '3', sep='|')

result = int(a) + 10
print(result)
print("Hello, world!")
2 changes: 1 addition & 1 deletion test/resources/inspectors/python/case4_naming.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def __init__(self, a, b, C):
self.C = C

def myFun(self):
print('hello 1')
print(f'hello 1 {self.A}')

def my_fun(self, QQ):
print('hello 2 {}'.format(QQ))
Expand Down

0 comments on commit f7d30fd

Please sign in to comment.