Skip to content
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

Add Pylint CI #38

Merged
merged 1 commit into from
Jun 29, 2024
Merged

Add Pylint CI #38

merged 1 commit into from
Jun 29, 2024

Conversation

winstonsung
Copy link
Collaborator

@winstonsung winstonsung commented Apr 6, 2024

Bug: #37
Bug: #38
Change-Id: I2e16cb11fc055c181df8234a8d3004977d352b02

Summary by CodeRabbit

  • New Features

    • Added a new GitHub Actions workflow to run Pylint for Python code analysis on various triggers.
  • Bug Fixes

    • Updated the database context from "Discord" to "CTF" for managing user points.
  • Configuration

    • Adjusted Pylint configuration settings for improved code linting, including formatting rules, naming styles, and linter checks.

Sequence Diagram(s) (Beta)

sequenceDiagram
    actor Developer
    participant GitHub
    participant GitHub Actions
    participant Python Code
    Developer ->> GitHub: Push code / Create PR
    GitHub ->> GitHub Actions: Trigger Pylint workflow
    GitHub Actions ->> Python Code: Set up Python environment
    GitHub Actions ->> Python Code: Install dependencies
    GitHub Actions ->> Python Code: Run Pylint
    Python Code ->> GitHub Actions: Pylint results
    GitHub Actions ->> Developer: Report Pylint results
Loading

winstonsung added a commit to winstonsung/scaict-uwu that referenced this pull request Apr 6, 2024
Bug: SCAICT#37
Bug: SCAICT#38
Change-Id: I2e16cb11fc055c181df8234a8d3004977d352b02
winstonsung added a commit to winstonsung/scaict-uwu that referenced this pull request Apr 6, 2024
Bug: SCAICT#37
Bug: SCAICT#38
Change-Id: I2e16cb11fc055c181df8234a8d3004977d352b02
winstonsung added a commit to winstonsung/scaict-uwu that referenced this pull request Apr 6, 2024
Bug: SCAICT#37
Bug: SCAICT#38
Change-Id: I2e16cb11fc055c181df8234a8d3004977d352b02
winstonsung added a commit to winstonsung/scaict-uwu that referenced this pull request Apr 6, 2024
Bug: SCAICT#37
Bug: SCAICT#38
Change-Id: I2e16cb11fc055c181df8234a8d3004977d352b02
@winstonsung winstonsung force-pushed the dev-38 branch 2 times, most recently from 115226f to 54d6d35 Compare April 6, 2024 17:17
winstonsung added a commit to winstonsung/scaict-uwu that referenced this pull request Apr 6, 2024
Bug: SCAICT#37
Bug: SCAICT#38
Change-Id: I2e16cb11fc055c181df8234a8d3004977d352b02
winstonsung added a commit to winstonsung/scaict-uwu that referenced this pull request Apr 6, 2024
Bug: SCAICT#37
Bug: SCAICT#38
Change-Id: I2e16cb11fc055c181df8234a8d3004977d352b02
@Edit-Mr
Copy link
Member

Edit-Mr commented Apr 7, 2024

@winstonsung 應該 Test 3.11 就好了。Pycord 比較龜毛一點

winstonsung added a commit to winstonsung/scaict-uwu that referenced this pull request Apr 8, 2024
Bug: SCAICT#37
Bug: SCAICT#38
Change-Id: I2e16cb11fc055c181df8234a8d3004977d352b02
winstonsung added a commit to winstonsung/scaict-uwu that referenced this pull request Apr 8, 2024
Bug: SCAICT#37
Bug: SCAICT#38
Change-Id: I2e16cb11fc055c181df8234a8d3004977d352b02
winstonsung added a commit to winstonsung/scaict-uwu that referenced this pull request Apr 8, 2024
Bug: SCAICT#37
Bug: SCAICT#38
Change-Id: I2e16cb11fc055c181df8234a8d3004977d352b02
winstonsung added a commit to winstonsung/scaict-uwu that referenced this pull request Apr 8, 2024
Bug: SCAICT#37
Bug: SCAICT#38
Change-Id: I2e16cb11fc055c181df8234a8d3004977d352b02
winstonsung added a commit to winstonsung/scaict-uwu that referenced this pull request Apr 8, 2024
Bug: SCAICT#37
Bug: SCAICT#38
Change-Id: I2e16cb11fc055c181df8234a8d3004977d352b02
winstonsung added a commit to winstonsung/scaict-uwu that referenced this pull request Apr 8, 2024
Bug: SCAICT#37
Bug: SCAICT#38
Change-Id: I2e16cb11fc055c181df8234a8d3004977d352b02
@winstonsung
Copy link
Collaborator Author

