fix/nonascii_attributes #69

Merged
张泊明518370910136 merged 11 commits from fix/nonascii_attributes into master 2024-10-21 17:04:53 +08:00
No description provided.
周赵嘉程521432910016 added 5 commits 2024-10-21 15:50:40 +08:00
feat(healthcheck/nonascii): ignore content in gitattributes
Some checks failed
build / build (push) Failing after 47s
build / trigger-build-image (push) Has been skipped
55e2b38583
feat(healthcheck/nonascii): ignore content in gitattributes
Some checks failed
build / build (push) Failing after 48s
build / trigger-build-image (push) Has been skipped
348eaa247c
fix(healthcheck/utils): unused function
Some checks failed
build / build (push) Failing after 1m25s
build / trigger-build-image (push) Has been skipped
c8f377245f
fix(healthcheck/nonasciifile): no gitattributes
Some checks failed
build / build (push) Failing after 1m30s
build / trigger-build-image (push) Has been skipped
decadeaef1
fix(healthcheck/nonasciifile): no gitattributes
All checks were successful
build / build (push) Successful in 1m19s
build / trigger-build-image (push) Has been skipped
build / build (pull_request) Successful in 1m19s
build / trigger-build-image (pull_request) Has been skipped
373d31cb5c
周赵嘉程521432910016 requested review from 张泊明518370910136 2024-10-21 15:50:52 +08:00
张泊明518370910136 requested changes 2024-10-21 16:11:44 +08:00
Dismissed
张泊明518370910136 left a comment
Owner

Where does the code match the -text in .gitattributes?

Also, we need some lines like README.md diff in .gitattributes in the test case to make sure it only matches -text files.

