Skip to content

chore: apply pep8-naming rules for naming convention #8261

New issue

Have a question about this project? No Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “No 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? No Sign in to your account

Merged
merged 19 commits into from
Sep 11, 2024

Conversation

bowenliang123
Copy link
Contributor

@bowenliang123 bowenliang123 commented Sep 11, 2024

Checklist:

Important

Please review the checklist below before submitting your pull request.

  • Please open an issue before creating a PR or link to an existing issue
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I ran dev/reformat(backend) and cd web && npx lint-staged(frontend) to appease the lint gods

Description

  • apply the Ruff's pep8-naming rules N: https://docs.astral.sh/ruff/rules/#pep8-naming-n

  • pep8-naming rules benefits in alignments to PEP8 with:

    • enforce correct usage of@classmethod @staticmethod decorators along with their first argument (N804 rule)
    • enforce CapWords convention in class names
    • enforce Exception name {name} should be named with an Error suffix (N818)
  • add new globally exclude rules:

    • N806 is too strict to enforcing all the variable names in lowercase. We have common usage in getting parameters in tool parameters, which often contains CapWord style.
    • N815 is excluded as we have en_US style available in classes.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update, included: Dify Document
  • Improvement, including but not limited to code refactoring, performance optimization, and UI/UX improvement
  • Dependency upgrade

Testing Instructions

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Test A
  • Test B

@bowenliang123 bowenliang123 marked this pull request as ready for review September 11, 2024 08:10
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. 🐍 python 💪 enhancement New feature or request labels Sep 11, 2024
@bowenliang123
Copy link
Contributor Author

All the suggested changes are made and checked manually, which are also tracable in each commits.
Please have a check at them. cc @laipz8200

@bowenliang123 bowenliang123 changed the title chore: apply pep8-naming ruff rules for naming convension chore: apply pep8-naming ruff rules for naming convention Sep 11, 2024
@bowenliang123 bowenliang123 changed the title chore: apply pep8-naming ruff rules for naming convention chore: apply pep8-naming rules for naming convention Sep 11, 2024
Copy link
Member

@laipz8200 laipz8200 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Sep 11, 2024
@laipz8200 laipz8200 merged commit 292220c into langgenius:main Sep 11, 2024
6 checks passed
@bowenliang123 bowenliang123 deleted the ruff-n branch September 11, 2024 08:41
@bowenliang123
Copy link
Contributor Author

Thanks !

ZhouhaoJiang added a commit that referenced this pull request Sep 12, 2024
* main: (141 commits)
  fix(workflow/hooks/use-shortcuts): resolve issue of copy shortcut not working in workflow debug and preview panel (#8249)
  chore: cleanup pycodestyle E rules (#8269)
  let claude models in bedrock support the response_format parameter (#8220)
  enhance: improve empty data display for detail panel (#8266)
  chore: remove useless code (#8198)
  chore: apply pep8-naming rules for naming convention (#8261)
  fix:ollama text embedding 500 error (#8252)
  Update Gitlab query field, add query by path (#8244)
  editor can also create api key (#8214)
  fix: upload img icon mis-align in the chat input area (#8263)
  fix: truthy value (#8208)
  fix(workflow): IF-ELSE nodes connected to the same subsequent node cause execution to stop (#8247)
  fix: workflow parallel limit in ifelse node (#8242)
  fix: CHECK_UPDATE_URL comment (#8235)
  fix:error when adding the ollama embedding model (#8236)
  fix: improving the regionalization of translation (#8231)
  feat: add from_variable_selector for stream chunk / message event (#8228)
  fix(workflow): answers are output simultaneously across different braches in the question classifier node. (#8225)
  fix(workflow): in multi-parallel execution with multiple conditional branches (#8221)
  fix(docker/docker-compose.yaml): Set default value for `REDIS_SENTINEL_SOCKET_TIMEOUT` and `CELERY_SENTINEL_SOCKET_TIMEOUT` (#8218)
  ...
ZhouhaoJiang added a commit that referenced this pull request Sep 12, 2024
* feat/new-login:
  fix: N817 CamelCase ElementTree imported as acronym ET
  fix: lint error
  fix(workflow/hooks/use-shortcuts): resolve issue of copy shortcut not working in workflow debug and preview panel (#8249)
  chore: cleanup pycodestyle E rules (#8269)
  let claude models in bedrock support the response_format parameter (#8220)
  enhance: improve empty data display for detail panel (#8266)
  chore: remove useless code (#8198)
  chore: apply pep8-naming rules for naming convention (#8261)
  fix:ollama text embedding 500 error (#8252)
  Update Gitlab query field, add query by path (#8244)
  editor can also create api key (#8214)
  fix: upload img icon mis-align in the chat input area (#8263)
  fix: truthy value (#8208)
lau-td pushed a commit to heydevs-io/dify that referenced this pull request Oct 23, 2024
idonotknow pushed a commit to AceDataCloud/Dify that referenced this pull request Nov 16, 2024
No Sign up for free to join this conversation on GitHub. Already have an account? No Sign in to comment
Labels
💪 enhancement New feature or request lgtm This PR has been approved by a maintainer size:L This PR changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants