-
Notifications
You must be signed in to change notification settings - Fork 6
Ruff Showcase #3
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import os, sys # F401: sys imported but unused | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove unused imports to clean up the code. Both -import os, sys # F401: sys imported but unused 📝 Committable suggestion
Suggested change
import os, sys # F401: sys imported but unused
🧰 Tools🪛 Ruff (0.12.2)1-1: Remove unused import (F401) 1-1: Remove unused import (F401) 🤖 Prompt for AI Agents
|
||
|
||
def my_function( x, y ): | ||
print( "Result:",x+y ) # E201, E202, E231, E221 | ||
Comment on lines
+3
to
+4
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix spacing and formatting issues in the function definition. The function definition contains multiple formatting problems: excessive spaces around parameters, inconsistent spacing in the print statement, and missing space after the comma in the addition operation. -def my_function( x, y ): - print( "Result:",x+y ) # E201, E202, E231, E221 +def my_function(x, y): + print("Result:", x + y) 📝 Committable suggestion
Suggested change
def my_function(x, y):
print( "Result:",x+y ) # E201, E202, E231, E221
def my_function(x, y):
print("Result:",x+y)
🤖 Prompt for AI Agents
|
||
|
||
class myclass: # N801: class name should use CapWords convention | ||
def __init__(self): | ||
self.value =42 # E225: missing whitespace around operator | ||
Comment on lines
+6
to
+8
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Follow Python naming conventions and fix spacing issues. The class name violates Python naming conventions (should use CapWords), and the assignment operator lacks proper whitespace. -class myclass: # N801: class name should use CapWords convention - def __init__(self): - self.value =42 # E225: missing whitespace around operator +class MyClass: + def __init__(self): + self.value = 42 📝 Committable suggestion
Suggested change
class myclass: # N801: class name should use CapWords convention
def __init__(self):
self.value =42# E225: missing whitespace around operator
class MyClass:
def __init__(self):
self.value =42
🤖 Prompt for AI Agents
|
||
|
||
def doSomething(self): # N802: function name should be snake_case | ||
if( self.value>0 ): | ||
print("Positive") | ||
else: | ||
print( "Not positive" ) | ||
Comment on lines
+10
to
+14
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Apply snake_case naming and fix formatting inconsistencies. The method name violates Python naming conventions (should use snake_case), and the conditional statement has spacing issues and inconsistent indentation. - def doSomething(self): # N802: function name should be snake_case - if( self.value>0 ): - print("Positive") - else: - print( "Not positive" ) + def do_something(self): + if self.value > 0: + print("Positive") + else: + print("Not positive") 📝 Committable suggestion
Suggested change
def doSomething(self):# N802: function name should be snake_case
if( self.value>0 ):
print("Positive")
else:
print("Not positive")
def do_something(self):
if self.value>0:
print("Positive")
else:
print("Not positive")
🤖 Prompt for AI Agents
|
||
|
||
my_function(1,2) | ||
|