Skip to content

Commit

Permalink
all: Fix typos in function names and comments
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandear authored and bep committed Jun 19, 2023
1 parent 12dc9a6 commit 9009c8c
Show file tree
Hide file tree
Showing 27 changed files with 41 additions and 41 deletions.
2 changes: 1 addition & 1 deletion cache/docs.go
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// Package cache contains the differenct cache implementations.
// Package cache contains the different cache implementations.
package cache
2 changes: 1 addition & 1 deletion cache/filecache/filecache_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ type FileCacheConfig struct {
// Max age of cache entries in this cache. Any items older than this will
// be removed and not returned from the cache.
// A negative value means forever, 0 means cache is disabled.
// Hugo is leninent with what types it accepts here, but we recommend using
// Hugo is lenient with what types it accepts here, but we recommend using
// a duration string, a sequence of decimal numbers, each with optional fraction and a unit suffix,
// such as "300ms", "1.5h" or "2h45m".
// Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".
Expand Down
8 changes: 4 additions & 4 deletions commands/commandeer.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,11 +238,11 @@ func (r *rootCommand) ConfigFromProvider(key int32, cfg config.Provider) (*commo
renderStaticToDisk := cfg.GetBool("renderStaticToDisk")

sourceFs := hugofs.Os
var desinationFs afero.Fs
var destinationFs afero.Fs
if cfg.GetBool("renderToDisk") {
desinationFs = hugofs.Os
destinationFs = hugofs.Os
} else {
desinationFs = afero.NewMemMapFs()
destinationFs = afero.NewMemMapFs()
if renderStaticToDisk {
// Hybrid, render dynamic content to Root.
cfg.Set("publishDirDynamic", "/")
Expand All @@ -253,7 +253,7 @@ func (r *rootCommand) ConfigFromProvider(key int32, cfg config.Provider) (*commo
}
}

fs := hugofs.NewFromSourceAndDestination(sourceFs, desinationFs, cfg)
fs := hugofs.NewFromSourceAndDestination(sourceFs, destinationFs, cfg)

if renderStaticToDisk {
dynamicFs := fs.PublishDir
Expand Down
2 changes: 1 addition & 1 deletion commands/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ type convertCommand struct {
r *rootCommand
h *hugolib.HugoSites

// Commmands.
// Commands.
commands []simplecobra.Commander
}

Expand Down
2 changes: 1 addition & 1 deletion common/herrors/error_locator.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ type LineMatcher struct {
}

// LineMatcherFn is used to match a line with an error.
// It returns the column number or 0 if the line was found, but column could not be determinde. Returns -1 if no line match.
// It returns the column number or 0 if the line was found, but column could not be determined. Returns -1 if no line match.
type LineMatcherFn func(m LineMatcher) int

// SimpleLineMatcher simply matches by line number.
Expand Down
4 changes: 2 additions & 2 deletions common/herrors/file_error.go
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ func extractFileTypePos(err error) (string, text.Position) {
}

// The error type from the minifier contains line number and column number.
if line, col := exctractLineNumberAndColumnNumber(err); line >= 0 {
if line, col := extractLineNumberAndColumnNumber(err); line >= 0 {
pos.LineNumber = line
pos.ColumnNumber = col
return fileType, pos
Expand Down Expand Up @@ -369,7 +369,7 @@ func extractOffsetAndType(e error) (int, string) {
}
}

func exctractLineNumberAndColumnNumber(e error) (int, int) {
func extractLineNumberAndColumnNumber(e error) (int, int) {
switch v := e.(type) {
case *parse.Error:
return v.Line, v.Column
Expand Down
2 changes: 1 addition & 1 deletion common/hexec/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ func SafeCommand(name string, arg ...string) (*exec.Cmd, error) {
return exec.Command(bin, arg...), nil
}

// Exec encorces a security policy for commands run via os/exec.
// Exec enforces a security policy for commands run via os/exec.
type Exec struct {
sc security.Config

Expand Down
2 changes: 1 addition & 1 deletion common/paths/path.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ func extractFilename(in, ext, base, pathSeparator string) (name string) {
// return the filename minus the extension (and the ".")
name = base[:strings.LastIndex(base, ".")]
} else {
// no extension case so just return base, which willi
// no extension case so just return base, which will
// be the filename
name = base
}
Expand Down
4 changes: 2 additions & 2 deletions config/allconfig/allconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -424,10 +424,10 @@ type RootConfig struct {
// Copyright information.
Copyright string

// The language to apply to content without any Clolanguage indicator.
// The language to apply to content without any language indicator.
DefaultContentLanguage string

// By defefault, we put the default content language in the root and the others below their language ID, e.g. /no/.
// By default, we put the default content language in the root and the others below their language ID, e.g. /no/.
// Set this to true to put all languages below their language ID.
DefaultContentLanguageInSubdir bool

Expand Down
4 changes: 2 additions & 2 deletions config/commonConfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ var defaultBuild = BuildConfig{
Source: `(postcss|tailwind)\.config\.js`,
Target: cssTargetCachebusterRe,
},
// This is deliberatly coarse grained; it will cache bust resources with "json" in the cache key when js files changes, which is good.
// This is deliberately coarse grained; it will cache bust resources with "json" in the cache key when js files changes, which is good.
{
Source: `assets/.*\.(.*)$`,
Target: `$1`,
Expand All @@ -113,7 +113,7 @@ type BuildConfig struct {
// related aggregated data (e.g. CSS class names).
WriteStats bool

// Can be used to toggle off writing of the intellinsense /assets/jsconfig.js
// Can be used to toggle off writing of the IntelliSense /assets/jsconfig.js
// file.
NoJSConfigInAssets bool

Expand Down
2 changes: 1 addition & 1 deletion helpers/emoji.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ var (
emojiMaxSize int
)

// Emoji returns the emojy given a key, e.g. ":smile:", nil if not found.
// Emoji returns the emoji given a key, e.g. ":smile:", nil if not found.
func Emoji(key string) []byte {
emojiInit.Do(initEmoji)
return emojis[key]
Expand Down
2 changes: 1 addition & 1 deletion helpers/emoji_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func TestEmojiCustom(t *testing.T) {
{" :beer: :", []byte(" 🍺 :")},
{":beer: and :smile: and another :beer:!", []byte("🍺 and 😄 and another 🍺!")},
{" :beer: : ", []byte(" 🍺 : ")},
{"No smilies for you!", []byte("No smilies for you!")},
{"No smiles for you!", []byte("No smiles for you!")},
{" The motto: no smiles! ", []byte(" The motto: no smiles! ")},
{":hugo_is_the_best_static_gen:", []byte(":hugo_is_the_best_static_gen:")},
{"은행 :smile: 은행", []byte("은행 😄 은행")},
Expand Down
2 changes: 1 addition & 1 deletion htesting/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func init() {
}

// CreateTempDir creates a temp dir in the given filesystem and
// returns the dirnam and a func that removes it when done.
// returns the dirname and a func that removes it when done.
func CreateTempDir(fs afero.Fs, prefix string) (string, func(), error) {
tempDir, err := afero.TempDir(fs, "", prefix)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions hugofs/filter_fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func NewLanguageFs(langs map[string]int, fs afero.Fs) (afero.Fs, error) {
fim := fi.(FileMetaInfo)
langs := translations[fim.Meta().TranslationBaseNameWithExt]
if len(langs) > 0 {
fim.Meta().Translations = sortAndremoveStringDuplicates(langs)
fim.Meta().Translations = sortAndRemoveStringDuplicates(langs)
}
}
}
Expand Down Expand Up @@ -328,7 +328,7 @@ func printFs(fs afero.Fs, path string, w io.Writer) {
})
}

func sortAndremoveStringDuplicates(s []string) []string {
func sortAndRemoveStringDuplicates(s []string) []string {
ss := sort.StringSlice(s)
ss.Sort()
i := 0
Expand Down
2 changes: 1 addition & 1 deletion hugofs/fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ func MakeReadableAndRemoveAllModulePkgDir(fs afero.Fs, dir string) (int, error)
}

// IsOsFs returns whether fs is an OsFs or if it fs wraps an OsFs.
// TODO(bep) make this nore robust.
// TODO(bep) make this more robust.
func IsOsFs(fs afero.Fs) bool {
var isOsFs bool
WalkFilesystems(fs, func(fs afero.Fs) bool {
Expand Down
8 changes: 4 additions & 4 deletions hugofs/glob/filename_filter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ func TestFilenameFilter(t *testing.T) {
c.Assert(includeOnlyFilter.Match("ab.jpg", false), qt.Equals, true)
c.Assert(includeOnlyFilter.Match("ab.gif", false), qt.Equals, false)

exlcudeOnlyFilter, err := NewFilenameFilter(nil, []string{"**.json", "**.jpg"})
excludeOnlyFilter, err := NewFilenameFilter(nil, []string{"**.json", "**.jpg"})
c.Assert(err, qt.IsNil)
c.Assert(exlcudeOnlyFilter.Match("ab.json", false), qt.Equals, false)
c.Assert(exlcudeOnlyFilter.Match("ab.jpg", false), qt.Equals, false)
c.Assert(exlcudeOnlyFilter.Match("ab.gif", false), qt.Equals, true)
c.Assert(excludeOnlyFilter.Match("ab.json", false), qt.Equals, false)
c.Assert(excludeOnlyFilter.Match("ab.jpg", false), qt.Equals, false)
c.Assert(excludeOnlyFilter.Match("ab.gif", false), qt.Equals, true)

var nilFilter *FilenameFilter
c.Assert(nilFilter.Match("ab.gif", false), qt.Equals, true)
Expand Down
8 changes: 4 additions & 4 deletions hugolib/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func TestLoadConfigLanguageParamsOverrideIssue10620(t *testing.T) {
files := `
-- hugo.toml --
baseURL = "https://example.com"
disableKinds = ["taxonomy", "term", "RSS", "sitemap", "robotsTXT", "page", "setion"]
disableKinds = ["taxonomy", "term", "RSS", "sitemap", "robotsTXT", "page", "section"]
title = "Base Title"
staticDir = "mystatic"
[params]
Expand Down Expand Up @@ -79,7 +79,7 @@ func TestLoadConfig(t *testing.T) {
files := `
-- hugo.toml --
baseURL = "https://example.com"
disableKinds = ["taxonomy", "term", "RSS", "sitemap", "robotsTXT", "page", "setion"]
disableKinds = ["taxonomy", "term", "RSS", "sitemap", "robotsTXT", "page", "section"]
title = "Base Title"
staticDir = "mystatic"
[params]
Expand Down Expand Up @@ -131,7 +131,7 @@ myparam = "svParamValue"
files := `
-- hugo.toml --
baseURL = "https://example.com"
disableKinds = ["taxonomy", "term", "RSS", "sitemap", "robotsTXT", "page", "setion"]
disableKinds = ["taxonomy", "term", "RSS", "sitemap", "robotsTXT", "page", "section"]
title = "Base Title"
defaultContentLanguage = "sv"
disableLanguages = ["sv"]
Expand Down Expand Up @@ -178,7 +178,7 @@ running = true
files := `
-- hugo.toml --
baseURL = "https://example.com"
disableKinds = ["taxonomy", "term", "RSS", "sitemap", "robotsTXT", "page", "setion"]
disableKinds = ["taxonomy", "term", "RSS", "sitemap", "robotsTXT", "page", "section"]
title = "Base Title"
[params]
p1 = "p1base"
Expand Down
2 changes: 1 addition & 1 deletion hugolib/configdir_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ b = "bc1"
-- hugo.toml --
baseURL = "https://example.com"
disableKinds = ["taxonomy", "term", "RSS", "sitemap", "robotsTXT", "page", "setion"]
disableKinds = ["taxonomy", "term", "RSS", "sitemap", "robotsTXT", "page", "section"]
ignoreErrors = ["error-missing-instagram-accesstoken"]
[params]
a = "a1"
Expand Down
2 changes: 1 addition & 1 deletion hugolib/datafiles_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func TestData(t *testing.T) {
files := `
-- hugo.toml --
baseURL = "https://example.com"
disableKinds = ["taxonomy", "term", "RSS", "sitemap", "robotsTXT", "page", "setion"]
disableKinds = ["taxonomy", "term", "RSS", "sitemap", "robotsTXT", "page", "section"]
theme = "mytheme"
-- data/a.toml --
v1 = "a_v1"
Expand Down
2 changes: 1 addition & 1 deletion hugolib/embedded_shortcodes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func TestEmbeddedShortcodes(t *testing.T) {
files := `
-- hugo.toml --
baseURL = "https://example.com"
disableKinds = ["taxonomy", "term", "RSS", "sitemap", "robotsTXT", "page", "setion"]
disableKinds = ["taxonomy", "term", "RSS", "sitemap", "robotsTXT", "page", "section"]
ignoreErrors = ["error-missing-instagram-accesstoken"]
[params]
foo = "bar"
Expand Down
2 changes: 1 addition & 1 deletion hugolib/hugo_sites_build.go
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ func (h *HugoSites) postProcess(l logg.LevelLogger) error {
// This will only be set when js.Build have been triggered with
// imports that resolves to the project or a module.
// Write a jsconfig.json file to the project's /asset directory
// to help JS intellisense in VS Code etc.
// to help JS IntelliSense in VS Code etc.
if !h.ResourceSpec.BuildConfig().NoJSConfigInAssets && h.BaseFs.Assets.Dirs != nil {
fi, err := h.BaseFs.Assets.Fs.Stat("")
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions hugolib/pagecollections_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ func TestGetPage(t *testing.T) {
{"Root relative, no slash, root page", page.KindPage, nil, []string{"about.md", "ABOUT.md"}, "about page"},
{"Root relative, no slash, section", page.KindSection, nil, []string{"sect3"}, "section 3"},
{"Root relative, no slash, section page", page.KindPage, nil, []string{"sect3/page1.md"}, "Title3_1"},
{"Root relative, no slash, sub setion", page.KindSection, nil, []string{"sect3/sect7"}, "another sect7"},
{"Root relative, no slash, sub section", page.KindSection, nil, []string{"sect3/sect7"}, "another sect7"},
{"Root relative, no slash, nested page", page.KindPage, nil, []string{"sect3/subsect/deep.md"}, "deep page"},
{"Root relative, no slash, OS slashes", page.KindPage, nil, []string{filepath.FromSlash("sect5/page3.md")}, "Title5_3"},

Expand All @@ -247,7 +247,7 @@ func TestGetPage(t *testing.T) {
// content root relative paths without a leading slash, the lookup
// returns /sect7. This undermines ambiguity detection, but we have no choice.
//{"Ambiguous", nil, []string{"sect7"}, ""},
{"Section, ambigous", page.KindSection, nil, []string{"sect7"}, "Sect7s"},
{"Section, ambiguous", page.KindSection, nil, []string{"sect7"}, "Sect7s"},

{"Absolute, home", page.KindHome, nil, []string{"/", ""}, "home page"},
{"Absolute, page", page.KindPage, nil, []string{"/about.md", "/about"}, "about page"},
Expand Down
2 changes: 1 addition & 1 deletion hugolib/site.go
Original file line number Diff line number Diff line change
Expand Up @@ -885,7 +885,7 @@ func (s *Site) getLanguageTargetPathLang(alwaysInSubDir bool) string {
return s.getLanguagePermalinkLang(alwaysInSubDir)
}

// get any lanaguagecode to prefix the relative permalink with.
// get any language code to prefix the relative permalink with.
func (s *Site) getLanguagePermalinkLang(alwaysInSubDir bool) string {
if !s.h.isMultiLingual() || s.h.Conf.IsMultihost() {
return ""
Expand Down
2 changes: 1 addition & 1 deletion langs/language.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func NewLanguage(lang, defaultContentLanguage, timeZone string, languageConfig L
return l, l.loadLocation(timeZone)
}

// This is injected from hugolib to avoid cirular dependencies.
// This is injected from hugolib to avoid circular dependencies.
var DeprecationFunc = func(item, alternative string, err bool) {}

const paramsDeprecationWarning = `.Language.Params is deprecated and will be removed in a future release. Use site.Params instead.
Expand Down
2 changes: 1 addition & 1 deletion livereload/livereload.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ func refreshPathForPort(s string, port int) {
wsHub.broadcast <- []byte(msg)
}

// ServeJS serves the liverreload.js who's reference is injected into the page.
// ServeJS serves the livereload.js who's reference is injected into the page.
func ServeJS(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", media.Builtin.JavascriptType.Type)
w.Write(liveReloadJS())
Expand Down
2 changes: 1 addition & 1 deletion resources/jsconfig/jsconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
)

// Builder builds a jsconfig.json file that, currently, is used only to assist
// intellinsense in editors.
// IntelliSense in editors.
type Builder struct {
sourceRootsMu sync.RWMutex
sourceRoots map[string]bool
Expand Down
2 changes: 1 addition & 1 deletion resources/resource_transformers/js/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ func createBuildPlugins(c *Client, opts Options) ([]api.Plugin, error) {

if m != nil {
// Store the source root so we can create a jsconfig.json
// to help intellisense when the build is done.
// to help IntelliSense when the build is done.
// This should be a small number of elements, and when
// in server mode, we may get stale entries on renames etc.,
// but that shouldn't matter too much.
Expand Down

0 comments on commit 9009c8c

Please sign in to comment.