Skip to content

Commit

Permalink
Space check for Python files (oppia#4728)
Browse files Browse the repository at this point in the history
  • Loading branch information
apb7 authored and seanlip committed Feb 23, 2018
1 parent 6689fce commit d892834
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion core/controllers/profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def get(self, username):
user_settings.first_contribution_msec
if user_settings.first_contribution_msec else None),
'profile_picture_data_url': user_settings.profile_picture_data_url,
'user_impact_score':user_services.get_user_impact_score(
'user_impact_score': user_services.get_user_impact_score(
user_settings.user_id),
'created_exp_summary_dicts': created_exp_summary_dicts,
'edited_exp_summary_dicts': edited_exp_summary_dicts,
Expand Down
11 changes: 6 additions & 5 deletions scripts/pre_commit_linter.py
Original file line number Diff line number Diff line change
Expand Up @@ -680,11 +680,12 @@ def _check_import_order(all_files):
return summary_messages


def _check_def_spacing(all_files):
def _check_spacing(all_files):
"""This function checks the number of blank lines
above each class, function and method defintion.
It also checks for whitespace after ',', ';' and ':'.
"""
print 'Starting def-spacing checks'
print 'Starting spacing checks'
print '----------------------------------------'
print ''
pycodestyle_config_path = os.path.join(os.getcwd(), 'tox.ini')
Expand All @@ -701,12 +702,12 @@ def _check_def_spacing(all_files):
print ''
if report.get_count() != 0:
summary_message = (
'%s Def spacing checks failed' % _MESSAGE_TYPE_FAILED)
'%s Spacing checks failed' % _MESSAGE_TYPE_FAILED)
print summary_message
summary_messages.append(summary_message)
else:
summary_message = (
'%s Def spacing checks passed' % _MESSAGE_TYPE_SUCCESS)
'%s Spacing checks passed' % _MESSAGE_TYPE_SUCCESS)
print summary_message
summary_messages.append(summary_message)
print ''
Expand All @@ -715,7 +716,7 @@ def _check_def_spacing(all_files):

def main():
all_files = _get_all_files()
def_spacing_messages = _check_def_spacing(all_files)
def_spacing_messages = _check_spacing(all_files)
import_order_messages = _check_import_order(all_files)
newline_messages = _check_newline_character(all_files)
linter_messages = _pre_commit_linter(all_files)
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[pycodestyle]
select=E301,E302,E305
select=E231,E301,E302,E305

0 comments on commit d892834

Please sign in to comment.