Skip to content

Changing flake8 to have max-line-length of 115 #8362

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

Merged
merged 5 commits into from
Mar 2, 2023
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
6 changes: 3 additions & 3 deletions examples/deprecation_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ class DeprecationChecker(DeprecatedMixin, BaseChecker):
"""Class implementing deprecation checker."""

# DeprecatedMixin class is Mixin class implementing logic for searching deprecated methods and functions.
# The list of deprecated methods/functions is defined by the implementing class via deprecated_methods callback.
# DeprecatedMixin class is overriding attributes of BaseChecker hence must be specified *before* BaseChecker
# in list of base classes.
# The list of deprecated methods/functions is defined by the implementing class via
# deprecated_methods callback. DeprecatedMixin class is overriding attributes of BaseChecker hence must
# be specified *before* BaseChecker in list of base classes.

# The name defines a custom section of the config for this checker.
name = "deprecated"
Expand Down
3 changes: 2 additions & 1 deletion pylint/checkers/base/basic_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,8 @@ class BasicChecker(_BasicChecker):
"the user intended to do.",
),
"W0126": (
"Using a conditional statement with potentially wrong function or method call due to missing parentheses",
"Using a conditional statement with potentially wrong function or method call due to "
"missing parentheses",
"missing-parentheses-for-call-in-test",
"Emitted when a conditional statement (If or ternary if) "
"seems to wrongly call a function due to missing parentheses",
Expand Down
4 changes: 3 additions & 1 deletion pylint/checkers/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1812,7 +1812,9 @@ def get_import_name(importnode: ImportNode, modname: str | None) -> str | None:
root = importnode.root()
if isinstance(root, nodes.Module):
try:
return root.relative_to_absolute_name(modname, level=importnode.level) # type: ignore[no-any-return]
return root.relative_to_absolute_name( # type: ignore[no-any-return]
modname, level=importnode.level
)
except TooManyLevelsError:
return modname
return modname
Expand Down
5 changes: 3 additions & 2 deletions pylint/config/arguments_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,9 @@ def level(self) -> int:
def level(self, value: int) -> None:
# TODO: 3.0: Remove deprecated attribute
warnings.warn(
"Setting the level attribute has been deprecated. It was used to display the checker in the help or not,"
" and everything is displayed in the help now. It will be removed in pylint 3.0.",
"Setting the level attribute has been deprecated. It was used to display the checker "
"in the help or not, and everything is displayed in the help now. It will be removed "
"in pylint 3.0.",
DeprecationWarning,
stacklevel=2,
)
Expand Down
3 changes: 2 additions & 1 deletion pylint/config/config_initialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ def _config_initialization(
# load plugin specific configuration.
linter.load_plugin_configuration()

# Now that plugins are loaded, get list of all fail_on messages, and enable them
# Now that plugins are loaded, get list of all fail_on messages, and
# enable them
linter.enable_fail_on_messages()

linter._parse_error_mode()
Expand Down
3 changes: 2 additions & 1 deletion pylint/extensions/confusing_elif.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ class ConfusingConsecutiveElifChecker(BaseChecker):
"confusing-consecutive-elif",
"Used when an elif statement follows right after an indented block which itself ends with if or elif. "
"It may not be ovious if the elif statement was willingly or mistakenly unindented. "
"Extracting the indented if statement into a separate function might avoid confusion and prevent errors.",
"Extracting the indented if statement into a separate function might avoid confusion and prevent "
"errors.",
)
}

Expand Down
3 changes: 2 additions & 1 deletion pylint/extensions/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ class TypingChecker(BaseChecker):
"R6006": (
"Type `%s` is used more than once in union type annotation. Remove redundant typehints.",
"redundant-typehint-argument",
"Duplicated type arguments will be skipped by `mypy` tool, therefore should be removed to avoid confusion.",
"Duplicated type arguments will be skipped by `mypy` tool, therefore should be "
"removed to avoid confusion.",
),
}
options = (
Expand Down
3 changes: 2 additions & 1 deletion pylint/lint/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ def _query_cpu() -> int | None:
):
with open("/sys/fs/cgroup/cpu/cpu.cfs_period_us", encoding="utf-8") as file:
cpu_period = int(file.read().rstrip())
# Divide quota by period and you should get num of allotted CPU to the container, rounded down if fractional.
# Divide quota by period and you should get num of allotted CPU to the container,
# rounded down if fractional.
avail_cpu = int(cpu_quota / cpu_period)
elif Path("/sys/fs/cgroup/cpu/cpu.shares").is_file():
with open("/sys/fs/cgroup/cpu/cpu.shares", encoding="utf-8") as file:
Expand Down
6 changes: 4 additions & 2 deletions pylint/reporters/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@ def colorize_ansi(
# TODO: 3.0: Remove deprecated typing and only accept MessageStyle as parameter
if not isinstance(msg_style, MessageStyle):
warnings.warn(
"In pylint 3.0, the colorize_ansi function of Text reporters will only accept a MessageStyle parameter",
"In pylint 3.0, the colorize_ansi function of Text reporters will only accept a "
"MessageStyle parameter",
DeprecationWarning,
stacklevel=2,
)
Expand Down Expand Up @@ -279,7 +280,8 @@ def __init__(
list(color_mapping.values())[0], MessageStyle
):
warnings.warn(
"In pylint 3.0, the ColorizedTextReporter will only accept ColorMappingDict as color_mapping parameter",
"In pylint 3.0, the ColorizedTextReporter will only accept ColorMappingDict as "
"color_mapping parameter",
DeprecationWarning,
stacklevel=2,
)
Expand Down
5 changes: 4 additions & 1 deletion pylint/testutils/_primer/primer_compare_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,10 @@ def _create_comment_for_package(
assert not self.packages[package].url.endswith(
".git"
), "You don't need the .git at the end of the github url."
comment += f"{self.packages[package].url}/blob/{new_messages['commit']}/{filepath}#L{message['line']}\n"
comment += (
f"{self.packages[package].url}"
f"/blob/{new_messages['commit']}/{filepath}#L{message['line']}\n"
)
count += 1
print(message)
if missing_messages:
Expand Down
4 changes: 3 additions & 1 deletion pylint/testutils/lint_module_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
from pylint.lint import PyLinter
from pylint.message.message import Message
from pylint.testutils.constants import _EXPECTED_RE, _OPERATORS, UPDATE_OPTION
from pylint.testutils.functional.test_file import ( # need to import from functional.test_file to avoid cyclic import

# need to import from functional.test_file to avoid cyclic import
from pylint.testutils.functional.test_file import (
FunctionalTestFile,
NoFileError,
parse_python_version,
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ ignore =
B028,
# Flake8 is less lenient than pylint and does not make any exceptions
# (for docstrings, strings and comments in particular).
max-line-length=120
max-line-length=115
# Required for flake8-typing-imports (v1.12.0)
# The plugin doesn't yet read the value from pyproject.toml
min_python_version = 3.7.2
3 changes: 2 additions & 1 deletion tests/message/unittest_message_definition_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
"W1234": ("message one", "msg-symbol-one", "msg description"),
"W4321": ("message two", "msg-symbol-two", "msg description"),
},
r"Inconsistent checker part in message id 'W4321' (expected 'x12xx' because we already had ['W1234']).",
r"Inconsistent checker part in message id 'W4321' (expected 'x12xx' because we"
r" already had ['W1234']).",
),
(
{
Expand Down