Where does the code match the `-text` in `.gitattributes`? Also, we need some lines like `README.md diff` in `.gitattributes` in the test case to make sure it only matches `-text` files.
@ -43,6 +43,7 @@ func main() {
showVersion := flag.Bool("version", false, "print current version")
rootDir := flag.String("root", ".", "root dir for forbidden files check")
repoSize := flag.Float64("repoSize", 2, "maximum size of the repo in MiB")
// TODO: remove gitWhitelist, it is only for backward compatibility now

typo here

typo here

i mean it should be "remove localList" here, and "remove gitWhitelist“ down there

i mean it should be "remove localList" here, and "remove gitWhitelist“ down there
zzjc123 marked this conversation as resolved
@ -31,3 +19,1 @@
if err := scanner.Err(); err != nil {
return nil, fmt.Errorf("Error reading file %s: %v\n", localList, err)
}
noAttri := false

the naming is weird, we need to think what is !noAttri. Just sth like gitattributesExist.

the naming is weird, we need to think what is `!noAttri`. Just sth like `gitattributesExist`.
zzjc123 marked this conversation as resolved
@ -40,3 +44,3 @@
if info.IsDir() {
if info.Name() == ".git" || info.Name() == ".gitea" || info.Name() == "ci" || (localList != "" && inString(info.Name(), dirs)) {
if info.Name() == ".git" || info.Name() == ".gitea" {

Can we check the .gitea dir now?

Can we check the `.gitea` dir now?
zzjc123 marked this conversation as resolved
@ -50,6 +54,18 @@ func getNonAscii(root string, localList string) ([]string, error) {
return nil

and can this healthcheck skip be removed now?

and can this healthcheck skip be removed now?
Author
Member

no we can't for now.

no we can't for now.

what about now?

what about now?
Author
Member

what do you mean? for now we still need to copy the healthcheck bin into /w to run for test case. I don't now what's the better solution.

what do you mean? for now we still need to copy the healthcheck bin into /w to run for test case. I don't now what's the better solution.
Author
Member

oh sorry, I didn't see your commit. I will try it soon.

oh sorry, I didn't see your commit. I will try it soon.
Author
Member

it got fixed.

it got fixed.
zzjc123 marked this conversation as resolved
@ -53,0 +59,4 @@
if err != nil {
return err
}
str := strings.Split(relPath, "/")

just

			if _, ret := matcher.Match(strings.Split(relPath, "/"), nil); ret {
				return nil
			}
just ```go if _, ret := matcher.Match(strings.Split(relPath, "/"), nil); ret { return nil } ```
zzjc123 marked this conversation as resolved
周赵嘉程521432910016 added 1 commit 2024-10-21 16:21:15 +08:00
fix(healthcheck/nonasciifile): comment, code style and check range
Some checks failed
build / build (push) Failing after 1m18s
build / trigger-build-image (push) Has been skipped
build / build (pull_request) Failing after 1m17s
build / trigger-build-image (pull_request) Has been skipped
68e4c8e01e
Author
Member

will ta add text file into gitattributes?

Where does the code match the -text in .gitattributes?

Also, we need some lines like README.md diff in .gitattributes in the test case to make sure it only matches -text files.

will ta add text file into gitattributes? > > Where does the code match the -text in .gitattributes? > > Also, we need some lines like README.md diff in .gitattributes in the test case to make sure it only matches -text files.

-text means not text. it is possible to add other files with other attributes in .gitattributes.

`-text` means not text. it is possible to add other files with other attributes in `.gitattributes`.
Author
Member

I know, I mean if ta only add no text file regex into gitattributes then there is no need to support this feature?

I know, I mean if ta only add no text file regex into gitattributes then there is no need to support this feature?

it is possible to add other files with other attributes in .gitattributes.

it is possible to add other files with other attributes in `.gitattributes`.
周赵嘉程521432910016 added 1 commit 2024-10-21 16:31:18 +08:00
fix(healthcheck/nonasciifile): revert skip healthcheck
Some checks failed
build / trigger-build-image (push) Blocked by required conditions
build / build (push) Has been cancelled
build / build (pull_request) Successful in 1m10s
build / trigger-build-image (pull_request) Has been skipped
3fdad5f70e
周赵嘉程521432910016 added 1 commit 2024-10-21 16:32:27 +08:00
fix(healthcheck/nonasciifile): typo
All checks were successful
build / build (push) Successful in 1m8s
build / build (pull_request) Successful in 1m8s
build / trigger-build-image (push) Has been skipped
build / trigger-build-image (pull_request) Has been skipped
375c874734
周赵嘉程521432910016 added 1 commit 2024-10-21 16:45:28 +08:00
feat(healthcheck/nonasciifile): distinguish no-text and text flag
All checks were successful
build / build (push) Successful in 1m15s
build / build (pull_request) Successful in 1m11s
build / trigger-build-image (push) Has been skipped
build / trigger-build-image (pull_request) Has been skipped
78a711ff3b
Author
Member

Where does the code match the -text in .gitattributes?

Also, we need some lines like README.md diff in .gitattributes in the test case to make sure it only matches -text files.

fixed

> Where does the code match the `-text` in `.gitattributes`? > > Also, we need some lines like `README.md diff` in `.gitattributes` in the test case to make sure it only matches `-text` files. fixed
周赵嘉程521432910016 added 1 commit 2024-10-21 16:49:51 +08:00
fix(healthcheck/nonasciifile): don't skip healthcheck bin
All checks were successful
build / build (pull_request) Successful in 1m9s
build / trigger-build-image (pull_request) Has been skipped
build / build (push) Successful in 1m12s
build / trigger-build-image (push) Has been skipped
c7b8cda34d
张泊明518370910136 reviewed 2024-10-21 16:52:45 +08:00
@ -51,0 +55,4 @@
if err != nil {
return err
}
if ret, matched := matcher.Match(strings.Split(relPath, "/"), nil); matched && ret["text"].IsUnset() {

this line is too long now, should make it in two lines.

this line is too long now, should make it in two lines.
zzjc123 marked this conversation as resolved
周赵嘉程521432910016 added 1 commit 2024-10-21 16:54:40 +08:00
chore(healthcheck/nonasciifile): code style
All checks were successful
build / build (push) Successful in 1m22s
build / build (pull_request) Successful in 1m16s
build / trigger-build-image (push) Has been skipped
build / trigger-build-image (pull_request) Has been skipped
01798453b3
周赵嘉程521432910016 requested review from 张泊明518370910136 2024-10-21 16:58:28 +08:00
张泊明518370910136 approved these changes 2024-10-21 17:04:03 +08:00
张泊明518370910136 merged commit cfc455e0fb into master 2024-10-21 17:04:53 +08:00
张泊明518370910136 deleted branch fix/nonascii_attributes 2024-10-21 17:04:53 +08:00
Sign in to join this conversation.
No description provided.