-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
Fix part of issue #8423 Lint concatenation checker #19908
base: develop
Are you sure you want to change the base?
Conversation
Hi @Helper2020, can you complete the following:
|
Assigning @vojtechjelinek for the first pass review of this PR. Thanks! |
Unassigning @Helper2020 since a re-review was requested. @Helper2020, please make sure you have addressed all review comments. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @Helper2020! Could you please fix the lint checks that are failing on CI? Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Left a few comments.
scripts/linters/pylint_extensions.py
Outdated
if (isinstance(left_inferred.value, str) and | ||
isinstance(right_inferred.value, str)): | ||
self.add_message('prefer-string-interpolation', node=node) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (isinstance(left_inferred.value, str) and | |
isinstance(right_inferred.value, str)): | |
self.add_message('prefer-string-interpolation', node=node) | |
if ( | |
isinstance(left_inferred.value, str) and | |
isinstance(right_inferred.value, str) | |
): | |
self.add_message('prefer-string-interpolation', node=node) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Unassigning @vojtechjelinek since the review is done. |
@Helper2020 please correct the issues flagged by Oppiabot in #19908 (comment):
I'm de-assigning myself for now until these issues and CI checks are fixed |
@vojtechjelinek I'm not sure how I can handle errors from .infer() without try-except blocks. Any suggestions? |
Why can't you use try-except? |
I can, just according to the coding style guide, raising exceptions are rarely used. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vojtechjelinek PTAL, @seanlip PTAL,
core/domain/email_manager_test.py
Outdated
'%s%s/story_1' % ( | ||
feconf.OPPIA_SITE_URL, | ||
feconf.STORY_EDITOR_URL_PREFIX) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
suggestion_models.SCORE_TYPE_TRANSLATION + | ||
suggestion_models.SCORE_CATEGORY_DELIMITER + 'English') | ||
'%s%s%s' % ( | ||
suggestion_models.SCORE_TYPE_TRANSLATION, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please make sure to actually fix the things I mentioned in my previous comments in ALL files you modify. Get rid of .format(
, f-strings, nested formatting ('aaaa %s dddd' % ('%s %s' % 'bbbb cccc')
.
core/controllers/suggestion_test.py
Outdated
'backend file system at /exploration/%s/assets/image/ %s' % ( | ||
exp_id, 'before submitting this translation again.'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'backend file system at /exploration/%s/assets/image/ %s' % ( | |
exp_id, 'before submitting this translation again.'), | |
'backend file system at /exploration/%s/assets/image/ %s' | |
'before submitting this translation again.' % exp_id, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto elsewhere
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
'on or before the planned date or adjust the planned publication date.' | ||
'<br><br>' | ||
'<ol>%s</ol>' | ||
), | ||
).format(constants.CHAPTER_PUBLICATION_NOTICE_PERIOD_IN_DAYS), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use %
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I used %, the variable constants.Chapter.... when into the %s in between the ol tags.
core/domain/email_manager.py
Outdated
story_link = ('%s%s/%s' % ( | ||
str(feconf.OPPIA_SITE_URL), | ||
str(feconf.STORY_EDITOR_URL_PREFIX), | ||
overdue_story.id | ||
)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
story_link = ('%s%s/%s' % ( | |
str(feconf.OPPIA_SITE_URL), | |
str(feconf.STORY_EDITOR_URL_PREFIX), | |
overdue_story.id | |
)) | |
story_link = ('%s%s/%s' % ( | |
str(feconf.OPPIA_SITE_URL), | |
str(feconf.STORY_EDITOR_URL_PREFIX), | |
overdue_story.id | |
)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
core/domain/email_manager_test.py
Outdated
'%s%s/story_1' % ( | ||
feconf.OPPIA_SITE_URL, feconf.STORY_EDITOR_URL_PREFIX) | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why have nested formatting, can you move '%s%s/story_1'
to the string above?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
entity_type='exploration', entity_id=self.EXP_ID_3, | ||
original_author_id=self.user_id, subject='Feedback', | ||
status=feedback_models.STATUS_CHOICES_OPEN, message_count=0, | ||
has_suggestion=False) | ||
thread_3.update_timestamps() | ||
thread_3.put() | ||
feedback_services.create_message( | ||
'exploration.' + self.EXP_ID_3 + '.' + self.THREAD_ID, | ||
f'exploration.{self.EXP_ID_3}.{self.THREAD_ID}', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use %
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PTAL @vojtechjelinek , hope I didn't miss anything!
core/controllers/suggestion_test.py
Outdated
'backend file system at /exploration/%s/assets/image/ %s' % ( | ||
exp_id, 'before submitting this translation again.'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
'on or before the planned date or adjust the planned publication date.' | ||
'<br><br>' | ||
'<ol>%s</ol>' | ||
), | ||
).format(constants.CHAPTER_PUBLICATION_NOTICE_PERIOD_IN_DAYS), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I used %, the variable constants.Chapter.... when into the %s in between the ol tags.
core/domain/email_manager.py
Outdated
story_link = ('%s%s/%s' % ( | ||
str(feconf.OPPIA_SITE_URL), | ||
str(feconf.STORY_EDITOR_URL_PREFIX), | ||
overdue_story.id | ||
)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
core/domain/email_manager_test.py
Outdated
'%s%s/story_1' % ( | ||
feconf.OPPIA_SITE_URL, feconf.STORY_EDITOR_URL_PREFIX) | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
entity_type='exploration', entity_id=self.EXP_ID_3, | ||
original_author_id=self.user_id, subject='Feedback', | ||
status=feedback_models.STATUS_CHOICES_OPEN, message_count=0, | ||
has_suggestion=False) | ||
thread_3.update_timestamps() | ||
thread_3.put() | ||
feedback_services.create_message( | ||
'exploration.' + self.EXP_ID_3 + '.' + self.THREAD_ID, | ||
f'exploration.{self.EXP_ID_3}.{self.THREAD_ID}', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Overview
Essential Checklist