lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master 13ffcfc 2/2: Make future copyright updates ea


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 13ffcfc 2/2: Make future copyright updates easier [bis]
Date: Mon, 4 Jan 2021 12:06:59 -0500 (EST)

branch: master
commit 13ffcfc7f17d91133c1b7bd023ad0f543a8760b8
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>

    Make future copyright updates easier [bis]
    
    See:
      https://lists.nongnu.org/archive/html/lmi/2021-01/msg00000.html
---
 test_coding_rules.cpp     |  8 ++++++--
 wx_test_about_version.cpp | 15 ++++++++++-----
 2 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/test_coding_rules.cpp b/test_coding_rules.cpp
index 9f07ecf..d026323 100644
--- a/test_coding_rules.cpp
+++ b/test_coding_rules.cpp
@@ -507,16 +507,20 @@ void check_copyright(file const& f)
     LMI_ASSERT(nullptr != t1);
     int const year = 1900 + t1->tm_year;
 
+    // Uttering this word without obfuscation would confuse the
+    // 'make happy_new_year' copyright-update recipe.
+    static std::string const unutterable {"C""opyright"};
+
     { // Scope to avoid unwanted '-Wshadow' diagnostic.
     std::ostringstream oss;
-    oss << 'C' << R"(opyright \(C\)[^\n]*)" << year;
+    oss << unutterable << R"( \(C\)[^\n]*)" << year;
     require(f, oss.str(), "lacks current copyright.");
     }
 
     if(f.is_of_phylum(e_html) && !f.phyloanalyze("^COPYING"))
         {
         std::ostringstream oss;
-        oss << 'C' << R"(opyright &copy;[^\n]*)" << year;
+        oss << unutterable << R"( &copy;[^\n]*)" << year;
         require(f, oss.str(), "lacks current secondary copyright.");
         }
 }
diff --git a/wx_test_about_version.cpp b/wx_test_about_version.cpp
index 9fe7354..2b317c4 100644
--- a/wx_test_about_version.cpp
+++ b/wx_test_about_version.cpp
@@ -81,11 +81,15 @@ int year_from_string(wxString const& s)
 // May throw if the input doesn't conform to the expectations.
 int extract_last_copyright_year(wxString const& html)
 {
-    // Find the line starting with "C""opyright".
+    // Uttering this word without obfuscation would confuse the
+    // 'make happy_new_year' copyright-update recipe.
+    static std::string const unutterable {"C""opyright"};
+
+    // Find the line starting with that unutterable word.
     wxString copyright_line;
     for(auto const& line : wxSplit(html ,'\n' ,'\0'))
         {
-        if(line.StartsWith("C""opyright"))
+        if(line.StartsWith(unutterable.c_str()))
             {
             LMI_ASSERT_WITH_MSG
                 (copyright_line.empty()
@@ -99,7 +103,7 @@ int extract_last_copyright_year(wxString const& html)
 
     LMI_ASSERT_WITH_MSG
         (!copyright_line.empty()
-        ,"C""opyright line not found in the license notices text"
+        ,unutterable + " line not found in the license notices text"
         );
 
     // We suppose that we have a sequence of comma-separated (4 digit, let
@@ -120,9 +124,10 @@ int extract_last_copyright_year(wxString const& html)
             ,m
             ,std::regex("(?:\\d{4}, )+(\\d{4})")
             )
-        , "C""opyright line \""
+        , unutterable
+        + " line '"
         + copyright_line
-        + "\" doesn't contain copyright years"
+        + "' doesn't contain copyright years"
         );
 
     return year_from_string(wxString(m[1]));



reply via email to

[Prev in Thread] Current Thread [Next in Thread]