Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate pylint #39

Merged
merged 3 commits into from
Jun 16, 2024
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
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ lint:
poetry run isort ondivi tests
poetry run ruff check ondivi tests --fix
poetry run flake8 ondivi tests
poetry run pylint ondivi tests
poetry run mypy ondivi tests --strict

test: unit it
Expand Down
8 changes: 4 additions & 4 deletions ondivi/define_changed_lines.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ def define_changed_lines(diff: DiffStr) -> dict[FileNameStr, list[int]]:
:param diff: DiffStr
:return: dict[FileNameStr, list[int]]
"""
res: dict[FileNameStr, list[int]] = {}
changed_lines: dict[FileNameStr, list[int]] = {}
current_file = ''
for line in diff.splitlines():
if _line_contain_filename(line):
current_file = line.split(' b/')[-1].strip()
res[current_file] = []
changed_lines[current_file] = []
elif _diff_line_contain_changed_lines(line):
res[current_file].extend(_changed_lines(line))
return res
changed_lines[current_file].extend(_changed_lines(line))
return changed_lines


def _line_contain_filename(diff_line: str) -> bool:
Expand Down
6 changes: 3 additions & 3 deletions ondivi/filter_out_violations.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ def filter_out_violations(
:param violation_format: ViolationFormatStr
:return: tuple[ActualViolationsListStr, bool]
"""
res = []
filtered_violations = []
violation_found = False
for violation in violations:
line_for_out, is_violation = _is_line_for_out(changed_lines, violation, violation_format)
violation_found = violation_found or is_violation
if line_for_out:
res.append(violation)
return res, violation_found
filtered_violations.append(violation)
return filtered_violations, violation_found


def _is_line_for_out(
Expand Down
102 changes: 101 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading