Replace Python 2 print statements with print function calls - #235
Open
sonarqube-agent[bot] wants to merge 1 commit into
Open
Replace Python 2 print statements with print function calls#235sonarqube-agent[bot] wants to merge 1 commit into
sonarqube-agent[bot] wants to merge 1 commit into
Conversation
Fixed issues: - AZ9rJA3GkdvHrJAQ8SGX for python:PrintStatementUsage rule - AZ9rJA29kdvHrJAQ8SGR for python:PrintStatementUsage rule - AZ9rJA29kdvHrJAQ8SGO for python:PrintStatementUsage rule - AZ9rJA29kdvHrJAQ8SGP for python:PrintStatementUsage rule - AZ9rJA29kdvHrJAQ8SGQ for python:PrintStatementUsage rule Generated by SonarQube Agent (task: c35b2c1f-ecd0-4011-ad75-25c96d15e898)
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Converts 5 instances of deprecated Python 2-style print statements to Python 3-compatible print function calls across fortune.py and letters.py. This fixes MAJOR-severity SonarQube violations and ensures the code is compatible with Python 3, where the print statement syntax is no longer supported.
View Project in SonarCloud
Fixed Issues
python:PrintStatementUsage - Replace print statement by built-in function. • MAJOR • View issue
Location:
sonar-scanner/src/python/fortune.py:90Why is this an issue?
The
printstatement was removed in Python 3.0. The built-in function should be used instead.What changed
Replaces the Python 2-style print statement
print 'Usage: fortune.py <filename>'with the Python 3-compatible built-in function callprint('Usage: fortune.py <filename>'), fixing the code smell about using the removed print statement syntax.python:PrintStatementUsage - Replace print statement by built-in function. • MAJOR • View issue
Location:
sonar-scanner/src/python/letters.py:150Why is this an issue?
The
printstatement was removed in Python 3.0. The built-in function should be used instead.What changed
This hunk converts the
printstatement on line 152 (print "Good question.") to aprint()function call, replacing the deprecated Python 2 print statement with the built-in print function required in Python 3.python:PrintStatementUsage - Replace print statement by built-in function. • MAJOR • View issue 1
python:PrintStatementUsage - Replace print statement by built-in function. • MAJOR • View issue 2
Location:
sonar-scanner/src/python/letters.py:152Why is this an issue?
The
printstatement was removed in Python 3.0. The built-in function should be used instead.What changed
This hunk converts the
printstatement on line 154 (print "I don't understand the question.") to aprint()function call, replacing the deprecated Python 2 print statement with the built-in print function required in Python 3. This also addresses the related print statement usage warning for theprint "I don't unpattern detected at line 154.python:PrintStatementUsage - Replace print statement by built-in function. • MAJOR • View issue
Location:
sonar-scanner/src/python/letters.py:157Why is this an issue?
The
printstatement was removed in Python 3.0. The built-in function should be used instead.What changed
This hunk converts the
printstatement on line 150 (print 'That was a wasted question...') to aprint()function call, fixing the Python 3 incompatibility where the print statement syntax is no longer supported.SonarQube Remediation Agent uses AI. Check for mistakes.