rengine icon indicating copy to clipboard operation
rengine copied to clipboard

feat: Ruff linter

Open jxdv opened this issue 1 year ago • 9 comments

Is there an existing feature or issue for this?

  • [X] I have searched the existing issues

Expected feature

Currently the styling of the python codebase is inconsistent. Some examples:

  • Mixing up naming conventions (some functions use snake case / camel case etc.)
  • Some files follow the PEP8 spacing between functions / classes / constants etc. and some don't.

Proposed solution: Writing a GitHub action for Ruff linter. Of course this would take quite a while to refactor the whole codebase, but I can see the project benefitting from it.

Alternative solutions

No response

Anything else?

No response

jxdv avatar Dec 12 '23 17:12 jxdv

👋 Hi @jxdv, Issues is only for reporting a bug/feature request. Please read documentation before raising an issue https://rengine.wiki For very limited support, questions, and discussions, please join reNgine Discord channel: https://discord.gg/azv6fzhNCE Please include all the requested and relevant information when opening a bug report. Improper reports will be closed without any response.

github-actions[bot] avatar Dec 12 '23 17:12 github-actions[bot]

Totally agree with that Some file have spaces indent, some tabs ... We need some refactoring jobs

psyray avatar Dec 16 '23 18:12 psyray

Totally agree with that Some file have spaces indent, some tabs ... We need some refactoring jobs

Do you have experience with that? I don't, but I could look into it when I have more time.

AnonymousWP avatar Dec 16 '23 18:12 AnonymousWP

Yes, I coud work on it.

For example, in the same folder web/reNgine

tasks.py have tabs image

common_serializers.py have spaces image

psyray avatar Dec 16 '23 18:12 psyray

I can create a PR for this if you're interested, but the refactoring obviously would have to be a team effort. It's gonna take quite some time.

jxdv avatar Dec 16 '23 19:12 jxdv

If you can, yes please. Don't forget to use the closing keywords for this issue. But wait, doesn't this GitHub Action refactor the entire codebase by itself? In other words: it doesn't need to be done manually, right? From what I'm understanding of the repo, that is.

AnonymousWP avatar Dec 16 '23 20:12 AnonymousWP

Yes, Ruff can fix some stuff by itself using --fix, but there are also unsafe fixes which I prefer the devs look at as these could cause some troubles and break some backend stuff.

jxdv avatar Dec 16 '23 20:12 jxdv

@AnonymousWP I am wondering how would you like to see the linked PRs to this..1 PR just for the implementation of Ruff itself, and the second one for the big python cleanup?

jxdv avatar Dec 17 '23 16:12 jxdv

@AnonymousWP I am wondering how would you like to see the linked PRs to this..1 PR just for the implementation of Ruff itself, and the second one for the big python cleanup?

Yep, correct. Maybe a separate issue to refactor the code and then link the PR of the big Python cleanup to it.

AnonymousWP avatar Dec 17 '23 16:12 AnonymousWP