@winstonsung 應該 Test 3.11 就好了。Pycord 比較龜毛一點

Matrix changed to Python 3.11, 3.12.

winstonsung added a commit to winstonsung/scaict-uwu that referenced this pull request Apr 8, 2024
Bug: SCAICT#37
Bug: SCAICT#38
Change-Id: I2e16cb11fc055c181df8234a8d3004977d352b02
@winstonsung winstonsung changed the base branch from main to development April 25, 2024 00:45
winstonsung added a commit to winstonsung/scaict-uwu that referenced this pull request Apr 25, 2024
Bug: SCAICT#37
Bug: SCAICT#38
Change-Id: I2e16cb11fc055c181df8234a8d3004977d352b02
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE

Commits

Files that changed from the base of the PR and between 5f8aeed and 32668e5.

Files selected for processing (1)
  • .github/workflows/pylint.yml (1 hunks)
Additional comments not posted (5)
.github/workflows/pylint.yml (5)

3-6: Triggers are set up correctly. 🐾

This standard setup ensures that the workflow runs on PRs, direct pushes, and can be manually triggered, which is ideal for continuous integration processes.


9-13: Job setup looks good, but consider broader Python version testing. 🐱

The use of ubuntu-latest ensures the latest stable environment. However, limiting to Python 3.11 might miss issues in other versions. Consider testing with additional versions if dependencies allow.


15-19: Python setup is correctly configured. 🐈

Using actions/setup-python@v3 with matrix strategy for the Python version ensures flexibility and consistency across runs.


20-23: Efficient dependency management. 🐾

Upgrading pip before installing packages ensures that the latest features and security fixes of pip are used. The combined pip install command is efficient and reduces the complexity of the workflow script.


24-26: Consider using find for a more inclusive file selection. 🐱

Using git ls-files '*.py' limits linting to tracked files. Consider using find . -name "*.py" to include all Python files in the repository, ensuring a more thorough analysis.

-        pylint $(git ls-files '*.py')
+        pylint $(find . -name "*.py")

winstonsung added a commit to winstonsung/scaict-uwu that referenced this pull request Jun 27, 2024
Bug: SCAICT#37
Bug: SCAICT#38
Change-Id: I2e16cb11fc055c181df8234a8d3004977d352b02
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE

Commits

Files that changed from the base of the PR and between 32668e5 and 86f8825.

Files selected for processing (2)
  • .github/workflows/pylint.yml (1 hunks)
  • .pylintrc (1 hunks)
Additional comments not posted (12)
.github/workflows/pylint.yml (3)

3-6: LGTM! Good choice of triggers for the workflow.

The use of pull_request, push, and workflow_dispatch ensures that the code is linted in various scenarios, maintaining code quality.


10-13: Configuration looks purrfect!

Running on ubuntu-latest and using Python 3.11 is a solid choice for ensuring the workflow is up-to-date.


26-26: Consider using find instead of git ls-files to ensure all Python files are linted.

This approach ensures that all Python files, including those not tracked by Git, are analyzed.

.pylintrc (9)

6-6: Good choice to disable analyse-fallback-blocks.

Disabling this prevents false positives in a Python 3-only codebase, keeping lint checks relevant.


11-11: Enabling clear-cache-post-run is a wise move.

This ensures that each lint run starts fresh, which can help in detecting issues that might be missed otherwise.


77-77: Setting jobs to 0 to auto-detect processor count is efficient.

This allows Pylint to run faster by utilizing available processors optimally.


97-97: Enabling recursive checking is essential for comprehensive linting.

This ensures that all Python files in subdirectories are included, improving the thoroughness of checks.


107-107: Suggestion mode activation is helpful for developers.

This feature provides actionable suggestions instead of just flagging issues, which is great for learning and improving code quality.


327-327: Setting line-ending format to LF is a good standardization practice.

This helps in maintaining consistency across different development environments.


339-339: Adjusting max-line-length to 100 is reasonable.

It strikes a balance between readability and allowing sufficient line length for more complex expressions.


456-456: Specifying timeout methods for requests API is a prudent safety measure.

