-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Correct initialisms as suggested by golint #969
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
First step to use initialisms that golint suggests, for example: Line 116: func GetHtmlRenderer should be GetHTMLRenderer as see on http://goreportcard.com/report/spf13/hugo Thanks to @bep for the idea! Note that command-line flags (cobra and pflag) as well as struct fields like .BaseUrl and .Url that are used in Go HTML templates need more work to maintain backward-compatibility, and thus are NOT yet dealt with in this commit. First step in fixing gohugoio#959.
For the sake of full disclosure 😉, this is the script that I used with #!/bin/bash
for rule in \
'baseUrl -> baseURL' \
'oldBaseUrl -> oldBaseURL' \
'fixUrl -> fixURL' \
'pUrl -> pURL' \
'refUrl -> refURL' \
'remoteUrlLock -> remoteURLLock' \
'UrlLock -> URLLock' \
'UrlUnlock -> URLUnlock' \
'absUrlInit -> absURLInit' \
'absurlMatcher -> absURLMatcher' \
'absurlReplacer -> absURLReplacer' \
'BenchmarkAbsUrl -> BenchmarkAbsURL' \
'BenchmarkXmlAbsUrl -> BenchmarkXMLAbsURL' \
'dqHtmlMatch -> dqHTMLMatch' \
'sqHtmlMatch -> sqHTMLMatch' \
'dqXmlMatch -> dqXMLMatch' \
'sqXmlMatch -> sqXMLMatch' \
'dqHtml -> dqHTML' \
'sqHtml -> sqHTML' \
'dqXml -> dqXML' \
'sqXml -> sqXML' \
'TestAbsUrl -> TestAbsURL' \
'TestFixUrl -> TestFixURL' \
'TestXMLAbsUrl -> TestXMLAbsURL' \
'CliBaseUrl -> CLIBaseURL' \
'CfgBaseUrl -> CfgBaseURL' \
'DocumentId -> DocumentID' \
'PlainIdAnchors -> PlainIDAnchors' \
'UniqueId -> UniqueID' \
'uniqueId -> uniqueID' \
'replaceInHtml -> replaceInHTML' \
'replaceInXml -> replaceInXML' \
'SafeCss -> SafeCSS' \
'SafeHtml -> SafeHTML' \
'SafeHtmlAttr -> SafeHTMLAttr' \
'SafeUrl -> SafeURL' \
'paginationUrlFactory -> paginationURLFactory' \
'newPaginationUrlFactory -> newPaginationURLFactory' \
'CanonifyUrls -> CanonifyURLs' \
'canonifyUrls -> canonifyURLs' \
'PrettifyUrl -> PrettifyURL' \
'PrettifyUrlPath -> PrettifyURLPath' \
'SanitizeUrl -> SanitizeURL' \
'SanitizeUrlKeepTrailingSlash -> SanitizeURLKeepTrailingSlash' \
'sanitizeUrlWithFlags -> sanitizeURLWithFlags' \
'Urlize -> URLize' \
'UrlizeAndPrep -> URLizeAndPrep' \
'UrlPrep -> URLPrep' \
'UglyUrls -> UglyURLs' \
'uglyUrls -> uglyURLs' \
'TestSafeCss -> TestSafeCSS' \
'TestSafeHtml -> TestSafeHTML' \
'TestSafeHtmlAttr -> TestSafeHTMLAttr' \
'TestSafeUrl -> TestSafeURL' \
'GoHtmlTemplate -> GoHTMLTemplate' \
'GetHtmlRenderer -> GetHTMLRenderer' \
'tstHtmlContent -> tstHTMLContent' \
'menuEntryUrl -> menuEntryURL' \
'menuEntryXml -> menuEntryXML' \
'menuId -> menuID' \
'findTestMenuEntryById -> findTestMenuEntryByID' \
'removeTomlIdentifier -> removeTOMLIdentifier' \
'HandleJsonMetaData -> HandleJSONMetaData' \
'HandleTomlMetaData -> HandleTOMLMetaData' \
'HandleYamlMetaData -> HandleYAMLMetaData' \
'TestDataDirJson -> TestDataDirJSON' \
'TestDataDirYamlWithOverridenValue -> TestDataDirYAMLWithOverridenValue' \
'tstCreateMenuPageWithNameToml -> tstCreateMenuPageWithNameTOML' \
'tstCreateMenuPageWithIdentifierToml -> tstCreateMenuPageWithIdentifierTOML' \
'tstCreateMenuPageWithNameYaml -> tstCreateMenuPageWithNameYAML' \
'tstCreateMenuPageWithIdentifierYaml -> tstCreateMenuPageWithIdentifierYAML' \
'GetJson -> GetJSON' \
'GetCsv -> GetCSV' \
'parseCsv -> parseCSV' \
'TestParseCsv -> TestParseCSV' \
'TestMenuWithHashInUrl -> TestMenuWithHashInURL' \
'TestMenuWithUnicodeUrls -> TestMenuWithUnicodeURLs' \
'doTestMenuWithUnicodeUrls -> doTestMenuWithUnicodeURLs' \
; do
echo "$rule"
gofmt -r "$rule" -w */*.go *.go
done
# Can't change blackfriday.HtmlRendererParameters yet, I think...
gofmt -r 'BaseUrl -> BaseURL' -w commands/*.go
exit
# Problematic ones: BaseUrl and Url (e.g. .Site.BaseUrl and .Page.Url)
for rule in \
'BaseUrl -> BaseURL' \
'Url -> URL' \
; do
gofmt -r "$rule" -w */*.go *.go
done |
Merged in 67df33f Good job, cool script. |
tryp
added a commit
to tryp/material-design
that referenced
this pull request
Jun 11, 2015
Hugo adopted golint initialism formatting with: gohugoio/hugo#969 Hugo 0.14 throws an error saying compatibility with the old capitalizations will be removed in 0.15 This change was produced with a quick and dirty `grep -Irl BaseUrl | xargs ser -i -e "s/BaseUrl/BaseURL"`
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
First step to use initialisms that golint suggests, for example:
as see on http://goreportcard.com/report/spf13/hugo
Thanks to @bep for the idea!
Note that command-line flags (cobra and pflag) as well as struct fields like
.BaseUrl
and.Url
that are used in Go HTML templates need more work to maintain backward-compatibility, and thus are NOT yet dealt with in this commit.First step in fixing #959.