djangonaut-space / wagtail-indymeet

Djangonaut Space site
MIT License
13 stars 9 forks source link

There is a pre-commit, but most files don't adhere to it #339

Closed MHLut closed 3 months ago

MHLut commented 3 months ago

There is an extensive pre-commit config in the project but many files don't adhere to it.

When you run pre-commit run --all-files, pre-commit automatically adjusts 51 files:

$  git status
On branch develop
Your branch is up to date with 'origin/develop'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
    modified:   accounts/factories.py
    modified:   accounts/forms.py
    modified:   accounts/migrations/0008_userprofile_receiving_program_updates.py
    modified:   accounts/tests/test_activate_view.py
    modified:   accounts/tests/test_profile_view.py
    modified:   accounts/tests/test_signup_view.py
    modified:   accounts/tests/test_unsubscribe_view.py
    modified:   accounts/urls.py
    modified:   accounts/views.py
    modified:   home/admin.py
    modified:   home/constants.py
    modified:   home/factories.py
    modified:   home/management/commands/applications_open_email.py
    modified:   home/migrations/0017_generalpage_generaltag_generalpage_tags.py
    modified:   home/migrations/0018_alter_generalpage_content.py
    modified:   home/migrations/0021_question_survey_usersurveyresponse_and_more.py
    modified:   home/migrations/0023_alter_question_choices_alter_question_type_field_and_more.py
    modified:   home/migrations/0024_alter_question_help_text_alter_question_key.py
    modified:   home/migrations/0025_alter_generalpage_content.py
    modified:   home/models/__init__.py
    modified:   home/models/survey.py
    modified:   home/puput_migrations/0001_initial.py
    modified:   home/puput_migrations/0002_entrypage_markdown_body.py
    modified:   home/puput_migrations/0003_alter_entrypage_body.py
    modified:   home/puput_migrations/0004_alter_entrypage_body.py
    modified:   home/static/css/blog.css
    modified:   home/templates/home/surveys/widgets/attrs_exclude_id.html
    modified:   home/templatetags/survey.py
    modified:   home/tests/test_applications_open_email.py
    modified:   home/tests/test_event_views.py
    modified:   home/tests/test_forms.py
    modified:   home/tests/test_models.py
    modified:   home/tests/test_session_views.py
    modified:   home/tests/test_user_survey_response_form_views.py
    modified:   home/urls.py
    modified:   home/utils.py
    modified:   home/validators.py
    modified:   home/views.py
    modified:   home/widgets.py
    modified:   indymeet/settings/base.py
    modified:   indymeet/static/img/no_data.svg
    modified:   indymeet/templates/blocks/caption.html
    modified:   indymeet/templates/blocks/code-block.html
    modified:   indymeet/templates/blocks/list.html
    modified:   indymeet/templates/blocks/paragraph.html
    modified:   indymeet/templates/django_social_share/templatetags/post_to_facebook.html
    modified:   indymeet/templates/django_social_share/templatetags/post_to_twitter.html
    modified:   indymeet/templates/emails/base.html
    modified:   indymeet/templates/puput/tags/post_to_linkedin.html
    modified:   theme/apps.py
    modified:   theme/static_src/src/djangonaut-space.css

There are also some manual items left to fix:

accounts/forms.py:90:130: B950 line too long (129 > 90 characters)
accounts/forms.py:94:101: B950 line too long (100 > 90 characters)
accounts/tests/test_signup_view.py:47:107: B950 line too long (106 > 90 characters)
home/management/commands/applications_open_email.py:50:107: B950 line too long (106 > 90 characters)
home/migrations/0021_question_survey_usersurveyresponse_and_more.py:35:130: B950 line too long (129 > 90 characters)
home/migrations/0021_question_survey_usersurveyresponse_and_more.py:68:148: B950 line too long (147 > 90 characters)
home/migrations/0023_alter_question_choices_alter_question_type_field_and_more.py:20:190: B950 line too long (189 > 90 characters)
home/migrations/0024_alter_question_help_text_alter_question_key.py:26:122: B950 line too long (121 > 90 characters)
home/puput_migrations/0001_initial.py:120:159: B950 line too long (158 > 90 characters)
home/tests/test_applications_open_email.py:64:107: B950 line too long (106 > 90 characters)
home/tests/test_applications_open_email.py:90:103: B950 line too long (102 > 90 characters)
home/tests/test_forms.py:112:101: B950 line too long (100 > 90 characters)
home/tests/test_forms.py:159:101: B950 line too long (100 > 90 characters)
home/tests/test_models.py:26:104: B950 line too long (103 > 90 characters)
home/tests/test_models.py:71:314: B950 line too long (313 > 90 characters)

(Note: I usually ignore Django migrations in flake8)

Should we commit all these (automatic) fixes? Due to the size of the changelog, it's best to do this when there are no other branches open.

For the future, also add pre-commit to the README (#310) and optionally run the same checks in CI to ensure that they always run.

MHLut commented 3 months ago

I see @dawnwages started this process in https://github.com/djangonaut-space/wagtail-indymeet/pull/97/.

tim-schilling commented 3 months ago

@MHLut, I added this, but then we didn't have any checks to confirm it was being enforced.

MHLut commented 3 months ago

Closing this issue per https://github.com/djangonaut-space/wagtail-indymeet/pull/343/

We still need a README mention, but that is part of https://github.com/djangonaut-space/wagtail-indymeet/issues/310 as well.