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

Pre commit full #30

Merged
merged 3 commits into from
Nov 29, 2023
Merged

Pre commit full #30

merged 3 commits into from
Nov 29, 2023

Conversation

jpodivin
Copy link
Collaborator

All currently defined linters were applied to the repo and exclusion pattern was removed to make sure we maintain this level of coverage.

In several cases, the linters were not behaving in a sensible manner and their settings had to be adjusted.

This PR should be considered with care, because once established the standard of code may be difficult to change.

@nikromen
Copy link
Member

This PR should be considered with care, because once established the standard of code may be difficult to change.

I agree... the pre-commit file as it is in the project was only for my usage so I don't have to format the code manually. Extending and enforcing it globally needs approval also from @praiskup and @FrostyX. But since we don't plan to make changes in this repo this week we could discuss it next Tuesday on mtg

Copy link
Collaborator

@TomasTomecek TomasTomecek left a comment

Choose a reason for hiding this comment

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

Wow, impressive!

Agreed with @nikromen to discuss this PR on the next meeting.

I will review it in detail on Monday.

@FrostyX
Copy link
Member

FrostyX commented Nov 26, 2023

Thank you for the changes @jpodivin,

This PR should be considered with care, because once established the standard of code may be difficult to change.

Are any other formatting options available or this is the standard? :-)

There are some minor things like {% extends "layout.html" %} {%block content %} or the number of blank lines between headings in markdown that I preferred before this change, so if the linters give us any choices, those would be my preferences.

But I don't really mind. Adhering to any standard is better than chaos.

@jpodivin
Copy link
Collaborator Author

Thank you for the changes @jpodivin,

This PR should be considered with care, because once established the standard of code may be difficult to change.

Are any other formatting options available or this is the standard? :-)

There are some minor things like {% extends "layout.html" %} {%block content %} or the number of blank lines between headings in markdown that I preferred before this change, so if the linters give us any choices, those would be my preferences.

But I don't really mind. Adhering to any standard is better than chaos.

Standard is a loaded term. PEP8 is sometimes considered a standard, but even the PEP8 itself states that it shouldn't be taken slavishly [0]. This is one of the reasons I, personally, don't like opinionated linters.
Checks for syntax are fine, but various prettifiers are, imho, not as useful.

In fact they can become a detriment. As they kick in the moment you hit commit and suddenly you have to go back to check what they did, add their changes to yours, and then hit commit again. It just breaks the flow.

My recommendation would be:

  • Checks - yes
  • symlinks - yes
  • secret detector - yes
  • pretty formatters - nope
  • flake8 - yes but with some changes, most importantly the line length. 80 is absurdly few chars, I think about 100 fits on most screens.

[0] https://peps.python.org/pep-0008/#a-foolish-consistency-is-the-hobgoblin-of-little-minds

@nikromen
Copy link
Member

nikromen commented Nov 28, 2023

sum up from what we agreed on the meeting:

  • we don't want opinionated automatic formatters (thus deleting darker for formatting python code, pretty-format-json for jsons and prettier for basically everything :D)
  • we are OK with the rest of linters/checkers

I think this is close to what you Jirko suggested. Could you please update the PR?

@nikromen
Copy link
Member

flake8 - yes but with some changes, most importantly the line length. 80 is absurdly few chars, I think about 100 fits on most screens.

I don't have an opinion on this, both 100 or 88 is ok with me :D

Signed-off-by: Jiri Podivin <[email protected]>
yaml linter allows for multiple documents in a single file

package json files are now skipped by json pretty linter, as it is too opinionated

closed tags in frontend layout

Signed-off-by: Jiri Podivin <[email protected]>
Opinionated formatters were removed, the line length limit was increased to 100 chars.

Signed-off-by: Jiri Podivin <[email protected]>
@jpodivin
Copy link
Collaborator Author

sum up from what we agreed on the meeting:

* we don't want opinionated automatic formatters (thus deleting `darker` for formatting python code, `pretty-format-json` for jsons and `prettier` for basically everything :D)

* we are OK with the rest of linters/checkers

I think this is close to what you Jirko suggested. Could you please update the PR?

Final patch takes these into account. Github checks should sync with the new settings automatically starting with this PR.

@FrostyX
Copy link
Member

FrostyX commented Nov 29, 2023

@nikromen you understand this much better than me. Can you please review if this matches what we wanted and merge if yes?

Copy link
Member

@nikromen nikromen left a comment

Choose a reason for hiding this comment

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

lgtm

@FrostyX FrostyX merged commit fcde95a into fedora-copr:main Nov 29, 2023
1 check passed
@jpodivin jpodivin deleted the pre-commit-full branch January 18, 2024 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants