From 3b47409532c3317116a0bf2a2c49e44b3d96cf36 Mon Sep 17 00:00:00 2001 From: FermeLeLundi Date: Thu, 28 Nov 2024 10:11:36 +0000 Subject: [PATCH 01/16] Update Makefile Typo --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index c79e8167a1..de07b44e14 100644 --- a/Makefile +++ b/Makefile @@ -920,7 +920,7 @@ release-docs: | $(DIST_DIRS) docs .PHONY: reproduce-build reproduce-build: # Start building the Dockerfile with the RELEASE_VERSION tag set. GOPROXY is set -# for convience, because the default of the Dockerfile is `direct` which can be +# for convenience, because the default of the Dockerfile is `direct` which can be # quite slow. @docker build --build-arg="RELEASE_VERSION=$(RELEASE_VERSION)" --build-arg="GOPROXY=$(shell $(GO) env GOPROXY)" --tag "forgejo-reproducibility" . @id=$$(docker create forgejo-reproducibility); \ From 76d011c4b2f4624a2eaf20510753ee8561daa7f3 Mon Sep 17 00:00:00 2001 From: FermeLeLundi Date: Thu, 28 Nov 2024 10:12:46 +0000 Subject: [PATCH 02/16] Update services/context/csrf.go Typo --- services/context/csrf.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/context/csrf.go b/services/context/csrf.go index e0518a499b..51127c6eb0 100644 --- a/services/context/csrf.go +++ b/services/context/csrf.go @@ -49,7 +49,7 @@ type csrfProtector struct { opt CsrfOptions // id must be unique per user. id string - // token is the valid one which wil be used by end user and passed via header, cookie, or hidden form value. + // token is the valid one which will be used by end user and passed via header, cookie, or hidden form value. token string } From decb673f28814ac0e7b0b0684df7516f7062a957 Mon Sep 17 00:00:00 2001 From: FermeLeLundi Date: Thu, 28 Nov 2024 10:13:56 +0000 Subject: [PATCH 03/16] Update services/repository/branch.go Typo --- services/repository/branch.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/repository/branch.go b/services/repository/branch.go index 8d5df98f86..87fe03c12d 100644 --- a/services/repository/branch.go +++ b/services/repository/branch.go @@ -479,7 +479,7 @@ func DeleteBranch(ctx context.Context, doer *user_model.User, repo *repo_model.R return nil } -// DeleteBranchAfterMerge deletes the head branch after a PR was merged assiociated with the head branch. +// DeleteBranchAfterMerge deletes the head branch after a PR was merged associated with the head branch. func DeleteBranchAfterMerge(ctx context.Context, doer *user_model.User, pr *issues_model.PullRequest, headRepo *git.Repository) error { // Don't cleanup when there are other PR's that use this branch as head branch. exist, err := issues_model.HasUnmergedPullRequestsByHeadInfo(ctx, pr.HeadRepoID, pr.HeadBranch) From f0de20e747caff32f9893011bf4cf4a20db3ee6d Mon Sep 17 00:00:00 2001 From: FermeLeLundi Date: Thu, 28 Nov 2024 10:15:54 +0000 Subject: [PATCH 04/16] Update models/git/commit_status_test.go Typos --- models/git/commit_status_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/models/git/commit_status_test.go b/models/git/commit_status_test.go index 0f799f3507..b16fc727e0 100644 --- a/models/git/commit_status_test.go +++ b/models/git/commit_status_test.go @@ -400,14 +400,14 @@ func TestGetLatestCommitStatusForPairs(t *testing.T) { }, pairs) }) - t.Run("Repo 62 nonexistant sha", func(t *testing.T) { + t.Run("Repo 62 non-existent sha", func(t *testing.T) { pairs, err := git_model.GetLatestCommitStatusForPairs(db.DefaultContext, []git_model.RepoSHA{{62, "774f93df12d14931ea93259ae93418da4482fcc"}}) require.NoError(t, err) assert.EqualValues(t, map[int64][]*git_model.CommitStatus{}, pairs) }) - t.Run("SHA with non existant repo id", func(t *testing.T) { + t.Run("SHA with non-existent repo id", func(t *testing.T) { pairs, err := git_model.GetLatestCommitStatusForPairs(db.DefaultContext, []git_model.RepoSHA{{1, "774f93df12d14931ea93259ae93418da4482fcc1"}}) require.NoError(t, err) From 99de40b73e5eefa21da60c608beb0e28324dd10a Mon Sep 17 00:00:00 2001 From: FermeLeLundi Date: Thu, 28 Nov 2024 10:23:45 +0000 Subject: [PATCH 05/16] Update routers/web/repo/issue.go Typo --- routers/web/repo/issue.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routers/web/repo/issue.go b/routers/web/repo/issue.go index e67980a9a9..b86749ec69 100644 --- a/routers/web/repo/issue.go +++ b/routers/web/repo/issue.go @@ -3778,7 +3778,7 @@ func combineRequestReviewComments(issue *issues_model.Issue) { } } - // Propoagate creation time. + // Propagate creation time. prev.CreatedUnix = cur.CreatedUnix // Remove the current comment since it has been combined to prev comment From 01e1bc0cb85bb64c0939fb5677d88349082a6418 Mon Sep 17 00:00:00 2001 From: FermeLeLundi Date: Thu, 28 Nov 2024 10:26:12 +0000 Subject: [PATCH 06/16] Update web_src/js/features/comp/ComboMarkdownEditor.js Typo --- web_src/js/features/comp/ComboMarkdownEditor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web_src/js/features/comp/ComboMarkdownEditor.js b/web_src/js/features/comp/ComboMarkdownEditor.js index 56628f83b0..8ae5defa47 100644 --- a/web_src/js/features/comp/ComboMarkdownEditor.js +++ b/web_src/js/features/comp/ComboMarkdownEditor.js @@ -189,7 +189,7 @@ class ComboMarkdownEditor { const newTableModal = document.querySelector(`div[data-markdown-table-modal-id="${elementId}"]`); const form = newTableModal.querySelector('div[data-selector-name="form"]'); - // Vaildate input fields + // Validate input fields for (const currentInput of form.querySelectorAll('input')) { if (!currentInput.checkValidity()) { currentInput.reportValidity(); From eef6d558777888223a6f2a34a517e6ca80f756f8 Mon Sep 17 00:00:00 2001 From: FermeLeLundi Date: Thu, 28 Nov 2024 10:27:33 +0000 Subject: [PATCH 07/16] Update modules/typesniffer/typesniffer.go Typo --- modules/typesniffer/typesniffer.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/typesniffer/typesniffer.go b/modules/typesniffer/typesniffer.go index 64037af8d3..212e50c4f1 100644 --- a/modules/typesniffer/typesniffer.go +++ b/modules/typesniffer/typesniffer.go @@ -108,7 +108,7 @@ func DetectContentType(data []byte) SniffedType { } } - // AVIF is unsuported by http.DetectContentType + // AVIF is unsupported by http.DetectContentType // Signature taken from https://stackoverflow.com/a/68322450 if bytes.Index(data, []byte("ftypavif")) == 4 { ct = AvifMimeType From 0f64c5a8065e017a010be6bcc86d4e41bf18ca5b Mon Sep 17 00:00:00 2001 From: FermeLeLundi Date: Thu, 28 Nov 2024 10:29:18 +0000 Subject: [PATCH 08/16] Update modules/indexer/code/elasticsearch/elasticsearch.go Typo --- modules/indexer/code/elasticsearch/elasticsearch.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/indexer/code/elasticsearch/elasticsearch.go b/modules/indexer/code/elasticsearch/elasticsearch.go index 5c01034450..311c5fe735 100644 --- a/modules/indexer/code/elasticsearch/elasticsearch.go +++ b/modules/indexer/code/elasticsearch/elasticsearch.go @@ -202,7 +202,7 @@ func (b *Indexer) Index(ctx context.Context, repo *repo_model.Repository, sha st func (b *Indexer) Delete(ctx context.Context, repoID int64) error { if err := b.doDelete(ctx, repoID); err != nil { // Maybe there is a conflict during the delete operation, so we should retry after a refresh - log.Warn("Deletion of entries of repo %v within index %v was erroneus. Trying to refresh index before trying again", repoID, b.inner.VersionedIndexName(), err) + log.Warn("Deletion of entries of repo %v within index %v was erroneous. Trying to refresh index before trying again", repoID, b.inner.VersionedIndexName(), err) if err := b.refreshIndex(ctx); err != nil { return err } From 893c2f2d90b3d599e0f05402bd5809845ac89ce0 Mon Sep 17 00:00:00 2001 From: FermeLeLundi Date: Thu, 28 Nov 2024 10:31:28 +0000 Subject: [PATCH 09/16] Update modules/git/repo_commit.go Typo --- modules/git/repo_commit.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/git/repo_commit.go b/modules/git/repo_commit.go index 16ecb713a0..a2bfa43c09 100644 --- a/modules/git/repo_commit.go +++ b/modules/git/repo_commit.go @@ -23,8 +23,8 @@ func (repo *Repository) GetBranchCommitID(name string) (string, error) { } // GetTagCommitID returns last commit ID string of given tag. If the tag is an -// annoted tag it will return the objectID of that tag instead of the commitID -// the tag is pointing to. `GetTagCommit` handles annoted tags correctly. +// annotated tag it will return the objectID of that tag instead of the commitID +// the tag is pointing to. `GetTagCommit` handles annotated tags correctly. func (repo *Repository) GetTagCommitID(name string) (string, error) { return repo.GetRefCommitID(TagPrefix + name) } From 229cb20f6827ac51654a3b1a9ad0d0e9d140a913 Mon Sep 17 00:00:00 2001 From: FermeLeLundi Date: Thu, 28 Nov 2024 10:34:08 +0000 Subject: [PATCH 10/16] Update modules/keying/keying.go Typo --- modules/keying/keying.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/keying/keying.go b/modules/keying/keying.go index d7dfe0763c..ff3805c14f 100644 --- a/modules/keying/keying.go +++ b/modules/keying/keying.go @@ -1,8 +1,8 @@ // Copyright 2024 The Forgejo Authors. All rights reserved. // SPDX-License-Identifier: MIT -// Keying is a module that allows for subkeys to be determistically generated -// from the same master key. It allows for domain seperation to take place by +// Keying is a module that allows for subkeys to be deterministically generated +// from the same master key. It allows for domain separation to take place by // using new keys for new subsystems/domains. These subkeys are provided with // an API to encrypt and decrypt data. The module panics if a bad interaction // happened, the panic should be seen as an non-recoverable error. @@ -52,8 +52,8 @@ var ( ContextTOTP Context = "totp" ) -// Derive *the* key for a given context, this is a determistic function. The -// same key will be provided for the same context. +// Derive *the* key for a given context, this is a deterministic function. +// The same key will be provided for the same context. func DeriveKey(context Context) *Key { if len(prk) == 0 { panic("keying: not initialized") @@ -77,7 +77,7 @@ type Key struct { // Encrypts the specified plaintext with some additional data that is tied to // this plaintext. The additional data can be seen as the context in which the // data is being encrypted for, this is different than the context for which the -// key was derrived this allows for more granuality without deriving new keys. +// key was derived; this allows for more granularity without deriving new keys. // Avoid any user-generated data to be passed into the additional data. The most // common usage of this would be to encrypt a database field, in that case use // the ID and database column name as additional data. The additional data isn't From 9ae95d7bbb0ecdae4b6064c968747618bac0c6c0 Mon Sep 17 00:00:00 2001 From: FermeLeLundi Date: Thu, 28 Nov 2024 10:35:55 +0000 Subject: [PATCH 11/16] Update modules/keying/keying_test.go Typo --- modules/keying/keying_test.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/keying/keying_test.go b/modules/keying/keying_test.go index 8a6e8d5ab4..d88e907a0b 100644 --- a/modules/keying/keying_test.go +++ b/modules/keying/keying_test.go @@ -15,7 +15,7 @@ import ( ) func TestKeying(t *testing.T) { - t.Run("Not initalized", func(t *testing.T) { + t.Run("Not initialized", func(t *testing.T) { assert.Panics(t, func() { keying.DeriveKey(keying.Context("TESTING")) }) @@ -25,7 +25,7 @@ func TestKeying(t *testing.T) { keying.Init([]byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}) }) - t.Run("Context seperation", func(t *testing.T) { + t.Run("Context separation", func(t *testing.T) { key1 := keying.DeriveKey(keying.Context("TESTING")) key2 := keying.DeriveKey(keying.Context("TESTING2")) @@ -49,20 +49,20 @@ func TestKeying(t *testing.T) { cipherText = key.Encrypt(plainText, []byte{0x05, 0x06}) cipherText2 := key.Encrypt(plainText, []byte{0x05, 0x06}) - // Ensure ciphertexts don't have an determistic output. + // Ensure ciphertexts don't have an deterministic output. assert.NotEqualValues(t, cipherText, cipherText2) }) t.Run("Decrypt", func(t *testing.T) { key := keying.DeriveKey(context) - t.Run("Succesful", func(t *testing.T) { + t.Run("Successful", func(t *testing.T) { convertedPlainText, err := key.Decrypt(cipherText, []byte{0x05, 0x06}) require.NoError(t, err) assert.EqualValues(t, plainText, convertedPlainText) }) - t.Run("Not enougn additional data", func(t *testing.T) { + t.Run("Not enough additional data", func(t *testing.T) { plainText, err := key.Decrypt(cipherText, []byte{0x05}) require.Error(t, err) assert.Empty(t, plainText) From f65fba186915f65b653e17035fbc4f1d5eb3db91 Mon Sep 17 00:00:00 2001 From: FermeLeLundi Date: Thu, 28 Nov 2024 10:38:06 +0000 Subject: [PATCH 12/16] Update tests/integration/codeowner_test.go Typo --- tests/integration/codeowner_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/codeowner_test.go b/tests/integration/codeowner_test.go index 6ef354650b..e8200219c4 100644 --- a/tests/integration/codeowner_test.go +++ b/tests/integration/codeowner_test.go @@ -169,7 +169,7 @@ func TestCodeOwner(t *testing.T) { _, err := db.GetEngine(db.DefaultContext).Cols("is_private").Update(repo) require.NoError(t, err) - err = os.WriteFile(path.Join(dstPath, "README.md"), []byte("## very senstive info"), 0o666) + err = os.WriteFile(path.Join(dstPath, "README.md"), []byte("## very sensitive info"), 0o666) require.NoError(t, err) err = git.AddChanges(dstPath, true) From f2b7cfa7f7721aaec063da74bf1449487a184c13 Mon Sep 17 00:00:00 2001 From: FermeLeLundi Date: Thu, 28 Nov 2024 10:39:38 +0000 Subject: [PATCH 13/16] Update tests/integration/repo_tag_test.go Typo --- tests/integration/repo_tag_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/integration/repo_tag_test.go b/tests/integration/repo_tag_test.go index cb2d0964f0..0ce0e142b9 100644 --- a/tests/integration/repo_tag_test.go +++ b/tests/integration/repo_tag_test.go @@ -140,7 +140,7 @@ func TestSyncRepoTags(t *testing.T) { doGitClone(dstPath, u)(t) - _, _, err := git.NewCommand(git.DefaultContext, "tag", "v2", "-m", "this is an annoted tag").RunStdString(&git.RunOpts{Dir: dstPath}) + _, _, err := git.NewCommand(git.DefaultContext, "tag", "v2", "-m", "this is an annotated tag").RunStdString(&git.RunOpts{Dir: dstPath}) require.NoError(t, err) _, _, err = git.NewCommand(git.DefaultContext, "push", "--tags").RunStdString(&git.RunOpts{Dir: dstPath}) @@ -152,10 +152,10 @@ func TestSyncRepoTags(t *testing.T) { resp := MakeRequest(t, req, http.StatusOK) htmlDoc := NewHTMLParser(t, resp.Body) tagsTab := htmlDoc.Find(".release-list-title") - assert.Contains(t, tagsTab.Text(), "this is an annoted tag") + assert.Contains(t, tagsTab.Text(), "this is an annotated tag") } - // Make sure `SyncRepoTags` doesn't modify annoted tags. + // Make sure `SyncRepoTags` doesn't modify annotated tags. testTag(t) require.NoError(t, repo_module.SyncRepoTags(git.DefaultContext, repo.ID)) testTag(t) From af8edb4ff3dc4df66e2b8d1984694f6c132dd36f Mon Sep 17 00:00:00 2001 From: FermeLeLundi Date: Thu, 28 Nov 2024 10:48:04 +0000 Subject: [PATCH 14/16] Update tests/e2e/README.md Typo --- tests/e2e/README.md | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/tests/e2e/README.md b/tests/e2e/README.md index 81dc0bf832..cc255e05d9 100644 --- a/tests/e2e/README.md +++ b/tests/e2e/README.md @@ -120,7 +120,7 @@ because it might only look at file changes in your latest commit. ### Run e2e tests with another database This approach is not currently used, -neither in the CI/CD nor by core contributors on their lcoal machines. +neither in the CI/CD nor by core contributors on their local machines. It is still documented for the sake of completeness: You can also perform e2e tests using MariaDB/MySQL or PostgreSQL if you want. @@ -161,13 +161,13 @@ make test-e2e-sqlite#example > This is not currently used by most Forgejo contributors. > Your help to improve the situation and allow for visual testing is appreciated. -Although the main goal of e2e is assertion testing, we have added a framework for visual regress testing. If you are working on front-end features, please use the following: - - Check out `main`, `make clean frontend`, and run e2e tests with `VISUAL_TEST=1` to generate outputs. This will initially fail, as no screenshots exist. You can run the e2e tests again to assert it passes. - - Check out your branch, `make clean frontend`, and run e2e tests with `VISUAL_TEST=1`. You should be able to assert you front-end changes don't break any other tests unintentionally. +Although the main goal of e2e is assertion testing, we have added a framework for visual regression testing. If you are working on front-end features, please use the following: + - Check out `main`, `make clean frontend`, and run e2e tests with `VISUAL_TEST=1` to generate outputs. This will initially fail, as no screenshots exist. You can run the e2e tests again to assert that it passes. + - Check out your branch, `make clean frontend`, and run e2e tests with `VISUAL_TEST=1`. You should be able to assert that your front-end changes don't break any other tests unintentionally. -VISUAL_TEST=1 will create screenshots in tests/e2e/test-snapshots. The test will fail the first time this is enabled (until we get visual test image persistence figured out), because it will be testing against an empty screenshot folder. +`VISUAL_TEST=1` will create screenshots in tests/e2e/test-snapshots. The test will fail the first time this is enabled (until we get visual test image persistence figured out), because it will be testing against an empty screenshot folder. -ACCEPT_VISUAL=1 will overwrite the snapshot images with new images. +`ACCEPT_VISUAL=1` will overwrite the snapshot images with new images. ## Tips and tricks @@ -267,8 +267,8 @@ Run `make lint-frontend-fix`. ### Define new repos Take a look at `declare_repos_test.go` to see how to add your repositories. -Feel free to improve the logic used there if you need more advanced functionality -(it is a simplified version of the code used in the integration tests). +Feel free to improve the logic used there if you need more advanced functionality, +it is a simplified version of the code used in the integration tests. ### Accessibility testing @@ -280,8 +280,7 @@ Take a look at `shared/forms.ts` and some other places for inspiration. ### List related files coverage To speed up the CI pipelines and avoid running expensive tests too often, -only a selection of tests is run by default, -based on the changed files. +only a selection of tests is run by default, based on the changed files. At the top of each playwright test file, list the files or file patterns that are covered by your test. @@ -297,7 +296,7 @@ you won't detect broken visual appearance and there is little reason to watch CS However, if your test also checks that an element is correctly positioned (e.g. that it does not overflow the page), -or has accessibiltiy properties (includes colour contrast), +or has accessibility properties (includes colour contrast), also list stylesheets that define the behaviour your test depends on. Watching the place that generate the selectors you use @@ -305,8 +304,7 @@ Watching the place that generate the selectors you use is a must, to ensure that someone modifying the markup notices that your selectors fail (e.g. because an id or class was renamed). -If you are unsure about the exact set of files, -feel free to ask other contributors. +If you are unsure about the exact set of files, feel free to ask other contributors. #### How to specify the patterns? From 8b4b209861acd22bc8de1e33ea59178f8204f9cf Mon Sep 17 00:00:00 2001 From: FermeLeLundi Date: Thu, 28 Nov 2024 10:49:23 +0000 Subject: [PATCH 15/16] Update tests/e2e/shared/forms.ts Typo --- tests/e2e/shared/forms.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/e2e/shared/forms.ts b/tests/e2e/shared/forms.ts index 2728acf5e7..99ad5a0a6d 100644 --- a/tests/e2e/shared/forms.ts +++ b/tests/e2e/shared/forms.ts @@ -10,7 +10,7 @@ export async function validate_form({page}: {page: Page}, scope: 'form' | 'field ]; await accessibilityCheck({page}, [scope], excludedElements, []); - // assert CSS properties that needed to be overriden for forms (ensure they remain active) + // assert CSS properties that needed to be overridden for forms (ensure they remain active) const boxes = page.getByRole('checkbox').or(page.getByRole('radio')); for (const b of await boxes.all()) { await expect(b).toHaveCSS('margin-left', '0px'); @@ -25,7 +25,7 @@ export async function validate_form({page}: {page: Page}, scope: 'form' | 'field expect(str.split('\n')[0]).not.toContain(':'); } - // check that multiple help text are correctly aligned to each other + // check that multiple help texts are correctly aligned to each other // used for example to separate read/write permissions in team permission matrix for (const l of await page.locator('label:has(.help + .help)').all()) { const helpLabels = await l.locator('.help').all(); From 1151ff1b26335bd386a02db93b33a6e3b7df2da0 Mon Sep 17 00:00:00 2001 From: FermeLeLundi Date: Fri, 29 Nov 2024 15:42:17 +0000 Subject: [PATCH 16/16] Update modules/keying/keying.go Remove trailing whitespace --- modules/keying/keying.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/keying/keying.go b/modules/keying/keying.go index ff3805c14f..6082a91e8f 100644 --- a/modules/keying/keying.go +++ b/modules/keying/keying.go @@ -52,7 +52,7 @@ var ( ContextTOTP Context = "totp" ) -// Derive *the* key for a given context, this is a deterministic function. +// Derive *the* key for a given context, this is a deterministic function. // The same key will be provided for the same context. func DeriveKey(context Context) *Key { if len(prk) == 0 {