This ensures that methods that can potentially hang are handled properly, improving reliability.


554-554: Enabling quote consistency checks promotes code uniformity.

Consistent use of quotes in a project improves readability and reduces stylistic conflicts.

winstonsung added a commit to winstonsung/scaict-uwu that referenced this pull request Jun 27, 2024
Bug: SCAICT#37
Bug: SCAICT#38
Change-Id: I2e16cb11fc055c181df8234a8d3004977d352b02
winstonsung added a commit to winstonsung/scaict-uwu that referenced this pull request Jun 27, 2024
Bug: SCAICT#37
Bug: SCAICT#38
Change-Id: I2e16cb11fc055c181df8234a8d3004977d352b02
winstonsung added a commit to winstonsung/scaict-uwu that referenced this pull request Jun 27, 2024
Bug: SCAICT#37
Bug: SCAICT#38
Change-Id: I2e16cb11fc055c181df8234a8d3004977d352b02
winstonsung added a commit to winstonsung/scaict-uwu that referenced this pull request Jun 27, 2024
- C0103 invalid-name
- C0303 trailing-whitespace
- C0304 missing-final-newline
- C0325 superfluous-parens
- C0328 unexpected-line-ending-format
- C0411 wrong-import-order
- R1710 inconsistent-return-statements
- W0621 redefined-outer-name
- W0622 redefined-builtin

Bug: SCAICT#37
Bug: SCAICT#38
Bug: SCAICT#73
Change-Id: Iedd924c8ea2a834f1ccc41d4fa4170f04fb24ed9
winstonsung added a commit to winstonsung/scaict-uwu that referenced this pull request Jun 27, 2024
Bug: SCAICT#37
Bug: SCAICT#38
Change-Id: I2e16cb11fc055c181df8234a8d3004977d352b02
@winstonsung
Copy link
Collaborator Author

@winstonsung winstonsung marked this pull request as ready for review June 27, 2024 13:14
winstonsung added a commit to winstonsung/scaict-uwu that referenced this pull request Jun 29, 2024
Bug: SCAICT#37
Bug: SCAICT#38
Change-Id: I2e16cb11fc055c181df8234a8d3004977d352b02
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Review details

Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE

Commits

Files that changed from the base of the PR and between 86f8825 and 6640c7e.

Files selected for processing (2)
  • .github/workflows/pylint.yml (1 hunks)
  • .pylintrc (1 hunks)
Additional comments not posted (7)
.github/workflows/pylint.yml (2)

3-6: Purrfect! The trigger events are well-defined.

The workflow triggers on pull requests, pushes, and manual dispatches, ensuring comprehensive CI coverage.


13-13: Consider adding Python 3.12 to the matrix.

Ensuring compatibility with the latest Python versions is a good practice.

python-version: [ "3.11", "3.12" ]
.pylintrc (5)

6-11: Great configuration updates!

The changes to analyse-fallback-blocks and clear-cache-post-run improve compatibility and performance.


119-207: Consistent naming conventions and helpful hints.

The updates to naming styles and the inclusion of naming hints are beneficial.


331-344: Consistent formatting and readability.

The updates to line endings, indentation, and maximum line length are well-chosen.


435-455: Verify the reasoning behind disabling these checks.

Disabling checks for docstrings, line length, and other metrics might reduce code quality. Ensure this aligns with project standards.


467-467: Good practice to enforce timeouts.

Requiring a timeout for specific methods ensures network requests do not hang indefinitely.

.github/workflows/pylint.yml Show resolved Hide resolved
winstonsung added a commit to winstonsung/scaict-uwu that referenced this pull request Jun 29, 2024
Bug: SCAICT#37
Bug: SCAICT#38
Change-Id: I2e16cb11fc055c181df8234a8d3004977d352b02
Bug: SCAICT#37
Bug: SCAICT#38
Change-Id: I2e16cb11fc055c181df8234a8d3004977d352b02
@winstonsung winstonsung merged commit 4a8db96 into SCAICT:development Jun 29, 2024
1 check passed
@winstonsung winstonsung deleted the dev-38 branch June 29, 2024 04:20
@winstonsung winstonsung linked an issue Jun 29, 2024 that may be closed by this pull request
@winstonsung winstonsung added this to the 0.1.7 milestone Jul 23, 2024
@winstonsung winstonsung added the enhancement New feature or request label Jul 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Pylint CI
2 participants