]> git.maquefel.me Git - brevno-suite/hugo/commitdiff
common/hugo: Adjust deprecation timing and message
authorJoe Mooring <joe.mooring@veriphor.com>
Sun, 2 Feb 2025 16:55:47 +0000 (08:55 -0800)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Mon, 3 Feb 2025 17:32:30 +0000 (18:32 +0100)
Closes #13333

common/hugo/hugo.go
common/hugo/hugo_test.go
tpl/debug/debug.go

index eecf4bc2f67d4eeb11e6c43eca5d89c44dc38ba0..8b32432db0f2a3723860e1e44fa5dbd5b662f9bb 100644 (file)
@@ -418,7 +418,7 @@ func Deprecate(item, alternative string, version string) {
 func DeprecateLevel(item, alternative, version string, level logg.Level) {
        var msg string
        if level == logg.LevelError {
-               msg = fmt.Sprintf("%s was deprecated in Hugo %s and will be removed in Hugo %s. %s", item, version, CurrentVersion.Next().ReleaseVersion(), alternative)
+               msg = fmt.Sprintf("%s was deprecated in Hugo %s and subsequently removed. %s", item, version, alternative)
        } else {
                msg = fmt.Sprintf("%s was deprecated in Hugo %s and will be removed in a future release. %s", item, version, alternative)
        }
@@ -434,11 +434,11 @@ func deprecationLogLevelFromVersion(ver string) logg.Level {
        to := CurrentVersion
        minorDiff := to.Minor - from.Minor
        switch {
-       case minorDiff >= 12:
-               // Start failing the build after about a year.
+       case minorDiff >= 15:
+               // Start failing the build after about 15 months.
                return logg.LevelError
-       case minorDiff >= 6:
-               // Start printing warnings after about six months.
+       case minorDiff >= 3:
+               // Start printing warnings after about 3 months.
                return logg.LevelWarn
        default:
                return logg.LevelInfo
index feb52075df17ec6f4cacd2635f68ef287316e4fa..f938073dadebcdcbe1a0c0a813e6a4d16ae57e8d 100644 (file)
@@ -57,11 +57,11 @@ func TestDeprecationLogLevelFromVersion(t *testing.T) {
        c.Assert(deprecationLogLevelFromVersion("0.55.0"), qt.Equals, logg.LevelError)
        ver := CurrentVersion
        c.Assert(deprecationLogLevelFromVersion(ver.String()), qt.Equals, logg.LevelInfo)
-       ver.Minor -= 1
-       c.Assert(deprecationLogLevelFromVersion(ver.String()), qt.Equals, logg.LevelInfo)
-       ver.Minor -= 6
+       ver.Minor -= 3
+       c.Assert(deprecationLogLevelFromVersion(ver.String()), qt.Equals, logg.LevelWarn)
+       ver.Minor -= 4
        c.Assert(deprecationLogLevelFromVersion(ver.String()), qt.Equals, logg.LevelWarn)
-       ver.Minor -= 6
+       ver.Minor -= 13
        c.Assert(deprecationLogLevelFromVersion(ver.String()), qt.Equals, logg.LevelError)
 
        // Added just to find the threshold for where we can remove deprecated items.
index fd676f0e21e88a7af0800c4934c74fefce4c3d67..3909cbfa2f782f8071b9cce71e5569343a120363 100644 (file)
@@ -171,7 +171,7 @@ func (ns *Namespace) TestDeprecationInfo(item, alternative string) string {
 // Internal template func, used in tests only.
 func (ns *Namespace) TestDeprecationWarn(item, alternative string) string {
        v := hugo.CurrentVersion
-       v.Minor -= 6
+       v.Minor -= 3
        hugo.Deprecate(item, alternative, v.String())
        return ""
 }
@@ -179,7 +179,7 @@ func (ns *Namespace) TestDeprecationWarn(item, alternative string) string {
 // Internal template func, used in tests only.
 func (ns *Namespace) TestDeprecationErr(item, alternative string) string {
        v := hugo.CurrentVersion
-       v.Minor -= 12
+       v.Minor -= 15
        hugo.Deprecate(item, alternative, v.String())
        return ""
 }