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] name-non-ascii: Prevents file or directory names with ASCII characters #134

Merged

Conversation

maneandrea
Copy link
Contributor

Adds a fail language hook to validate filenames. This particular hook simply verifies that the filename does not contain spaces, but it can be extended to more general requirements.

@maneandrea
Copy link
Contributor Author

Functional test:

fail_language

@moylop260 Can you review?

@maneandrea maneandrea force-pushed the pre-commit_no-whitespace-filename_andrea branch from 24ad585 to dc06ea8 Compare August 7, 2024 18:02
@moylop260
Copy link
Collaborator

Could you check the red CI, please?

If the error is related with this change create only one commit for both changes

But if the error is not related 2 commits separated (same PR since that there is not another PR opened), please

@maneandrea maneandrea force-pushed the pre-commit_no-whitespace-filename_andrea branch 2 times, most recently from 541c548 to 7321c0d Compare August 7, 2024 18:36
@moylop260 moylop260 force-pushed the pre-commit_no-whitespace-filename_andrea branch from 7531a97 to cc008b9 Compare August 14, 2024 19:19
@codecov-commenter
Copy link

codecov-commenter commented Aug 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 80.23%. Comparing base (035b03a) to head (cc970eb).
Report is 57 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #134      +/-   ##
==========================================
+ Coverage   78.09%   80.23%   +2.14%     
==========================================
  Files           4        4              
  Lines         420      425       +5     
==========================================
+ Hits          328      341      +13     
+ Misses         92       84       -8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@moylop260
Copy link
Collaborator

@maneandrea

I just fixed the CI from #135

This lint should validate that the named of the file is snake_case without accents or special chars

I mean:

I think the following regex could work but not sure:
(\.|\_|[a-z0-9])+

@moylop260 moylop260 force-pushed the pre-commit_no-whitespace-filename_andrea branch from cc008b9 to ed251be Compare August 14, 2024 20:51
@moylop260 moylop260 force-pushed the pre-commit_no-whitespace-filename_andrea branch from ed251be to cc970eb Compare August 14, 2024 20:52
@moylop260 moylop260 self-assigned this Aug 14, 2024
@moylop260
Copy link
Collaborator

Unittest result in the CI:

  • Screenshot 2024-08-14 at 3 01 50 p m

@moylop260 moylop260 merged commit 5644cf5 into Vauxoo:main Aug 14, 2024
20 checks passed
@moylop260 moylop260 deleted the pre-commit_no-whitespace-filename_andrea branch August 14, 2024 21:03
@moylop260
Copy link
Collaborator

moylop260 commented Aug 14, 2024

For record, inspired on https://www.odoo.com/documentation/17.0/es/contributing/development/coding_guidelines.html#file-naming

Special thank you to @sebasdrk17 because of take care to report it and @imanie383 complementing extra guidelines info

@maneandrea
Copy link
Contributor Author

maneandrea commented Aug 14, 2024

Oh, I just noticed that you pushed a new commit. I had come up with this regex:

(?a)^(?!\.).*[^\w.]

Which forbids - but only if the file does not start with .. But nevermind, like this is easier.

@moylop260 moylop260 changed the title [ADD] adds new hook: prevents files from having whitespaces in their name [ADD] name-non-ascii: Prevents file or directory names with ASCII characters Aug 15, 2024
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.

3 participants