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

Add documentation for too-many-lines #8323

Merged
merged 19 commits into from
Feb 21, 2023
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
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
16 changes: 16 additions & 0 deletions doc/data/messages/t/too-many-lines/bad.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
def isPalindrome(string): # [too-many-lines]
Pierre-Sassoulas marked this conversation as resolved.
Show resolved Hide resolved
left_pos = 0
right_pos = len(string) - 1

Pierre-Sassoulas marked this conversation as resolved.
Show resolved Hide resolved
while right_pos >= left_pos:
if not string[left_pos] == string[right_pos]:
return False
left_pos += 1
right_pos -= 1
return True


print(isPalindrome('aza'))
print(isPalindrome('racecar'))
print(isPalindrome('trigger'))
print(isPalindrome('ogre'))
Pierre-Sassoulas marked this conversation as resolved.
Show resolved Hide resolved
4 changes: 3 additions & 1 deletion doc/data/messages/t/too-many-lines/details.rst
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
You can help us make the doc better `by contributing <https://github.com/PyCQA/pylint/issues/5953>`_ !
ollie-iterators marked this conversation as resolved.
Show resolved Hide resolved
When a module has too many lines it can make it harder for the module to run because too much code is
in the module. Also it makes it hard to find the code that you are looking for because what you are
looking for could be happing multiple times in the module.
Pierre-Sassoulas marked this conversation as resolved.
Show resolved Hide resolved
15 changes: 14 additions & 1 deletion doc/data/messages/t/too-many-lines/good.py
Original file line number Diff line number Diff line change
@@ -1 +1,14 @@
# This is a placeholder for correct code for this message.
def isPalindrome(string):
left_pos = 0
right_pos = len(string) - 1

while right_pos >= left_pos:
if not string[left_pos] == string[right_pos]:
return False
left_pos += 1
right_pos -= 1
return True
Pierre-Sassoulas marked this conversation as resolved.
Show resolved Hide resolved

listOfStrings = ['aza', 'racecar', 'trigger', 'ogre']
for string in listOfStrings:
print(isPalindrome(string))
Pierre-Sassoulas marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 2 additions & 0 deletions doc/data/messages/t/too-many-lines/pylintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[main]
max-module-lines=15