Seluj78 / flask-utils

Various Flask utilities that I find useful in my projects
GNU General Public License v3.0
2 stars 1 forks source link

Add flake8 bugbear #22

Closed Mews closed 1 month ago

Mews commented 1 month ago

Created this pull request in regards to issue #9

Changes

Summary by CodeRabbit

coderabbitai[bot] commented 1 month ago

[!IMPORTANT]

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Files selected but had no reviewable changes (1) * tox.ini

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

This update enhances the development and continuous integration process for the Seluj78/flask-utils repository. Key changes include the addition of flake8-bugbear verification in linting, new dependencies in requirements-dev.txt, a new GitHub Actions workflow for coverage using Codecov, and a Codecov badge in the README. These improvements aim to ensure code quality and provide better insights into test coverage.

Changes

File Change Summary
.github/workflows/linting.yml Added a verification step for flake8 to ensure it picks up flake8-bugbear by running flake8 --version.
requirements-dev.txt Added new packages: coverage, flake8-bugbear, and pytest-cov. Maintained existing packages.
.github/workflows/coverage.yml Introduced a new workflow named "Coverage" that runs on PRs and pushes to the main branch, using tox and uploading reports to Codecov.
README.md Added Codecov badge to display test coverage status.

Poem

In code we trust, with linting tight,
Flake8-bugbear joins the fight.
Coverage reports, now we see,
With badges shining, proud and free.
Dependencies strong, our tests will run,
In Python's world, our work is done.
🐇✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)
Tips ### Chat There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai): - Review comments: Directly reply to a review comment made by CodeRabbit. Example: - `I pushed a fix in commit .` - `Generate unit testing code for this file.` - `Open a follow-up GitHub issue for this discussion.` - Files and specific lines of code (under the "Files changed" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples: - `@coderabbitai generate unit testing code for this file.` - `@coderabbitai modularize this function.` - PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples: - `@coderabbitai generate interesting stats about this repository and render them as a table.` - `@coderabbitai show all the console.log statements in this repository.` - `@coderabbitai read src/utils.ts and generate unit testing code.` - `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.` - `@coderabbitai help me debug CodeRabbit configuration file.` Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. ### CodeRabbit Commands (invoked as PR comments) - `@coderabbitai pause` to pause the reviews on a PR. - `@coderabbitai resume` to resume the paused reviews. - `@coderabbitai review` to trigger an incremental review. This is useful when automatic reviews are disabled for the repository. - `@coderabbitai full review` to do a full review from scratch and review all the files again. - `@coderabbitai summary` to regenerate the summary of the PR. - `@coderabbitai resolve` resolve all the CodeRabbit review comments. - `@coderabbitai configuration` to show the current CodeRabbit configuration for the repository. - `@coderabbitai help` to get help. Additionally, you can add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed. ### CodeRabbit Configration File (`.coderabbit.yaml`) - You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository. - Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information. - If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json` ### Documentation and Community - Visit our [Documentation](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit. - Join our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback. - Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.
Seluj78 commented 1 month ago

Hi there ! Thank you for the PR @Mews !

On the code side, it looks great to me ! 🙌

As for the commits, I would like you to adhere to the guideline (you can use scripts/lint-commits.sh to check if they match).

Also I prefer to use rebase instead of merge to update branches. Could you do this and then we'll be able to merge your PR 🔥

Mews commented 1 month ago

Hi, sorry but this is my first time opening a pr and I'm still learning this git stuff so I'm not entirely sure how to fix those. Did I understand correctly that the commit messages should follow some sort of format? If so, is there some way to edit the commit messages or how do I proceed? Also I don't know what you mean by using rebase instead of merge. Sorry for the trouble

Seluj78 commented 1 month ago

Hi, sorry but this is my first time opening a pr and I'm still learning this git stuff so I'm not entirely sure how to fix those. Did I understand correctly that the commit messages should follow some sort of format? If so, is there some way to edit the commit messages or how do I proceed? Also I don't know what you mean by using rebase instead of merge. Sorry for the trouble

Hey no worries, I'm happy to help ! We all had to learn at some point !

So yes that is correct. I personally like my commits to follow a format, which you can find described here. You can also find examples of commit messages following the rules here

As for editing a commit, I recommend you search online either how to do an interactive rebase (git rebase -i) or use a UI editor which would allow you do to this easily.

Same thing for merge vs rebase, I advise you search online for what the difference are and how you can rebase your branch onto main :)

I am not trying to be rude/lazy by not responding to your questions directly :) The biggest thing you can learn to be a good software engineer is searching yourself ;) Do let me know if you get stuck

Mews commented 1 month ago

@Seluj78 Maybe I'm wrong but it looks like I can only change the messages on commits that haven't been pushed? I tried using git commit --amend -m "the message..." and then git rebase --continue but it didn't change any message, and then I tried using github desktop but it looks like there's no option for that either

Also I'm a bit confused about what you said about preferring rebase instead of merge to update branches. I probably understood it wrong, but isn't that something that you would have to do on your side?

Also, I was gonna change the commit messages to the following CI/CD: Verify flake8 is picking up flake8-bugbear and Chore: Add flake8-bugbear to dev requirements I couldn't really figure out how to run the lint-commits.sh script so I'd just like to confirm that these messages are okay

Mews commented 1 month ago

Update: I think I figured out how to do it from this article https://docs.github.com/en/pull-requests/committing-changes-to-your-project/creating-and-editing-commits/changing-a-commit-message#commit-has-not-been-pushed-online

However, doing git rebase -i HEAD~3 opens some sort of text editor. I am able to replace pick with reword as per the article's instructions, but then I dont know how to save the file

Mews commented 1 month ago

@Seluj78 Okay I managed to change the commit messages! Now I just need help with that rebase vs merge thing

Seluj78 commented 1 month ago

@Seluj78 Okay I managed to change the commit messages! Now I just need help with that rebase vs merge thing

That's great !

Indeed, you can do an interactive rebase to reword the commits like you did, which is perfect ! And yes, renaming your latest commit is easier since you can simply do git commit --amend :)

Now as for rebase vs merge, if you look at https://github.com/Seluj78/flask-utils/pull/22/commits and https://github.com/Seluj78/flask-utils/pull/22/files you can see that you have merged into this branch extra stuff that is not needed. A merge will add the changes on top of what you've made, whereas a rebase will place your new changes on top, which is what we want to have a nice history.

What you need to do it checkout your main branch, update it from my remote (search on google how to update forked remote branch), then checkout your branch against, and do a git rebase main and it will do it magically. Then all you need to do is git push --force. More info can be found here: https://git-scm.com/book/en/v2/Git-Branching-Rebasing

Mews commented 1 month ago

I don't think it did what it was supposed to ngl I did git checkout main git fetch upstream git rebase upstream/main git checkout add-flake8-bugbear git rebase main and git push --force

Seluj78 commented 1 month ago

Hmm indeed it does seem to have removed your changes. Do you remember what you did to do it again ? What I would advise you to do is:

Mews commented 1 month ago

Yeah I'll just make the branch again :P