From e0296b6a6de6450c474fdf7fe62635a05beb49ab Mon Sep 17 00:00:00 2001 From: luzpaz Date: Thu, 8 Jul 2021 07:38:13 -0400 Subject: [PATCH 1/3] Fix various documentation, user-facing, and source comment typos (#16367) * Fix various doc, user-facing, and source comment typos Found via `codespell -q 3 -S ./options/locale,./vendor -L ba,pullrequest,pullrequests,readby` --- cmd/dump.go | 2 +- cmd/hook.go | 4 ++-- cmd/migrate_storage.go | 2 +- cmd/web_letsencrypt.go | 2 +- custom/conf/app.example.ini | 2 +- docker/root/etc/s6/gitea/setup | 2 +- docker/rootless/usr/local/bin/docker-setup.sh | 2 +- .../doc/advanced/config-cheat-sheet.en-us.md | 16 ++++++++-------- .../doc/advanced/logging-documentation.en-us.md | 2 +- .../content/doc/advanced/protected-tags.en-us.md | 2 +- .../content/doc/features/authentication.en-us.md | 4 ++-- docs/content/doc/help/faq.en-us.md | 2 +- docs/content/page/index.en-us.md | 4 ++-- integrations/README.md | 2 +- integrations/release_test.go | 2 +- models/branches.go | 2 +- models/context.go | 2 +- models/error.go | 4 ++-- models/gpg_key.go | 4 ++-- models/issue_comment.go | 6 +++--- models/issue_dependency.go | 2 +- models/issue_label_test.go | 2 +- models/login_source.go | 2 +- models/migrations/migrations.go | 2 +- models/migrations/v111.go | 4 ++-- models/migrations/v147.go | 2 +- models/oauth2_application.go | 6 +++--- models/org.go | 2 +- models/repo.go | 2 +- models/repo_list.go | 4 ++-- models/repo_permission.go | 4 ++-- models/repo_pushmirror.go | 2 +- models/review.go | 4 ++-- models/topic.go | 2 +- models/user.go | 4 ++-- models/user_mail.go | 2 +- modules/context/repo.go | 2 +- modules/git/blame.go | 2 +- modules/git/repo_commit.go | 10 +++++----- modules/git/repo_stats.go | 2 +- modules/git/utils.go | 2 +- modules/indexer/code/elastic_search.go | 6 +++--- modules/lfs/shared.go | 2 +- modules/log/colors_router.go | 6 +++--- modules/markup/html.go | 2 +- modules/markup/markdown/ast.go | 2 +- modules/markup/mdstripper/mdstripper_test.go | 4 ++-- modules/migrations/base/downloader.go | 2 +- modules/migrations/base/label.go | 2 +- modules/migrations/base/uploader.go | 2 +- modules/migrations/github.go | 2 +- modules/migrations/gitlab.go | 2 +- modules/migrations/gogs.go | 2 +- modules/notification/base/null.go | 2 +- modules/references/references_test.go | 2 +- modules/repofiles/action_test.go | 2 +- modules/repofiles/content_test.go | 4 ++-- modules/repository/adopt.go | 4 ++-- modules/secret/secret.go | 2 +- modules/setting/indexer.go | 2 +- modules/setting/session.go | 2 +- modules/storage/storage.go | 2 +- modules/task/migrate.go | 2 +- modules/typesniffer/typesniffer.go | 2 +- modules/util/path.go | 2 +- modules/util/shellquote_test.go | 4 ++-- modules/validation/helpers.go | 2 +- modules/validation/helpers_test.go | 6 +++--- modules/validation/refname_test.go | 2 +- routers/api/v1/repo/issue_tracked_time.go | 2 +- routers/api/v1/user/app.go | 2 +- routers/web/admin/users.go | 4 ++-- routers/web/org/setting.go | 4 ++-- routers/web/repo/http.go | 2 +- routers/web/repo/issue.go | 2 +- routers/web/repo/view.go | 2 +- routers/web/user/auth.go | 2 +- routers/web/web.go | 2 +- services/auth/sspi_windows.go | 2 +- services/issue/assignee.go | 2 +- services/mailer/mailer.go | 2 +- services/wiki/wiki_test.go | 2 +- web_src/fomantic/build/semantic.css | 4 ++-- web_src/fomantic/build/semantic.js | 12 ++++++------ web_src/js/index.js | 4 ++-- web_src/less/_base.less | 4 ++-- web_src/less/helpers.less | 2 +- 87 files changed, 132 insertions(+), 132 deletions(-) diff --git a/cmd/dump.go b/cmd/dump.go index 458f9f91e017b..629993b6c80b1 100644 --- a/cmd/dump.go +++ b/cmd/dump.go @@ -280,7 +280,7 @@ func runDump(ctx *cli.Context) error { } if ctx.IsSet("skip-custom-dir") && ctx.Bool("skip-custom-dir") { - log.Info("Skiping custom directory") + log.Info("Skipping custom directory") } else { customDir, err := os.Stat(setting.CustomPath) if err == nil && customDir.IsDir() { diff --git a/cmd/hook.go b/cmd/hook.go index 2fbbfb4d21ae4..067a0bfb8ab9e 100644 --- a/cmd/hook.go +++ b/cmd/hook.go @@ -165,7 +165,7 @@ Gitea or set your environment appropriately.`, "") } } - // the environment setted on serv command + // the environment is set by serv command isWiki := os.Getenv(models.EnvRepoIsWiki) == "true" username := os.Getenv(models.EnvRepoUsername) reponame := os.Getenv(models.EnvRepoName) @@ -320,7 +320,7 @@ Gitea or set your environment appropriately.`, "") } } - // the environment setted on serv command + // the environment is set by serv command repoUser := os.Getenv(models.EnvRepoUsername) isWiki := os.Getenv(models.EnvRepoIsWiki) == "true" repoName := os.Getenv(models.EnvRepoName) diff --git a/cmd/migrate_storage.go b/cmd/migrate_storage.go index 8ff84d690b9ab..8123716f9ba95 100644 --- a/cmd/migrate_storage.go +++ b/cmd/migrate_storage.go @@ -184,7 +184,7 @@ func runMigrateStorage(ctx *cli.Context) error { return fmt.Errorf("Unsupported storage: %s", ctx.String("type")) } - log.Warn("All files have been copied to the new placement but old files are still on the orignial placement.") + log.Warn("All files have been copied to the new placement but old files are still on the original placement.") return nil } diff --git a/cmd/web_letsencrypt.go b/cmd/web_letsencrypt.go index 15a3c92e8baab..d50d803e1da73 100644 --- a/cmd/web_letsencrypt.go +++ b/cmd/web_letsencrypt.go @@ -19,7 +19,7 @@ import ( func runLetsEncrypt(listenAddr, domain, directory, email string, m http.Handler) error { // If HTTP Challenge enabled, needs to be serving on port 80. For TLSALPN needs 443. - // Due to docker port mapping this can't be checked programatically + // Due to docker port mapping this can't be checked programmatically // TODO: these are placeholders until we add options for each in settings with appropriate warning enableHTTPChallenge := true enableTLSALPNChallenge := true diff --git a/custom/conf/app.example.ini b/custom/conf/app.example.ini index ff21613586b5a..22244545f589b 100644 --- a/custom/conf/app.example.ini +++ b/custom/conf/app.example.ini @@ -659,7 +659,7 @@ PATH = ;; Public is for users visible for everyone ;DEFAULT_USER_VISIBILITY = public ;; -;; Set whitch visibibilty modes a user can have +;; Set which visibility modes a user can have ;ALLOWED_USER_VISIBILITY_MODES = public,limited,private ;; ;; Either "public", "limited" or "private", default is "public" diff --git a/docker/root/etc/s6/gitea/setup b/docker/root/etc/s6/gitea/setup index 38187b29e051f..d8f6a3b319ee2 100755 --- a/docker/root/etc/s6/gitea/setup +++ b/docker/root/etc/s6/gitea/setup @@ -23,7 +23,7 @@ if [ ! -f ${GITEA_CUSTOM}/conf/app.ini ]; then INSTALL_LOCK=true fi - # Substitude the environment variables in the template + # Substitute the environment variables in the template APP_NAME=${APP_NAME:-"Gitea: Git with a cup of tea"} \ RUN_MODE=${RUN_MODE:-"prod"} \ DOMAIN=${DOMAIN:-"localhost"} \ diff --git a/docker/rootless/usr/local/bin/docker-setup.sh b/docker/rootless/usr/local/bin/docker-setup.sh index ef86d01c9f30c..47645726c4b08 100755 --- a/docker/rootless/usr/local/bin/docker-setup.sh +++ b/docker/rootless/usr/local/bin/docker-setup.sh @@ -25,7 +25,7 @@ if [ ! -f ${GITEA_APP_INI} ]; then INSTALL_LOCK=true fi - # Substitude the environment variables in the template + # Substitute the environment variables in the template APP_NAME=${APP_NAME:-"Gitea: Git with a cup of tea"} \ RUN_MODE=${RUN_MODE:-"prod"} \ RUN_USER=${USER:-"git"} \ diff --git a/docs/content/doc/advanced/config-cheat-sheet.en-us.md b/docs/content/doc/advanced/config-cheat-sheet.en-us.md index 67b3754816088..741c5f292cdf8 100644 --- a/docs/content/doc/advanced/config-cheat-sheet.en-us.md +++ b/docs/content/doc/advanced/config-cheat-sheet.en-us.md @@ -128,8 +128,8 @@ Values containing `#` or `;` must be quoted using `` ` `` or `"""`. - Options other than `never` and `always` can be combined as a comma separated list. - `DEFAULT_TRUST_MODEL`: **collaborator**: \[collaborator, committer, collaboratorcommitter\]: The default trust model used for verifying commits. - `collaborator`: Trust signatures signed by keys of collaborators. - - `committer`: Trust signatures that match committers (This matches GitHub and will force Gitea signed commits to have Gitea as the commmitter). - - `collaboratorcommitter`: Trust signatures signed by keys of collaborators which match the commiter. + - `committer`: Trust signatures that match committers (This matches GitHub and will force Gitea signed commits to have Gitea as the committer). + - `collaboratorcommitter`: Trust signatures signed by keys of collaborators which match the committer. - `WIKI`: **never**: \[never, pubkey, twofa, always, parentsigned\]: Sign commits to wiki. - `CRUD_ACTIONS`: **pubkey, twofa, parentsigned**: \[never, pubkey, twofa, parentsigned, always\]: Sign CRUD actions. - Options as above, with the addition of: @@ -345,9 +345,9 @@ The following configuration set `Content-Type: application/vnd.android.package-a - `PATH`: **data/gitea.db**: For SQLite3 only, the database file path. - `LOG_SQL`: **true**: Log the executed SQL. - `DB_RETRIES`: **10**: How many ORM init / DB connect attempts allowed. -- `DB_RETRY_BACKOFF`: **3s**: time.Duration to wait before trying another ORM init / DB connect attempt, if failure occured. +- `DB_RETRY_BACKOFF`: **3s**: time.Duration to wait before trying another ORM init / DB connect attempt, if failure occurred. - `MAX_OPEN_CONNS` **0**: Database maximum open connections - default is 0, meaning there is no limit. -- `MAX_IDLE_CONNS` **2**: Max idle database connections on connnection pool, default is 2 - this will be capped to `MAX_OPEN_CONNS`. +- `MAX_IDLE_CONNS` **2**: Max idle database connections on connection pool, default is 2 - this will be capped to `MAX_OPEN_CONNS`. - `CONN_MAX_LIFETIME` **0 or 3s**: Sets the maximum amount of time a DB connection may be reused - default is 0, meaning there is no limit (except on MySQL where it is 3s - see #6804 & #7071). Please see #8540 & #8273 for further discussion of the appropriate values for `MAX_OPEN_CONNS`, `MAX_IDLE_CONNS` & `CONN_MAX_LIFETIME` and their @@ -385,7 +385,7 @@ relation to port exhaustion. - `LENGTH`: **20**: Maximal queue size before channel queues block - `BATCH_LENGTH`: **20**: Batch data before passing to the handler - `CONN_STR`: **redis://127.0.0.1:6379/0**: Connection string for the redis queue type. Options can be set using query params. Similarly LevelDB options can also be set using: **leveldb://relative/path?option=value** or **leveldb:///absolute/path?option=value**, and will override `DATADIR` -- `QUEUE_NAME`: **_queue**: The suffix for default redis and disk queue name. Individual queues will default to **`name`**`QUEUE_NAME` but can be overriden in the specific `queue.name` section. +- `QUEUE_NAME`: **_queue**: The suffix for default redis and disk queue name. Individual queues will default to **`name`**`QUEUE_NAME` but can be overridden in the specific `queue.name` section. - `SET_NAME`: **_unique**: The suffix that will be added to the default redis and disk queue `set` name for unique queues. Individual queues will default to **`name`**`QUEUE_NAME`_`SET_NAME`_ but can be overridden in the specific `queue.name` section. - `WRAP_IF_NECESSARY`: **true**: Will wrap queues with a timeoutable queue if the selected queue is not ready to be created - (Only relevant for the level queue.) @@ -516,7 +516,7 @@ relation to port exhaustion. - `AUTO_WATCH_NEW_REPOS`: **true**: Enable this to let all organisation users watch new repos when they are created - `AUTO_WATCH_ON_CHANGES`: **false**: Enable this to make users watch a repository after their first commit to it - `DEFAULT_USER_VISIBILITY`: **public**: Set default visibility mode for users, either "public", "limited" or "private". -- `ALLOWED_USER_VISIBILITY_MODES`: **public,limited,private**: Set whitch visibibilty modes a user can have +- `ALLOWED_USER_VISIBILITY_MODES`: **public,limited,private**: Set which visibility modes a user can have - `DEFAULT_ORG_VISIBILITY`: **public**: Set default visibility mode for organisations, either "public", "limited" or "private". - `DEFAULT_ORG_MEMBER_VISIBLE`: **false** True will make the membership of the users visible when added to the organisation. - `ALLOW_ONLY_INTERNAL_REGISTRATION`: **false** Set to true to force registration only via gitea. @@ -895,7 +895,7 @@ IS_INPUT_FILE = false - ENABLED: **false** Enable markup support; set to **true** to enable this renderer. - NEED\_POSTPROCESS: **true** set to **true** to replace links / sha1 and etc. - FILE\_EXTENSIONS: **\** List of file extensions that should be rendered by an external - command. Multiple extentions needs a comma as splitter. + command. Multiple extensions needs a comma as splitter. - RENDER\_COMMAND: External command to render all matching extensions. - IS\_INPUT\_FILE: **false** Input is not a standard input but a file param followed `RENDER_COMMAND`. @@ -927,7 +927,7 @@ If the rule is defined above the renderer ini section or the name does not match ## Time (`time`) -- `FORMAT`: Time format to diplay on UI. i.e. RFC1123 or 2006-01-02 15:04:05 +- `FORMAT`: Time format to display on UI. i.e. RFC1123 or 2006-01-02 15:04:05 - `DEFAULT_UI_LOCATION`: Default location of time on the UI, so that we can display correct user's time on UI. i.e. Shanghai/Asia ## Task (`task`) diff --git a/docs/content/doc/advanced/logging-documentation.en-us.md b/docs/content/doc/advanced/logging-documentation.en-us.md index 28c87a6ec09c9..478b6418c6cbf 100644 --- a/docs/content/doc/advanced/logging-documentation.en-us.md +++ b/docs/content/doc/advanced/logging-documentation.en-us.md @@ -282,7 +282,7 @@ ROUTER = console COLORIZE = false ; this can be true if you can strip out the ansi coloring ``` -Sometimes it will be helpful get some specific `TRACE` level logging retricted +Sometimes it will be helpful get some specific `TRACE` level logging restricted to messages that match a specific `EXPRESSION`. Adjusting the `MODE` in the `[log]` section to `MODE = console,traceconsole` to add a new logger output `traceconsole` and then adding its corresponding section would be helpful: diff --git a/docs/content/doc/advanced/protected-tags.en-us.md b/docs/content/doc/advanced/protected-tags.en-us.md index 36e6e169753c8..4d109c2278337 100644 --- a/docs/content/doc/advanced/protected-tags.en-us.md +++ b/docs/content/doc/advanced/protected-tags.en-us.md @@ -27,7 +27,7 @@ To protect a tag, you need to follow these steps: 1. Go to the repository’s **Settings** > **Tags** page. 1. Type a pattern to match a name. You can use a single name, a [glob pattern](https://pkg.go.dev/github.com/gobwas/glob#Compile) or a regular expression. -1. Choose the allowed users and/or teams. If you leave these fields empty noone is allowed to create or modify this tag. +1. Choose the allowed users and/or teams. If you leave these fields empty no one is allowed to create or modify this tag. 1. Select **Save** to save the configuration. ## Pattern protected tags diff --git a/docs/content/doc/features/authentication.en-us.md b/docs/content/doc/features/authentication.en-us.md index 223d7aa4fb0cc..21181ac1b20ec 100644 --- a/docs/content/doc/features/authentication.en-us.md +++ b/docs/content/doc/features/authentication.en-us.md @@ -259,7 +259,7 @@ Before activating SSPI single sign-on authentication (SSO) you have to prepare y - Create a service principal name for the host where `gitea.exe` is running with class `HTTP`: - - Start `Command Prompt` or `PowerShell` as a priviledged domain user (eg. Domain Administrator) + - Start `Command Prompt` or `PowerShell` as a privileged domain user (eg. Domain Administrator) - Run the command below, replacing `host.domain.local` with the fully qualified domain name (FQDN) of the server where the web application will be running, and `domain\user` with the name of the account created in the previous step: ```sh @@ -283,7 +283,7 @@ Before activating SSPI single sign-on authentication (SSO) you have to prepare y - Click the `Sign In` button on the dashboard and choose SSPI to be automatically logged in with the same user that is currently logged on to the computer - If it does not work, make sure that: - - You are not running the web browser on the same server where gitea is running. You should be running the web browser on a domain joined computer (client) that is different from the server. If both the client and server are runnning on the same computer NTLM will be prefered over Kerberos. + - You are not running the web browser on the same server where gitea is running. You should be running the web browser on a domain joined computer (client) that is different from the server. If both the client and server are running on the same computer NTLM will be preferred over Kerberos. - There is only one `HTTP/...` SPN for the host - The SPN contains only the hostname, without the port - You have added the URL of the web app to the `Local intranet zone` diff --git a/docs/content/doc/help/faq.en-us.md b/docs/content/doc/help/faq.en-us.md index 1ae881d52d636..ff233d31e36c8 100644 --- a/docs/content/doc/help/faq.en-us.md +++ b/docs/content/doc/help/faq.en-us.md @@ -142,7 +142,7 @@ The current way to achieve this is to create/modify a user with a max repo creat Restricted users are limited to a subset of the content based on their organization/team memberships and collaborations, ignoring the public flag on organizations/repos etc.\_\_ -Example use case: A company runs a Gitea instance that requires login. Most repos are public (accessible/browseable by all co-workers). +Example use case: A company runs a Gitea instance that requires login. Most repos are public (accessible/browsable by all co-workers). At some point, a customer or third party needs access to a specific repo and only that repo. Making such a customer account restricted and granting any needed access using team membership(s) and/or collaboration(s) is a simple way to achieve that without the need to make everything private. diff --git a/docs/content/page/index.en-us.md b/docs/content/page/index.en-us.md index 98d61576f3d10..a5204e17dff78 100644 --- a/docs/content/page/index.en-us.md +++ b/docs/content/page/index.en-us.md @@ -117,7 +117,7 @@ Windows, on architectures like amd64, i386, ARM, PowerPC, and others. - Configuration viewer - Everything in config file - System notices - - When somthing unexpected happens + - When something unexpected happens - Monitoring - Current processes - Cron jobs @@ -155,7 +155,7 @@ Windows, on architectures like amd64, i386, ARM, PowerPC, and others. - Libravatar - Custom - Password - - Mutiple email addresses + - Multiple email addresses - SSH Keys - Connected applications - Two factor authentication diff --git a/integrations/README.md b/integrations/README.md index ccb55377f56e9..0b91a7d254a13 100644 --- a/integrations/README.md +++ b/integrations/README.md @@ -28,7 +28,7 @@ make test-sqlite Setup a mysql database inside docker ``` docker run -e "MYSQL_DATABASE=test" -e "MYSQL_ALLOW_EMPTY_PASSWORD=yes" -p 3306:3306 --rm --name mysql mysql:latest #(just ctrl-c to stop db and clean the container) -docker run -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" --rm --name elasticsearch elasticsearch:7.6.0 #(in a secound terminal, just ctrl-c to stop db and clean the container) +docker run -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" --rm --name elasticsearch elasticsearch:7.6.0 #(in a second terminal, just ctrl-c to stop db and clean the container) ``` Start tests based on the database container ``` diff --git a/integrations/release_test.go b/integrations/release_test.go index ac5df315d5972..4458387ef75dd 100644 --- a/integrations/release_test.go +++ b/integrations/release_test.go @@ -116,7 +116,7 @@ func TestCreateReleasePaging(t *testing.T) { setting.API.DefaultPagingNum = 10 session := loginUser(t, "user2") - // Create enaugh releases to have paging + // Create enough releases to have paging for i := 0; i < 12; i++ { version := fmt.Sprintf("v0.0.%d", i) createNewRelease(t, session, "/user2/repo1", version, version, false, false) diff --git a/models/branches.go b/models/branches.go index d346f195787b8..e13d84ee0524c 100644 --- a/models/branches.go +++ b/models/branches.go @@ -219,7 +219,7 @@ func (protectBranch *ProtectedBranch) GetProtectedFilePatterns() []glob.Glob { expr = strings.TrimSpace(expr) if expr != "" { if g, err := glob.Compile(expr, '.', '/'); err != nil { - log.Info("Invalid glob expresion '%s' (skipped): %v", expr, err) + log.Info("Invalid glob expression '%s' (skipped): %v", expr, err) } else { extarr = append(extarr, g) } diff --git a/models/context.go b/models/context.go index 4fbd3b6699eee..1221ab7dede9d 100644 --- a/models/context.go +++ b/models/context.go @@ -42,7 +42,7 @@ func WithContext(f func(ctx DBContext) error) error { return f(DBContext{x}) } -// WithTx represents executing database operations on a trasaction +// WithTx represents executing database operations on a transaction func WithTx(f func(ctx DBContext) error) error { sess := x.NewSession() if err := sess.Begin(); err != nil { diff --git a/models/error.go b/models/error.go index 513effdb0293b..7b99dc65920a1 100644 --- a/models/error.go +++ b/models/error.go @@ -1114,7 +1114,7 @@ func IsErrUserDoesNotHaveAccessToRepo(err error) bool { } func (err ErrUserDoesNotHaveAccessToRepo) Error() string { - return fmt.Sprintf("user doesn't have acces to repo [user_id: %d, repo_name: %s]", err.UserID, err.RepoName) + return fmt.Sprintf("user doesn't have access to repo [user_id: %d, repo_name: %s]", err.UserID, err.RepoName) } // ErrWontSign explains the first reason why a commit would not be signed @@ -1289,7 +1289,7 @@ func IsErrSHAOrCommitIDNotProvided(err error) bool { } func (err ErrSHAOrCommitIDNotProvided) Error() string { - return "a SHA or commmit ID must be proved when updating a file" + return "a SHA or commit ID must be proved when updating a file" } // __ __ ___. .__ __ diff --git a/models/gpg_key.go b/models/gpg_key.go index 9530eacb0a701..140a71df6d24e 100644 --- a/models/gpg_key.go +++ b/models/gpg_key.go @@ -622,7 +622,7 @@ func ParseCommitWithSignature(c *git.Commit) *CommitVerification { var err error // Find Committer account committer, err = GetUserByEmail(c.Committer.Email) // This finds the user by primary email or activated email so commit will not be valid if email is not - if err != nil { // Skipping not user for commiter + if err != nil { // Skipping not user for committer committer = &User{ Name: c.Committer.Name, Email: c.Committer.Email, @@ -698,7 +698,7 @@ func ParseCommitWithSignature(c *git.Commit) *CommitVerification { } for _, k := range keys { - // Pre-check (& optimization) that emails attached to key can be attached to the commiter email and can validate + // Pre-check (& optimization) that emails attached to key can be attached to the committer email and can validate canValidate := false email := "" for _, e := range k.Emails { diff --git a/models/issue_comment.go b/models/issue_comment.go index 1b98b248b1fcc..4c5b77ff8e556 100644 --- a/models/issue_comment.go +++ b/models/issue_comment.go @@ -184,7 +184,7 @@ type Comment struct { RefRepoID int64 `xorm:"index"` // Repo where the referencing RefIssueID int64 `xorm:"index"` RefCommentID int64 `xorm:"index"` // 0 if origin is Issue title or content (or PR's) - RefAction references.XRefAction `xorm:"SMALLINT"` // What hapens if RefIssueID resolves + RefAction references.XRefAction `xorm:"SMALLINT"` // What happens if RefIssueID resolves RefIsPull bool RefRepo *Repository `xorm:"-"` @@ -1228,7 +1228,7 @@ func UpdateCommentsMigrationsByType(tp structs.GitServiceType, originalAuthorID return err } -// CreatePushPullComment create push code to pull base commend +// CreatePushPullComment create push code to pull base comment func CreatePushPullComment(pusher *User, pr *PullRequest, oldCommitID, newCommitID string) (comment *Comment, err error) { if pr.HasMerged || oldCommitID == "" || newCommitID == "" { return nil, nil @@ -1262,7 +1262,7 @@ func CreatePushPullComment(pusher *User, pr *PullRequest, oldCommitID, newCommit return } -// getCommitsFromRepo get commit IDs from repo in betwern oldCommitID and newCommitID +// getCommitsFromRepo get commit IDs from repo in between oldCommitID and newCommitID // isForcePush will be true if oldCommit isn't on the branch // Commit on baseBranch will skip func getCommitIDsFromRepo(repo *Repository, oldCommitID, newCommitID, baseBranch string) (commitIDs []string, isForcePush bool, err error) { diff --git a/models/issue_dependency.go b/models/issue_dependency.go index 6ecaf3432f89f..4008008f34741 100644 --- a/models/issue_dependency.go +++ b/models/issue_dependency.go @@ -128,7 +128,7 @@ func issueNoDependenciesLeft(e Engine, issue *Issue) (bool, error) { return !exists, err } -// IsDependenciesEnabled returns if dependecies are enabled and returns the default setting if not set. +// IsDependenciesEnabled returns if dependencies are enabled and returns the default setting if not set. func (repo *Repository) IsDependenciesEnabled() bool { return repo.isDependenciesEnabled(x) } diff --git a/models/issue_label_test.go b/models/issue_label_test.go index fc6590e96859f..3dde1a40696a9 100644 --- a/models/issue_label_test.go +++ b/models/issue_label_test.go @@ -135,7 +135,7 @@ func TestGetLabelsByRepoID(t *testing.T) { testSuccess(1, "default", []int64{1, 2}) } -// Org vrsions +// Org versions func TestGetLabelInOrgByName(t *testing.T) { assert.NoError(t, PrepareTestDatabase()) diff --git a/models/login_source.go b/models/login_source.go index 7ff7e994eafb0..f9bd496b3add4 100644 --- a/models/login_source.go +++ b/models/login_source.go @@ -343,7 +343,7 @@ func CreateLoginSource(source *LoginSource) error { } else if has { return ErrLoginSourceAlreadyExist{source.Name} } - // Synchronization is only aviable with LDAP for now + // Synchronization is only available with LDAP for now if !source.IsLDAP() { source.IsSyncEnabled = false } diff --git a/models/migrations/migrations.go b/models/migrations/migrations.go index 0e8b0d0e3db5f..de60d89bbe781 100644 --- a/models/migrations/migrations.go +++ b/models/migrations/migrations.go @@ -187,7 +187,7 @@ var migrations = []Migration{ // v122 -> v123 NewMigration("Add Require Signed Commits to ProtectedBranch", addRequireSignedCommits), // v123 -> v124 - NewMigration("Add original informations for reactions", addReactionOriginals), + NewMigration("Add original information for reactions", addReactionOriginals), // v124 -> v125 NewMigration("Add columns to user and repository", addUserRepoMissingColumns), // v125 -> v126 diff --git a/models/migrations/v111.go b/models/migrations/v111.go index b292f0c7d38a3..95f0ec22dd381 100644 --- a/models/migrations/v111.go +++ b/models/migrations/v111.go @@ -141,8 +141,8 @@ func addBranchProtectionCanPushAndEnableWhitelist(x *xorm.Engine) error { return perm, err } - // Prevent strangers from checking out public repo of private orginization - // Allow user if they are collaborator of a repo within a private orginization but not a member of the orginization itself + // Prevent strangers from checking out public repo of private organization + // Allow user if they are collaborator of a repo within a private organization but not a member of the organization itself hasOrgVisible := true // Not SignedUser if user == nil { diff --git a/models/migrations/v147.go b/models/migrations/v147.go index 7488b370aacec..ad4ec4ef7ffd7 100644 --- a/models/migrations/v147.go +++ b/models/migrations/v147.go @@ -75,7 +75,7 @@ func createReviewsForCodeComments(x *xorm.Engine) error { RefRepoID int64 `xorm:"index"` // Repo where the referencing RefIssueID int64 `xorm:"index"` RefCommentID int64 `xorm:"index"` // 0 if origin is Issue title or content (or PR's) - RefAction int `xorm:"SMALLINT"` // What hapens if RefIssueID resolves + RefAction int `xorm:"SMALLINT"` // What happens if RefIssueID resolves RefIsPull bool } diff --git a/models/oauth2_application.go b/models/oauth2_application.go index 3509dba54e2f8..5a924763be168 100644 --- a/models/oauth2_application.go +++ b/models/oauth2_application.go @@ -210,7 +210,7 @@ func UpdateOAuth2Application(opts UpdateOAuth2ApplicationOptions) (*OAuth2Applic return nil, err } if app.UID != opts.UserID { - return nil, fmt.Errorf("UID missmatch") + return nil, fmt.Errorf("UID mismatch") } app.Name = opts.Name @@ -376,7 +376,7 @@ func getOAuth2AuthorizationByCode(e Engine, code string) (auth *OAuth2Authorizat ////////////////////////////////////////////////////// -// OAuth2Grant represents the permission of an user for a specifc application to access resources +// OAuth2Grant represents the permission of an user for a specific application to access resources type OAuth2Grant struct { ID int64 `xorm:"pk autoincr"` UserID int64 `xorm:"INDEX unique(user_application)"` @@ -537,7 +537,7 @@ type OAuth2Token struct { jwt.StandardClaims } -// ParseOAuth2Token parses a singed jwt string +// ParseOAuth2Token parses a signed jwt string func ParseOAuth2Token(jwtToken string) (*OAuth2Token, error) { parsedToken, err := jwt.ParseWithClaims(jwtToken, &OAuth2Token{}, func(token *jwt.Token) (interface{}, error) { if token.Method == nil || token.Method.Alg() != oauth2.DefaultSigningKey.SigningMethod().Alg() { diff --git a/models/org.go b/models/org.go index 073b26c2f8b69..58fb26b1bb511 100644 --- a/models/org.go +++ b/models/org.go @@ -79,7 +79,7 @@ func (org *User) GetMembers() (err error) { return } -// FindOrgMembersOpts represensts find org members condtions +// FindOrgMembersOpts represensts find org members conditions type FindOrgMembersOpts struct { ListOptions OrgID int64 diff --git a/models/repo.go b/models/repo.go index 009e7a457d074..e158dc12dd81d 100644 --- a/models/repo.go +++ b/models/repo.go @@ -1616,7 +1616,7 @@ func DeleteRepository(doer *User, uid, repoID int64) error { sess.Close() // We should always delete the files after the database transaction succeed. If - // we delete the file but the database rollback, the repository will be borken. + // we delete the file but the database rollback, the repository will be broken. // Remove issue attachment files. for i := range attachmentPaths { diff --git a/models/repo_list.go b/models/repo_list.go index b4a6d9e438fc2..b988cefface82 100644 --- a/models/repo_list.go +++ b/models/repo_list.go @@ -148,11 +148,11 @@ type SearchRepoOptions struct { AllLimited bool // Include also all public repositories of limited organisations // None -> include public and private // True -> include just private - // False -> incude just public + // False -> include just public IsPrivate util.OptionalBool // None -> include collaborative AND non-collaborative // True -> include just collaborative - // False -> incude just non-collaborative + // False -> include just non-collaborative Collaborate util.OptionalBool // None -> include forks AND non-forks // True -> include just forks diff --git a/models/repo_permission.go b/models/repo_permission.go index 4f043a58ccfae..f5138fc54ce49 100644 --- a/models/repo_permission.go +++ b/models/repo_permission.go @@ -176,7 +176,7 @@ func getUserRepoPermission(e Engine, repo *Repository, user *User) (perm Permiss return } - // Prevent strangers from checking out public repo of private orginization/users + // Prevent strangers from checking out public repo of private organization/users // Allow user if they are collaborator of a repo within a private user or a private organization but not a member of the organization itself if !hasOrgOrUserVisible(e, repo.Owner, user) && !isCollaborator { perm.AccessMode = AccessModeNone @@ -351,7 +351,7 @@ func hasAccessUnit(e Engine, user *User, repo *Repository, unitType UnitType, te return testMode <= mode, err } -// HasAccessUnit returns ture if user has testMode to the unit of the repository +// HasAccessUnit returns true if user has testMode to the unit of the repository func HasAccessUnit(user *User, repo *Repository, unitType UnitType, testMode AccessMode) (bool, error) { return hasAccessUnit(x, user, repo, unitType, testMode) } diff --git a/models/repo_pushmirror.go b/models/repo_pushmirror.go index bdd4198f92b4a..439972ffa6cc5 100644 --- a/models/repo_pushmirror.go +++ b/models/repo_pushmirror.go @@ -91,7 +91,7 @@ func GetPushMirrorByID(ID int64) (*PushMirror, error) { return m, nil } -// GetPushMirrorsByRepoID returns push-mirror informations of a repository. +// GetPushMirrorsByRepoID returns push-mirror information of a repository. func GetPushMirrorsByRepoID(repoID int64) ([]*PushMirror, error) { mirrors := make([]*PushMirror, 0, 10) return mirrors, x.Where("repo_id=?", repoID).Find(&mirrors) diff --git a/models/review.go b/models/review.go index 316cbe4da6426..acb54d970fdc8 100644 --- a/models/review.go +++ b/models/review.go @@ -466,7 +466,7 @@ func GetReviewersByIssueID(issueID int64) ([]*Review, error) { return nil, err } - // Get latest review of each reviwer, sorted in order they were made + // Get latest review of each reviewer, sorted in order they were made if err := sess.SQL("SELECT * FROM review WHERE id IN (SELECT max(id) as id FROM review WHERE issue_id = ? AND reviewer_team_id = 0 AND type in (?, ?, ?) AND dismissed = ? AND original_author_id = 0 GROUP BY issue_id, reviewer_id) ORDER BY review.updated_unix ASC", issueID, ReviewTypeApprove, ReviewTypeReject, ReviewTypeRequest, false). Find(&reviews); err != nil { @@ -491,7 +491,7 @@ func GetReviewersByIssueID(issueID int64) ([]*Review, error) { func GetReviewersFromOriginalAuthorsByIssueID(issueID int64) ([]*Review, error) { reviews := make([]*Review, 0, 10) - // Get latest review of each reviwer, sorted in order they were made + // Get latest review of each reviewer, sorted in order they were made if err := x.SQL("SELECT * FROM review WHERE id IN (SELECT max(id) as id FROM review WHERE issue_id = ? AND reviewer_team_id = 0 AND type in (?, ?, ?) AND original_author_id <> 0 GROUP BY issue_id, original_author_id) ORDER BY review.updated_unix ASC", issueID, ReviewTypeApprove, ReviewTypeReject, ReviewTypeRequest). Find(&reviews); err != nil { diff --git a/models/topic.go b/models/topic.go index 31e81c8d0ff15..19c572fefebf6 100644 --- a/models/topic.go +++ b/models/topic.go @@ -195,7 +195,7 @@ func FindTopics(opts *FindTopicOptions) (topics []*Topic, err error) { return topics, sess.Desc("topic.repo_count").Find(&topics) } -// GetRepoTopicByName retrives topic from name for a repo if it exist +// GetRepoTopicByName retrieves topic from name for a repo if it exist func GetRepoTopicByName(repoID int64, topicName string) (*Topic, error) { return getRepoTopicByName(x, repoID, topicName) } diff --git a/models/user.go b/models/user.go index ce96a144af25d..3b8ce79251f0c 100644 --- a/models/user.go +++ b/models/user.go @@ -1631,7 +1631,7 @@ func (opts *SearchUserOptions) toConds() builder.Cond { // If Admin - they see all users! if !opts.Actor.IsAdmin { - // Force visiblity for privacy + // Force visibility for privacy var accessCond builder.Cond if !opts.Actor.IsRestricted { accessCond = builder.Or( @@ -1647,7 +1647,7 @@ func (opts *SearchUserOptions) toConds() builder.Cond { } } else { - // Force visiblity for privacy + // Force visibility for privacy // Not logged in - only public users cond = cond.And(builder.In("visibility", structs.VisibleTypePublic)) } diff --git a/models/user_mail.go b/models/user_mail.go index 320f2cb05a325..89cbdf12a488f 100644 --- a/models/user_mail.go +++ b/models/user_mail.go @@ -269,7 +269,7 @@ func MakeEmailPrimary(email *EmailAddress) error { return err } - // 3. update new primay email + // 3. update new primary email email.IsPrimary = true if _, err = sess.ID(email.ID).Cols("is_primary").Update(email); err != nil { return err diff --git a/modules/context/repo.go b/modules/context/repo.go index 72d1cf4c85615..ea8323bdfc22b 100644 --- a/modules/context/repo.go +++ b/modules/context/repo.go @@ -38,7 +38,7 @@ var IssueTemplateDirCandidates = []string{ ".gitlab/issue_template", } -// PullRequest contains informations to make a pull request +// PullRequest contains information to make a pull request type PullRequest struct { BaseRepo *models.Repository Allowed bool diff --git a/modules/git/blame.go b/modules/git/blame.go index c2129c9e1cf1f..fcbf183981c37 100644 --- a/modules/git/blame.go +++ b/modules/git/blame.go @@ -34,7 +34,7 @@ type BlameReader struct { var shaLineRegex = regexp.MustCompile("^([a-z0-9]{40})") -// NextPart returns next part of blame (sequencial code lines with the same commit) +// NextPart returns next part of blame (sequential code lines with the same commit) func (r *BlameReader) NextPart() (*BlamePart, error) { var blamePart *BlamePart diff --git a/modules/git/repo_commit.go b/modules/git/repo_commit.go index 5b417cd77455c..16ee5b2fd62f2 100644 --- a/modules/git/repo_commit.go +++ b/modules/git/repo_commit.go @@ -110,7 +110,7 @@ func (repo *Repository) searchCommits(id SHA1, opts SearchCommitsOptions) (*list } } - // add commiters if present in search query + // add committers if present in search query if len(opts.Committers) > 0 { for _, v := range opts.Committers { args = append(args, "--committer="+v) @@ -150,7 +150,7 @@ func (repo *Repository) searchCommits(id SHA1, opts SearchCommitsOptions) (*list stdout = append(stdout, '\n') } - // if there are any keywords (ie not commiter:, author:, time:) + // if there are any keywords (ie not committer:, author:, time:) // then let's iterate over them if len(opts.Keywords) > 0 { for _, v := range opts.Keywords { @@ -195,12 +195,12 @@ func (repo *Repository) FileChangedBetweenCommits(filename, id1, id2 string) (bo return len(strings.TrimSpace(string(stdout))) > 0, nil } -// FileCommitsCount return the number of files at a revison +// FileCommitsCount return the number of files at a revision func (repo *Repository) FileCommitsCount(revision, file string) (int64, error) { return CommitsCountFiles(repo.Path, []string{revision}, []string{file}) } -// CommitsByFileAndRange return the commits according revison file and the page +// CommitsByFileAndRange return the commits according revision file and the page func (repo *Repository) CommitsByFileAndRange(revision, file string, page int) (*list.List, error) { skip := (page - 1) * setting.Git.CommitsRangeSize @@ -240,7 +240,7 @@ func (repo *Repository) CommitsByFileAndRange(revision, file string, page int) ( return repo.parsePrettyFormatLogToList(stdout) } -// CommitsByFileAndRangeNoFollow return the commits according revison file and the page +// CommitsByFileAndRangeNoFollow return the commits according revision file and the page func (repo *Repository) CommitsByFileAndRangeNoFollow(revision, file string, page int) (*list.List, error) { stdout, err := NewCommand("log", revision, "--skip="+strconv.Itoa((page-1)*50), "--max-count="+strconv.Itoa(setting.Git.CommitsRangeSize), prettyLogFormat, "--", file).RunInDirBytes(repo.Path) diff --git a/modules/git/repo_stats.go b/modules/git/repo_stats.go index cb2a2bcf51027..aca5ab21ccb2e 100644 --- a/modules/git/repo_stats.go +++ b/modules/git/repo_stats.go @@ -33,7 +33,7 @@ type CodeActivityAuthor struct { Commits int64 } -// GetCodeActivityStats returns code statistics for acitivity page +// GetCodeActivityStats returns code statistics for activity page func (repo *Repository) GetCodeActivityStats(fromTime time.Time, branch string) (*CodeActivityStats, error) { stats := &CodeActivityStats{} diff --git a/modules/git/utils.go b/modules/git/utils.go index d95218941606b..13926fba72df3 100644 --- a/modules/git/utils.go +++ b/modules/git/utils.go @@ -13,7 +13,7 @@ import ( "sync" ) -// ObjectCache provides thread-safe cache opeations. +// ObjectCache provides thread-safe cache operations. type ObjectCache struct { lock sync.RWMutex cache map[string]interface{} diff --git a/modules/indexer/code/elastic_search.go b/modules/indexer/code/elastic_search.go index 38a97ad888c05..569917f151f49 100644 --- a/modules/indexer/code/elastic_search.go +++ b/modules/indexer/code/elastic_search.go @@ -284,7 +284,7 @@ func (b *ElasticSearchIndexer) Delete(repoID int64) error { } // indexPos find words positions for start and the following end on content. It will -// return the beginning position of the frist start and the ending position of the +// return the beginning position of the first start and the ending position of the // first end following the start string. // If not found any of the positions, it will return -1, -1. func indexPos(content, start, end string) (int, int) { @@ -308,8 +308,8 @@ func convertResult(searchResult *elastic.SearchResult, kw string, pageSize int) var startIndex, endIndex int = -1, -1 c, ok := hit.Highlight["content"] if ok && len(c) > 0 { - // FIXME: Since the high lighting content will include and for the keywords, - // now we should find the poisitions. But how to avoid html content which contains the + // FIXME: Since the highlighting content will include and for the keywords, + // now we should find the positions. But how to avoid html content which contains the // and tags? If elastic search has handled that? startIndex, endIndex = indexPos(c[0], "", "") if startIndex == -1 { diff --git a/modules/lfs/shared.go b/modules/lfs/shared.go index 8343d12e1d603..d010b05ee56a9 100644 --- a/modules/lfs/shared.go +++ b/modules/lfs/shared.go @@ -49,7 +49,7 @@ type ObjectResponse struct { Error *ObjectError `json:"error,omitempty"` } -// Link provides a structure with informations about how to access a object. +// Link provides a structure with information about how to access a object. type Link struct { Href string `json:"href"` Header map[string]string `json:"header,omitempty"` diff --git a/modules/log/colors_router.go b/modules/log/colors_router.go index e291a0da99daa..3064e005cfa9d 100644 --- a/modules/log/colors_router.go +++ b/modules/log/colors_router.go @@ -19,7 +19,7 @@ var statusToColor = map[int][]byte{ 500: ColorBytes(Bold, BgRed), } -// ColoredStatus addes colors for HTTP status +// ColoredStatus adds colors for HTTP status func ColoredStatus(status int, s ...string) *ColoredValue { color, ok := statusToColor[status] if !ok { @@ -43,7 +43,7 @@ var methodToColor = map[string][]byte{ "HEAD": ColorBytes(FgBlue, Faint), } -// ColoredMethod addes colors for HtTP methos on log +// ColoredMethod adds colors for HTTP methods on log func ColoredMethod(method string) *ColoredValue { color, ok := methodToColor[method] if !ok { @@ -72,7 +72,7 @@ var ( wayTooLong = ColorBytes(BgMagenta) ) -// ColoredTime addes colors for time on log +// ColoredTime adds colors for time on log func ColoredTime(duration time.Duration) *ColoredValue { for i, k := range durations { if duration < k { diff --git a/modules/markup/html.go b/modules/markup/html.go index 7afd8114c1b32..6d0b4fbea2f35 100644 --- a/modules/markup/html.go +++ b/modules/markup/html.go @@ -274,7 +274,7 @@ func RenderDescriptionHTML( } // RenderEmoji for when we want to just process emoji and shortcodes -// in various places it isn't already run through the normal markdown procesor +// in various places it isn't already run through the normal markdown processor func RenderEmoji( content string, ) (string, error) { diff --git a/modules/markup/markdown/ast.go b/modules/markup/markdown/ast.go index d735ff5ebd847..5191d94cdd85a 100644 --- a/modules/markup/markdown/ast.go +++ b/modules/markup/markdown/ast.go @@ -74,7 +74,7 @@ func IsSummary(node ast.Node) bool { return ok } -// TaskCheckBoxListItem is a block that repressents a list item of a markdown block with a checkbox +// TaskCheckBoxListItem is a block that represents a list item of a markdown block with a checkbox type TaskCheckBoxListItem struct { *ast.ListItem IsChecked bool diff --git a/modules/markup/mdstripper/mdstripper_test.go b/modules/markup/mdstripper/mdstripper_test.go index 9efcc359496ca..13cea0ff72a12 100644 --- a/modules/markup/mdstripper/mdstripper_test.go +++ b/modules/markup/mdstripper/mdstripper_test.go @@ -25,7 +25,7 @@ func TestMarkdownStripper(t *testing.T) { This is [one](link) to paradise. This **is emphasized**. -This: should coallesce. +This: should coalesce. ` + "```" + ` This is a code block. @@ -44,7 +44,7 @@ A HIDDEN ` + "`" + `GHOST` + "`" + ` IN THIS LINE. "This", "is emphasized", ".", - "This: should coallesce.", + "This: should coalesce.", "Bullet 1", "Bullet 2", "A HIDDEN", diff --git a/modules/migrations/base/downloader.go b/modules/migrations/base/downloader.go index 2388b2dd6e770..71c8f3eaf9788 100644 --- a/modules/migrations/base/downloader.go +++ b/modules/migrations/base/downloader.go @@ -18,7 +18,7 @@ type GetCommentOptions struct { PageSize int } -// Downloader downloads the site repo informations +// Downloader downloads the site repo information type Downloader interface { SetContext(context.Context) GetRepoInfo() (*Repository, error) diff --git a/modules/migrations/base/label.go b/modules/migrations/base/label.go index 0c86b547f1940..5a66e7620f62b 100644 --- a/modules/migrations/base/label.go +++ b/modules/migrations/base/label.go @@ -5,7 +5,7 @@ package base -// Label defines a standard label informations +// Label defines a standard label information type Label struct { Name string Color string diff --git a/modules/migrations/base/uploader.go b/modules/migrations/base/uploader.go index dfcf81d052240..4d0257df37b0d 100644 --- a/modules/migrations/base/uploader.go +++ b/modules/migrations/base/uploader.go @@ -5,7 +5,7 @@ package base -// Uploader uploads all the informations of one repository +// Uploader uploads all the information of one repository type Uploader interface { MaxBatchInsertSize(tp string) int CreateRepo(repo *Repository, opts MigrateOptions) error diff --git a/modules/migrations/github.go b/modules/migrations/github.go index 9b897662d0304..7d4c492c24c3a 100644 --- a/modules/migrations/github.go +++ b/modules/migrations/github.go @@ -61,7 +61,7 @@ func (f *GithubDownloaderV3Factory) GitServiceType() structs.GitServiceType { return structs.GithubService } -// GithubDownloaderV3 implements a Downloader interface to get repository informations +// GithubDownloaderV3 implements a Downloader interface to get repository information // from github via APIv3 type GithubDownloaderV3 struct { base.NullDownloader diff --git a/modules/migrations/gitlab.go b/modules/migrations/gitlab.go index c83989f771fb3..fe763f9900332 100644 --- a/modules/migrations/gitlab.go +++ b/modules/migrations/gitlab.go @@ -56,7 +56,7 @@ func (f *GitlabDownloaderFactory) GitServiceType() structs.GitServiceType { return structs.GitlabService } -// GitlabDownloader implements a Downloader interface to get repository informations +// GitlabDownloader implements a Downloader interface to get repository information // from gitlab via go-gitlab // - issueCount is incremented in GetIssues() to ensure PR and Issue numbers do not overlap, // because Gitlab has individual Issue and Pull Request numbers. diff --git a/modules/migrations/gogs.go b/modules/migrations/gogs.go index d689b0da1155b..9e663fd1fee47 100644 --- a/modules/migrations/gogs.go +++ b/modules/migrations/gogs.go @@ -57,7 +57,7 @@ func (f *GogsDownloaderFactory) GitServiceType() structs.GitServiceType { return structs.GogsService } -// GogsDownloader implements a Downloader interface to get repository informations +// GogsDownloader implements a Downloader interface to get repository information // from gogs via API type GogsDownloader struct { base.NullDownloader diff --git a/modules/notification/base/null.go b/modules/notification/base/null.go index e61b37a943090..32fe259bca8d7 100644 --- a/modules/notification/base/null.go +++ b/modules/notification/base/null.go @@ -143,7 +143,7 @@ func (*NullNotifier) NotifyPushCommits(pusher *models.User, repo *models.Reposit func (*NullNotifier) NotifyCreateRef(doer *models.User, repo *models.Repository, refType, refFullName string) { } -// NotifyDeleteRef notifies branch or tag deleteion to notifiers +// NotifyDeleteRef notifies branch or tag deletion to notifiers func (*NullNotifier) NotifyDeleteRef(doer *models.User, repo *models.Repository, refType, refFullName string) { } diff --git a/modules/references/references_test.go b/modules/references/references_test.go index 293322a7142ee..11a31b41b683f 100644 --- a/modules/references/references_test.go +++ b/modules/references/references_test.go @@ -481,7 +481,7 @@ func TestParseCloseKeywords(t *testing.T) { {",$!", "", ""}, {"1234", "", ""}, } { - // The patern only needs to match the part that precedes the reference. + // The pattern only needs to match the part that precedes the reference. // getCrossReference() takes care of finding the reference itself. pat := makeKeywordsPat([]string{test.pattern}) if test.expected == "" { diff --git a/modules/repofiles/action_test.go b/modules/repofiles/action_test.go index 290844de02674..97632df68fb89 100644 --- a/modules/repofiles/action_test.go +++ b/modules/repofiles/action_test.go @@ -250,7 +250,7 @@ func TestUpdateIssuesCommit_AnotherRepoNoPermission(t *testing.T) { user := models.AssertExistsAndLoadBean(t, &models.User{ID: 10}).(*models.User) // Test that a push with close reference *can not* close issue - // If the commiter doesn't have push rights in that repo + // If the committer doesn't have push rights in that repo pushCommits := []*repository.PushCommit{ { Sha1: "abcdef3", diff --git a/modules/repofiles/content_test.go b/modules/repofiles/content_test.go index 278216112296c..253d434459294 100644 --- a/modules/repofiles/content_test.go +++ b/modules/repofiles/content_test.go @@ -69,7 +69,7 @@ func TestGetContents(t *testing.T) { assert.NoError(t, err) }) - t.Run("Get REAMDE.md contents with ref as empty string (should then use the repo's default branch) with GetContents()", func(t *testing.T) { + t.Run("Get README.md contents with ref as empty string (should then use the repo's default branch) with GetContents()", func(t *testing.T) { fileContentResponse, err := GetContents(ctx.Repo.Repository, treePath, "", false) assert.EqualValues(t, expectedContentsResponse, fileContentResponse) assert.NoError(t, err) @@ -132,7 +132,7 @@ func TestGetContentsOrListForFile(t *testing.T) { assert.NoError(t, err) }) - t.Run("Get REAMDE.md contents with ref as empty string (should then use the repo's default branch) with GetContentsOrList()", func(t *testing.T) { + t.Run("Get README.md contents with ref as empty string (should then use the repo's default branch) with GetContentsOrList()", func(t *testing.T) { fileContentResponse, err := GetContentsOrList(ctx.Repo.Repository, treePath, "") assert.EqualValues(t, expectedContentsResponse, fileContentResponse) assert.NoError(t, err) diff --git a/modules/repository/adopt.go b/modules/repository/adopt.go index a37f770496332..321e6ab7672cd 100644 --- a/modules/repository/adopt.go +++ b/modules/repository/adopt.go @@ -129,12 +129,12 @@ func ListUnadoptedRepositories(query string, opts *models.ListOptions) ([]string var err error globUser, err = glob.Compile(qsplit[0]) if err != nil { - log.Info("Invalid glob expresion '%s' (skipped): %v", qsplit[0], err) + log.Info("Invalid glob expression '%s' (skipped): %v", qsplit[0], err) } if len(qsplit) > 1 { globRepo, err = glob.Compile(qsplit[1]) if err != nil { - log.Info("Invalid glob expresion '%s' (skipped): %v", qsplit[1], err) + log.Info("Invalid glob expression '%s' (skipped): %v", qsplit[1], err) } } } diff --git a/modules/secret/secret.go b/modules/secret/secret.go index 7a06730c392db..976924ac606d3 100644 --- a/modules/secret/secret.go +++ b/modules/secret/secret.go @@ -17,7 +17,7 @@ import ( "code.gitea.io/gitea/modules/util" ) -// New creats a new secret +// New creates a new secret func New() (string, error) { return NewWithLength(44) } diff --git a/modules/setting/indexer.go b/modules/setting/indexer.go index f170a8d3afce9..2e9d8b288356e 100644 --- a/modules/setting/indexer.go +++ b/modules/setting/indexer.go @@ -101,7 +101,7 @@ func IndexerGlobFromString(globstr string) []glob.Glob { expr = strings.TrimSpace(expr) if expr != "" { if g, err := glob.Compile(expr, '.', '/'); err != nil { - log.Info("Invalid glob expresion '%s' (skipped): %v", expr, err) + log.Info("Invalid glob expression '%s' (skipped): %v", expr, err) } else { extarr = append(extarr, g) } diff --git a/modules/setting/session.go b/modules/setting/session.go index 97666c5e53da1..bce73b51da647 100644 --- a/modules/setting/session.go +++ b/modules/setting/session.go @@ -15,7 +15,7 @@ import ( ) var ( - // SessionConfig difines Session settings + // SessionConfig defines Session settings SessionConfig = struct { Provider string // Provider configuration, it's corresponding to provider. diff --git a/modules/storage/storage.go b/modules/storage/storage.go index b3708908f8183..2fe14b41ef0ec 100644 --- a/modules/storage/storage.go +++ b/modules/storage/storage.go @@ -71,7 +71,7 @@ type ObjectStorage interface { IterateObjects(func(path string, obj Object) error) error } -// Copy copys a file from source ObjectStorage to dest ObjectStorage +// Copy copies a file from source ObjectStorage to dest ObjectStorage func Copy(dstStorage ObjectStorage, dstPath string, srcStorage ObjectStorage, srcPath string) (int64, error) { f, err := srcStorage.Open(srcPath) if err != nil { diff --git a/modules/task/migrate.go b/modules/task/migrate.go index 1d190faf872af..d7655112d351c 100644 --- a/modules/task/migrate.go +++ b/modules/task/migrate.go @@ -74,7 +74,7 @@ func runMigrateTask(t *models.Task) (err error) { return } - // if repository is ready, then just finsih the task + // if repository is ready, then just finish the task if t.Repo.Status == models.RepositoryReady { return nil } diff --git a/modules/typesniffer/typesniffer.go b/modules/typesniffer/typesniffer.go index 7c89f66699c12..d257b8179b0ad 100644 --- a/modules/typesniffer/typesniffer.go +++ b/modules/typesniffer/typesniffer.go @@ -21,7 +21,7 @@ const SvgMimeType = "image/svg+xml" var svgTagRegex = regexp.MustCompile(`(?si)\A\s*(?:(||>))\s*)*\/]`) var svgTagInXMLRegex = regexp.MustCompile(`(?si)\A<\?xml\b.*?\?>\s*(?:(||>))\s*)*\/]`) -// SniffedType contains informations about a blobs type. +// SniffedType contains information about a blobs type. type SniffedType struct { contentType string } diff --git a/modules/util/path.go b/modules/util/path.go index 2ac8f4d80a3e0..e79747327d75b 100644 --- a/modules/util/path.go +++ b/modules/util/path.go @@ -154,7 +154,7 @@ func StatDir(rootPath string, includeDir ...bool) ([]string, error) { return statDir(rootPath, "", isIncludeDir, false, false) } -// FileURLToPath extracts the path informations from a file://... url. +// FileURLToPath extracts the path information from a file://... url. func FileURLToPath(u *url.URL) (string, error) { if u.Scheme != "file" { return "", errors.New("URL scheme is not 'file': " + u.String()) diff --git a/modules/util/shellquote_test.go b/modules/util/shellquote_test.go index 2ddc6d763d86e..be6ba372fdfb6 100644 --- a/modules/util/shellquote_test.go +++ b/modules/util/shellquote_test.go @@ -33,7 +33,7 @@ func TestShellEscape(t *testing.T) { "~git/Gitea v1.13/gitea", `~git/"Gitea v1.13/gitea"`, }, { - "Bangs are unforutunately not predictable so need to be singlequoted", + "Bangs are unfortunately not predictable so need to be singlequoted", "C:/Program Files/Gitea!/gitea", `'C:/Program Files/Gitea!/gitea'`, }, { @@ -41,7 +41,7 @@ func TestShellEscape(t *testing.T) { "/home/git/Gitea\n\nWHY-WOULD-YOU-DO-THIS\n\nGitea/gitea", "'/home/git/Gitea\n\nWHY-WOULD-YOU-DO-THIS\n\nGitea/gitea'", }, { - "Similarly we should nicely handle mutiple single quotes if we have to single-quote", + "Similarly we should nicely handle multiple single quotes if we have to single-quote", "'!''!'''!''!'!'", `\''!'\'\''!'\'\'\''!'\'\''!'\''!'\'`, }, { diff --git a/modules/validation/helpers.go b/modules/validation/helpers.go index 343261aac5b59..617ec3578c8f9 100644 --- a/modules/validation/helpers.go +++ b/modules/validation/helpers.go @@ -92,7 +92,7 @@ func IsValidExternalURL(uri string) bool { return false } - // TODO: Later it should be added to allow local network IP addreses + // TODO: Later it should be added to allow local network IP addresses // only if allowed by special setting return true diff --git a/modules/validation/helpers_test.go b/modules/validation/helpers_test.go index cc2a4b720d7a4..f6f897e8210da 100644 --- a/modules/validation/helpers_test.go +++ b/modules/validation/helpers_test.go @@ -24,12 +24,12 @@ func Test_IsValidURL(t *testing.T) { valid: false, }, { - description: "Loobpack IPv4 URL", + description: "Loopback IPv4 URL", url: "http://127.0.1.1:5678/", valid: true, }, { - description: "Loobpack IPv6 URL", + description: "Loopback IPv6 URL", url: "https://[::1]/", valid: true, }, @@ -61,7 +61,7 @@ func Test_IsValidExternalURL(t *testing.T) { valid: true, }, { - description: "Loobpack IPv4 URL", + description: "Loopback IPv4 URL", url: "http://127.0.1.1:5678/", valid: false, }, diff --git a/modules/validation/refname_test.go b/modules/validation/refname_test.go index 974d9565632d0..2d6458b9b5a50 100644 --- a/modules/validation/refname_test.go +++ b/modules/validation/refname_test.go @@ -12,7 +12,7 @@ import ( var gitRefNameValidationTestCases = []validationTestCase{ { - description: "Referece contains only characters", + description: "Reference name contains only characters", data: TestForm{ BranchName: "test", }, diff --git a/routers/api/v1/repo/issue_tracked_time.go b/routers/api/v1/repo/issue_tracked_time.go index 642704800b5c8..ad774b563bcc1 100644 --- a/routers/api/v1/repo/issue_tracked_time.go +++ b/routers/api/v1/repo/issue_tracked_time.go @@ -526,7 +526,7 @@ func ListTrackedTimesByRepository(ctx *context.APIContext) { if opts.UserID == 0 { opts.UserID = ctx.User.ID } else { - ctx.Error(http.StatusForbidden, "", fmt.Errorf("query user not allowed not enouth rights")) + ctx.Error(http.StatusForbidden, "", fmt.Errorf("query by user not allowed; not enough rights")) return } } diff --git a/routers/api/v1/user/app.go b/routers/api/v1/user/app.go index 7b69c50d7eb7f..9f355a8289506 100644 --- a/routers/api/v1/user/app.go +++ b/routers/api/v1/user/app.go @@ -166,7 +166,7 @@ func DeleteAccessToken(ctx *context.APIContext) { case 1: tokenID = tokens[0].ID default: - ctx.Error(http.StatusUnprocessableEntity, "DeleteAccessTokenByID", fmt.Errorf("multible matches for token name '%s'", token)) + ctx.Error(http.StatusUnprocessableEntity, "DeleteAccessTokenByID", fmt.Errorf("multiple matches for token name '%s'", token)) return } } diff --git a/routers/web/admin/users.go b/routers/web/admin/users.go index e1903ab1dfafc..acccc516bb456 100644 --- a/routers/web/admin/users.go +++ b/routers/web/admin/users.go @@ -205,7 +205,7 @@ func prepareUserInfo(ctx *context.Context) *models.User { return u } -// EditUser show editting user page +// EditUser show editing user page func EditUser(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("admin.users.edit_account") ctx.Data["PageIsAdmin"] = true @@ -222,7 +222,7 @@ func EditUser(ctx *context.Context) { ctx.HTML(http.StatusOK, tplUserEdit) } -// EditUserPost response for editting user +// EditUserPost response for editing user func EditUserPost(ctx *context.Context) { form := web.GetForm(ctx).(*forms.AdminEditUserForm) ctx.Data["Title"] = ctx.Tr("admin.users.edit_account") diff --git a/routers/web/org/setting.go b/routers/web/org/setting.go index aed90c66f7455..e848939187ce1 100644 --- a/routers/web/org/setting.go +++ b/routers/web/org/setting.go @@ -39,7 +39,7 @@ func Settings(ctx *context.Context) { ctx.HTML(http.StatusOK, tplSettingsOptions) } -// SettingsPost response for settings change submited +// SettingsPost response for settings change submitted func SettingsPost(ctx *context.Context) { form := web.GetForm(ctx).(*forms.UpdateOrgSettingForm) ctx.Data["Title"] = ctx.Tr("org.settings") @@ -139,7 +139,7 @@ func SettingsAvatar(ctx *context.Context) { ctx.Redirect(ctx.Org.OrgLink + "/settings") } -// SettingsDeleteAvatar response for delete avatar on setings page +// SettingsDeleteAvatar response for delete avatar on settings page func SettingsDeleteAvatar(ctx *context.Context) { if err := ctx.Org.Organization.DeleteAvatar(); err != nil { ctx.Flash.Error(err.Error()) diff --git a/routers/web/repo/http.go b/routers/web/repo/http.go index 649d6d1eb1a35..3390f026a0c17 100644 --- a/routers/web/repo/http.go +++ b/routers/web/repo/http.go @@ -32,7 +32,7 @@ import ( repo_service "code.gitea.io/gitea/services/repository" ) -// httpBase implmentation git smart HTTP protocol +// httpBase implementation git smart HTTP protocol func httpBase(ctx *context.Context) (h *serviceHandler) { if setting.Repository.DisableHTTPGit { ctx.Resp.WriteHeader(http.StatusForbidden) diff --git a/routers/web/repo/issue.go b/routers/web/repo/issue.go index 9ef5c1d1f05fe..9639ea82014ac 100644 --- a/routers/web/repo/issue.go +++ b/routers/web/repo/issue.go @@ -831,7 +831,7 @@ func NewIssueChooseTemplate(ctx *context.Context) { ctx.HTML(http.StatusOK, tplIssueChoose) } -// ValidateRepoMetas check and returns repository's meta informations +// ValidateRepoMetas check and returns repository's meta information func ValidateRepoMetas(ctx *context.Context, form forms.CreateIssueForm, isPull bool) ([]int64, []int64, int64, int64) { var ( repo = ctx.Repo.Repository diff --git a/routers/web/repo/view.go b/routers/web/repo/view.go index 90d06d11c1e1a..cf076bdf1a839 100644 --- a/routers/web/repo/view.go +++ b/routers/web/repo/view.go @@ -751,7 +751,7 @@ func renderCode(ctx *context.Context) { ctx.HTML(http.StatusOK, tplRepoHome) } -// RenderUserCards render a page show users according the input templaet +// RenderUserCards render a page show users according the input template func RenderUserCards(ctx *context.Context, total int, getter func(opts models.ListOptions) ([]*models.User, error), tpl base.TplName) { page := ctx.QueryInt("page") if page <= 0 { diff --git a/routers/web/user/auth.go b/routers/web/user/auth.go index 6b4beff0e081f..9458bf5c95a9c 100644 --- a/routers/web/user/auth.go +++ b/routers/web/user/auth.go @@ -1473,7 +1473,7 @@ func ActivateEmail(ctx *context.Context) { ctx.Redirect(setting.AppSubURL + "/user/settings/account") } -// ForgotPasswd render the forget pasword page +// ForgotPasswd render the forget password page func ForgotPasswd(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("auth.forgot_password_title") diff --git a/routers/web/web.go b/routers/web/web.go index 627c88aab1c5c..7a47f479c0da3 100644 --- a/routers/web/web.go +++ b/routers/web/web.go @@ -146,7 +146,7 @@ func Routes() *web.Route { routes.Get("/metrics", append(common, Metrics)...) } - // Removed: toolbox.Toolboxer middleware will provide debug informations which seems unnecessary + // Removed: toolbox.Toolboxer middleware will provide debug information which seems unnecessary common = append(common, context.Contexter()) // Get user from session if logged in. diff --git a/services/auth/sspi_windows.go b/services/auth/sspi_windows.go index d1289a76174b2..bb0291d2c9ba8 100644 --- a/services/auth/sspi_windows.go +++ b/services/auth/sspi_windows.go @@ -73,7 +73,7 @@ func (s *SSPI) Free() error { } // Verify uses SSPI (Windows implementation of SPNEGO) to authenticate the request. -// If authentication is successful, returs the corresponding user object. +// If authentication is successful, returns the corresponding user object. // If negotiation should continue or authentication fails, immediately returns a 401 HTTP // response code, as required by the SPNEGO protocol. func (s *SSPI) Verify(req *http.Request, w http.ResponseWriter, store DataStore, sess SessionStore) *models.User { diff --git a/services/issue/assignee.go b/services/issue/assignee.go index f24a242f6b7d1..12addede75880 100644 --- a/services/issue/assignee.go +++ b/services/issue/assignee.go @@ -25,7 +25,7 @@ func DeleteNotPassedAssignee(issue *models.Issue, doer *models.User, assignees [ } if !found { - // This function also does comments and hooks, which is why we call it seperatly instead of directly removing the assignees here + // This function also does comments and hooks, which is why we call it separately instead of directly removing the assignees here if _, _, err := ToggleAssignee(issue, doer, assignee.ID); err != nil { return err } diff --git a/services/mailer/mailer.go b/services/mailer/mailer.go index 6b86734bf845c..fae8d473e3419 100644 --- a/services/mailer/mailer.go +++ b/services/mailer/mailer.go @@ -304,7 +304,7 @@ var Sender gomail.Sender // NewContext start mail queue service func NewContext() { // Need to check if mailQueue is nil because in during reinstall (user had installed - // before but swithed install lock off), this function will be called again + // before but switched install lock off), this function will be called again // while mail queue is already processing tasks, and produces a race condition. if setting.MailService == nil || mailQueue != nil { return diff --git a/services/wiki/wiki_test.go b/services/wiki/wiki_test.go index 19f298f2d6413..b35b86d655be0 100644 --- a/services/wiki/wiki_test.go +++ b/services/wiki/wiki_test.go @@ -140,7 +140,7 @@ func TestRepository_AddWikiPage(t *testing.T) { wikiPath := NameToFilename(wikiName) entry, err := masterTree.GetTreeEntryByPath(wikiPath) assert.NoError(t, err) - assert.Equal(t, wikiPath, entry.Name(), "%s not addded correctly", wikiName) + assert.Equal(t, wikiPath, entry.Name(), "%s not added correctly", wikiName) }) } diff --git a/web_src/fomantic/build/semantic.css b/web_src/fomantic/build/semantic.css index 27ff073a567f6..ee136e13ff7cf 100644 --- a/web_src/fomantic/build/semantic.css +++ b/web_src/fomantic/build/semantic.css @@ -30873,7 +30873,7 @@ ol.ui.suffixed.list li:before, List ---------------*/ -/* Menu divider shouldnt apply */ +/* Menu divider shouldn't apply */ .ui.menu .list .item:before { background: none !important; @@ -31802,7 +31802,7 @@ Floated Menu / Item opacity: 1; } -/* Icon Gylph */ +/* Icon Glyph */ .ui.icon.menu i.icon:before { opacity: 1; diff --git a/web_src/fomantic/build/semantic.js b/web_src/fomantic/build/semantic.js index c1c80fcd27537..c68d266b0cd5f 100644 --- a/web_src/fomantic/build/semantic.js +++ b/web_src/fomantic/build/semantic.js @@ -142,7 +142,7 @@ $.api = $.fn.api = function(parameters) { response = JSON.parse(response); } catch(e) { - // isnt json string + // isn't json string } } return response; @@ -2220,7 +2220,7 @@ $.fn.dimmer = function(parameters) { event: { click: function(event) { - module.verbose('Determining if event occured on dimmer', event); + module.verbose('Determining if event occurred on dimmer', event); if( $dimmer.find(event.target).length === 0 || $(event.target).is(selector.content) ) { module.hide(); event.stopImmediatePropagation(); @@ -3368,7 +3368,7 @@ $.fn.dropdown = function(parameters) { if(settings.onHide.call(element) !== false) { module.animate.hide(function() { module.remove.visible(); - // hidding search focus + // hiding search focus if ( module.is.focusedOnSearch() && preventBlur !== true ) { $search.blur(); } @@ -11937,7 +11937,7 @@ $.fn.progress = function(parameters) { * * @param min A minimum value within multiple values * @param total A total amount of multiple values - * @returns {number} A precison. Could be 1, 10, 100, ... 1e+10. + * @returns {number} A precision. Could be 1, 10, 100, ... 1e+10. */ derivePrecision: function(min, total) { var precisionPower = 0 @@ -12837,7 +12837,7 @@ $.fn.progress.settings = { nonNumeric : 'Progress value is non numeric', tooHigh : 'Value specified is above 100%', tooLow : 'Value specified is below 0%', - sumExceedsTotal : 'Sum of multple values exceed total', + sumExceedsTotal : 'Sum of multiple values exceed total', }, regExp: { @@ -18076,7 +18076,7 @@ $.fn.transition.settings = { // possible errors error: { - noAnimation : 'Element is no longer attached to DOM. Unable to animate. Use silent setting to surpress this warning in production.', + noAnimation : 'Element is no longer attached to DOM. Unable to animate. Use silent setting to suppress this warning in production.', repeated : 'That animation is already occurring, cancelling repeated animation', method : 'The method you called is not defined', support : 'This browser does not support CSS animations' diff --git a/web_src/js/index.js b/web_src/js/index.js index fc46a2e694bd0..7a76b89f9b584 100644 --- a/web_src/js/index.js +++ b/web_src/js/index.js @@ -34,7 +34,7 @@ const commentMDEditors = {}; // Silence fomantic's error logging when tabs are used without a target content element $.fn.tab.settings.silent = true; -// Silence Vue's console advertisments in dev mode +// Silence Vue's console advertisements in dev mode // To use the Vue browser extension, enable the devtools option temporarily Vue.config.productionTip = false; Vue.config.devtools = false; @@ -461,7 +461,7 @@ function initCommentForm() { } // TODO: Which thing should be done for choosing review requests - // to make choosed items be shown on time here? + // to make chosen items be shown on time here? if (selector === 'select-reviewers-modify' || selector === 'select-assignees-modify') { return false; } diff --git a/web_src/less/_base.less b/web_src/less/_base.less index f9ac397e4e3d8..dac18f2bf6e23 100644 --- a/web_src/less/_base.less +++ b/web_src/less/_base.less @@ -134,7 +134,7 @@ pre, code, kbd, samp { - font-size: .9em; /* compensate for monospace fonts being usually slighty larger */ + font-size: .9em; /* compensate for monospace fonts being usually slightly larger */ font-family: var(--fonts-monospace); } @@ -748,7 +748,7 @@ a.ui.card:hover, box-shadow: none; } - /* Overide semantic selector '.ui.menu:not(.vertical) .item > .button' */ + /* Override semantic selector '.ui.menu:not(.vertical) .item > .button' */ /* This fixes the commit graph button on the commits page */ .menu:not(.vertical) .item > .button.compact { diff --git a/web_src/less/helpers.less b/web_src/less/helpers.less index 3f58184f061ae..5e067a1a3211f 100644 --- a/web_src/less/helpers.less +++ b/web_src/less/helpers.less @@ -17,7 +17,7 @@ .mono { font-family: var(--fonts-monospace) !important; - font-size: .9em !important; /* compensate for monospace fonts being usually slighty larger */ + font-size: .9em !important; /* compensate for monospace fonts being usually slightly larger */ } .bold { font-weight: 600 !important; } From fc1607b3686a5c8c79b9a7853c065a68dcd5218b Mon Sep 17 00:00:00 2001 From: luzpaz Date: Thu, 8 Jul 2021 08:55:09 -0400 Subject: [PATCH 2/3] Fix source typos (#16374) * Fix source typos Follow up to e0296b6a6 Found via `codespell -q 3 -S ./options/locale,./vendor -L ba,pullrequest,pullrequests,readby` * rm "ignore destory on `make misspell-check`" Co-authored-by: 6543 <6543@obermui.de> --- Makefile | 2 +- integrations/api_repo_lfs_test.go | 6 +++--- routers/web/admin/users_test.go | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 1fd4216dac859..c07dfbf475631 100644 --- a/Makefile +++ b/Makefile @@ -297,7 +297,7 @@ misspell-check: GO111MODULE=off $(GO) get -u github.com/client9/misspell/cmd/misspell; \ fi @echo "Running misspell-check..." - @misspell -error -i unknwon,destory $(GO_SOURCES_OWN) + @misspell -error -i unknwon $(GO_SOURCES_OWN) .PHONY: misspell misspell: diff --git a/integrations/api_repo_lfs_test.go b/integrations/api_repo_lfs_test.go index d0328fd12110c..9e1e2b0418944 100644 --- a/integrations/api_repo_lfs_test.go +++ b/integrations/api_repo_lfs_test.go @@ -135,7 +135,7 @@ func TestAPILFSBatch(t *testing.T) { assert.Equal(t, "Oid or size are invalid", br.Objects[1].Error.Message) }) - t.Run("PointerSizeMissmatch", func(t *testing.T) { + t.Run("PointerSizeMismatch", func(t *testing.T) { defer PrintCurrentTest(t)() req := newRequest(t, &lfs.BatchRequest{ @@ -376,7 +376,7 @@ func TestAPILFSUpload(t *testing.T) { session.MakeRequest(t, req, http.StatusOK) }) - t.Run("HashMissmatch", func(t *testing.T) { + t.Run("HashMismatch", func(t *testing.T) { defer PrintCurrentTest(t)() req := newRequest(t, lfs.Pointer{Oid: "2581dd7bbc1fe44726de4b7dd806a087a978b9c5aec0a60481259e34be09b06a", Size: 1}, "a") @@ -384,7 +384,7 @@ func TestAPILFSUpload(t *testing.T) { session.MakeRequest(t, req, http.StatusUnprocessableEntity) }) - t.Run("SizeMissmatch", func(t *testing.T) { + t.Run("SizeMismatch", func(t *testing.T) { defer PrintCurrentTest(t)() req := newRequest(t, lfs.Pointer{Oid: "ca978112ca1bbdcafac231b39a23dc4da786eff8147c4e72b9807785afee48bb", Size: 2}, "a") diff --git a/routers/web/admin/users_test.go b/routers/web/admin/users_test.go index 5ce20d8fa777c..3d0b11a77449c 100644 --- a/routers/web/admin/users_test.go +++ b/routers/web/admin/users_test.go @@ -122,7 +122,7 @@ func TestNewUserPost_InvalidEmail(t *testing.T) { assert.NotEmpty(t, ctx.Flash.ErrorMsg) } -func TestNewUserPost_VisiblityDefaultPublic(t *testing.T) { +func TestNewUserPost_VisibilityDefaultPublic(t *testing.T) { models.PrepareTestEnv(t) ctx := test.MockContext(t, "admin/users/new") From d06f9ce27452ec0b80d548242bf59d65f89952bf Mon Sep 17 00:00:00 2001 From: zeripath Date: Thu, 8 Jul 2021 14:57:24 +0100 Subject: [PATCH 3/3] Redirect on bad CSRF instead of presenting bad page (#14937) The current CSRF handler is a bit harsh with bad CSRF tokens on webpages I think we can be a little kinder and redirect to base page with a flash error Signed-off-by: Andrew Thornton --- integrations/repo_branch_test.go | 11 ++++++++++- modules/context/csrf.go | 23 +++++++++++++++++++---- options/locale/locale_en-US.ini | 2 ++ 3 files changed, 31 insertions(+), 5 deletions(-) diff --git a/integrations/repo_branch_test.go b/integrations/repo_branch_test.go index de4e668987979..af5c475ea7dcb 100644 --- a/integrations/repo_branch_test.go +++ b/integrations/repo_branch_test.go @@ -11,6 +11,7 @@ import ( "strings" "testing" + "code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/modules/test" "github.com/stretchr/testify/assert" @@ -134,5 +135,13 @@ func TestCreateBranchInvalidCSRF(t *testing.T) { "_csrf": "fake_csrf", "new_branch_name": "test", }) - session.MakeRequest(t, req, http.StatusBadRequest) + resp := session.MakeRequest(t, req, http.StatusFound) + loc := resp.Header().Get("Location") + assert.Equal(t, setting.AppSubURL+"/", loc) + resp = session.MakeRequest(t, NewRequest(t, "GET", loc), http.StatusOK) + htmlDoc := NewHTMLParser(t, resp.Body) + assert.Equal(t, + "Bad Request: Invalid CSRF token", + strings.TrimSpace(htmlDoc.doc.Find(".ui.message").Text()), + ) } diff --git a/modules/context/csrf.go b/modules/context/csrf.go index ba0e9f6cde773..8d179ca904748 100644 --- a/modules/context/csrf.go +++ b/modules/context/csrf.go @@ -22,6 +22,7 @@ import ( "net/http" "time" + "code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/modules/web/middleware" "github.com/unknwon/com" @@ -266,7 +267,12 @@ func Validate(ctx *Context, x CSRF) { -1, x.GetCookiePath(), x.GetCookieDomain()) // FIXME: Do we need to set the Secure, httpOnly and SameSite values too? - x.Error(ctx.Resp) + if middleware.IsAPIPath(ctx.Req) { + x.Error(ctx.Resp) + return + } + ctx.Flash.Error(ctx.Tr("error.invalid_csrf")) + ctx.Redirect(setting.AppSubURL + "/") } return } @@ -277,10 +283,19 @@ func Validate(ctx *Context, x CSRF) { -1, x.GetCookiePath(), x.GetCookieDomain()) // FIXME: Do we need to set the Secure, httpOnly and SameSite values too? - x.Error(ctx.Resp) + if middleware.IsAPIPath(ctx.Req) { + x.Error(ctx.Resp) + return + } + ctx.Flash.Error(ctx.Tr("error.invalid_csrf")) + ctx.Redirect(setting.AppSubURL + "/") } return } - - http.Error(ctx.Resp, "Bad Request: no CSRF token present", http.StatusBadRequest) + if middleware.IsAPIPath(ctx.Req) { + http.Error(ctx.Resp, "Bad Request: no CSRF token present", http.StatusBadRequest) + return + } + ctx.Flash.Error(ctx.Tr("error.missing_csrf")) + ctx.Redirect(setting.AppSubURL + "/") } diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index dcdfa611ec950..7f58a11e73852 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -100,6 +100,8 @@ never = Never [error] occurred = An error has occurred report_message = If you are sure this is a Gitea bug, please search for issue on GitHub and open new issue if necessary. +missing_csrf = Bad Request: no CSRF token present +invalid_csrf = Bad Request: Invalid CSRF token [startpage] app_desc = A painless, self-hosted Git service