Boost logo

Boost-Commit :

From: bdawes_at_[hidden]
Date: 2008-06-27 10:46:09


Author: bemandawes
Date: 2008-06-27 10:46:07 EDT (Fri, 27 Jun 2008)
New Revision: 46773
URL: http://svn.boost.org/trac/boost/changeset/46773

Log:
Limit offender count, add style, use blockquote instead of bullet lists, resolve *A* conflict
Text files modified:
   trunk/tools/inspect/ascii_check.hpp | 4
   trunk/tools/inspect/copyright_check.hpp | 2
   trunk/tools/inspect/crlf_check.hpp | 4
   trunk/tools/inspect/inspect.cpp | 113 +++++++++++++++++++--------------------
   trunk/tools/inspect/inspector.hpp | 2
   trunk/tools/inspect/license_check.hpp | 4
   trunk/tools/inspect/link_check.hpp | 10 +-
   trunk/tools/inspect/long_name_check.cpp | 2
   trunk/tools/inspect/minmax_check.hpp | 2
   trunk/tools/inspect/tab_check.hpp | 4
   trunk/tools/inspect/unnamed_namespace_check.hpp | 2
   11 files changed, 75 insertions(+), 74 deletions(-)

Modified: trunk/tools/inspect/ascii_check.hpp
==============================================================================
--- trunk/tools/inspect/ascii_check.hpp (original)
+++ trunk/tools/inspect/ascii_check.hpp 2008-06-27 10:46:07 EDT (Fri, 27 Jun 2008)
@@ -21,7 +21,7 @@
     public:
 
       ascii_check();
- virtual const char * name() const { return "*A*"; }
+ virtual const char * name() const { return "*ASCII*"; }
       virtual const char * desc() const { return "non-ASCII chars in file"; }
 
       virtual void inspect(
@@ -30,7 +30,7 @@
         const std::string & contents );
 
       virtual ~ascii_check()
- { std::cout << " " << m_files_with_errors << " files with non-ASCII chars\n"; }
+ { std::cout << " " << m_files_with_errors << " files with non-ASCII chars" << line_break(); }
     };
   }
 }

Modified: trunk/tools/inspect/copyright_check.hpp
==============================================================================
--- trunk/tools/inspect/copyright_check.hpp (original)
+++ trunk/tools/inspect/copyright_check.hpp 2008-06-27 10:46:07 EDT (Fri, 27 Jun 2008)
@@ -31,7 +31,7 @@
         const std::string & contents );
 
       virtual ~copyright_check()
- { std::cout << " " << m_files_with_errors << " files " << desc() << '\n'; }
+ { std::cout << " " << m_files_with_errors << " files " << desc() << line_break(); }
     };
   }
 }

Modified: trunk/tools/inspect/crlf_check.hpp
==============================================================================
--- trunk/tools/inspect/crlf_check.hpp (original)
+++ trunk/tools/inspect/crlf_check.hpp 2008-06-27 10:46:07 EDT (Fri, 27 Jun 2008)
@@ -23,7 +23,7 @@
     public:
 
       crlf_check();
- virtual const char * name() const { return "*R*"; }
+ virtual const char * name() const { return "*EOL*"; }
       virtual const char * desc() const { return "invalid (cr only) line-ending"; }
 
       virtual void inspect(
@@ -32,7 +32,7 @@
         const std::string & contents );
 
       virtual ~crlf_check()
- { std::cout << " " << m_files_with_errors << " files with invalid line endings\n"; }
+ { std::cout << " " << m_files_with_errors << " files with invalid line endings" << line_break(); }
     };
   }
 }

Modified: trunk/tools/inspect/inspect.cpp
==============================================================================
--- trunk/tools/inspect/inspect.cpp (original)
+++ trunk/tools/inspect/inspect.cpp 2008-06-27 10:46:07 EDT (Fri, 27 Jun 2008)
@@ -46,6 +46,8 @@
 
 namespace fs = boost::filesystem;
 
+using namespace boost::inspect;
+
 namespace
 {
   class inspector_element
@@ -63,6 +65,7 @@
   long file_count = 0;
   long directory_count = 0;
   long error_count = 0;
+ const int max_offenders = 5; // maximum "worst offenders" to display
 
   boost::inspect::string_set content_signatures;
 
@@ -277,11 +280,11 @@
     else
     {
       std::cout
- << " <tr><td><a href=\"#"
+ << " <a href=\"#"
         << current_library // what about malformed for URI refs? [gps]
         << "\">" << current_library
- << "</a></td><td align=\"center\">"
- << err_count << "</td></tr>\n";
+ << "</a> ("
+ << err_count << ")<br>\n";
     }
   }
 
@@ -295,14 +298,9 @@
     }
     else
     {
- std::cout
- << "</pre>\n"
+ std::cout <<
         "<h2>Summary</h2>\n"
- "<table border=\"1\" cellpadding=\"5\" cellspacing=\"0\">\n"
- " <tr>\n"
- " <td><b>Library</b></td>\n"
- " <td><b>Problems</b></td>\n"
- " </tr>\n"
+ "<blockquote>\n"
         ;
     }
 
@@ -322,13 +320,9 @@
     display_summary_helper( current_library, err_count );
 
     if (display_text == display_format)
- {
       std::cout << "\n";
- }
     else
- {
- std::cout << "</table>\n";
- }
+ std::cout << "</blockquote>\n";
   }
 
 
@@ -428,18 +422,18 @@
   }
 
 
-// hall_of_shame_count_helper --------------------------------------------------//
+// worst_offenders_count_helper --------------------------------------------------//
 
- void hall_of_shame_count_helper( const string & current_library, int err_count )
+ void worst_offenders_count_helper( const string & current_library, int err_count )
   {
         lib_error_count lec;
         lec.library = current_library;
         lec.error_count = err_count;
         libs.push_back( lec );
   }
-// hall_of_shame_count -----------------------------------------------------//
+// worst_offenders_count -----------------------------------------------------//
 
- void hall_of_shame_count()
+ void worst_offenders_count()
   {
     string current_library( msgs.begin()->library );
     int err_count = 0;
@@ -448,38 +442,38 @@
     {
       if ( current_library != itr->library )
       {
- hall_of_shame_count_helper( current_library, err_count );
+ worst_offenders_count_helper( current_library, err_count );
         current_library = itr->library;
         err_count = 0;
       }
       ++err_count;
     }
- hall_of_shame_count_helper( current_library, err_count );
+ worst_offenders_count_helper( current_library, err_count );
   }
 
-// display_hall_of_shame ---------------------------------------------------//
+// display_worst_offenders -------------------------------------------------//
 
- void display_hall_of_shame()
+ void display_worst_offenders()
   {
     if (display_text == display_format)
     {
- std::cout << "Hall of Shame:\n";
+ std::cout << "Worst Offenders:\n";
     }
     else
     {
- std::cout
- << "</pre>\n"
- "<h2>Hall of Shame</h2>\n"
- "<table border=\"1\" cellpadding=\"5\" cellspacing=\"0\">\n"
- " <tr>\n"
- " <td><b>Library</b></td>\n"
- " <td><b>Problems</b></td>\n"
- " </tr>\n"
+ std::cout <<
+ "<h2>Worst Offenders</h2>\n"
+ "<blockquote>\n"
         ;
     }
 
+ int display_count = 0;
+ int last_error_count = 0;
     for ( lib_error_count_vector::iterator itr ( libs.begin() );
- itr != libs.end(); ++itr )
+ itr != libs.end()
+ && (display_count < max_offenders
+ || itr->error_count == last_error_count);
+ ++itr, ++display_count )
     {
       if (display_text == display_format)
       {
@@ -488,22 +482,19 @@
       else
       {
         std::cout
- << " <tr><td><a href=\"#"
+ << " <a href=\"#"
           << itr->library
           << "\">" << itr->library
- << "</a></td><td align=\"center\">"
- << itr->error_count << "</td></tr>\n";
+ << "</a> ("
+ << itr->error_count << ")<br>\n";
       }
+ last_error_count = itr->error_count;
     }
 
     if (display_text == display_format)
- {
       std::cout << "\n";
- }
     else
- {
- std::cout << "</table>\n";
- }
+ std::cout << "</blockquote>\n";
   }
 
 
@@ -548,6 +539,14 @@
   namespace inspect
   {
 
+// line_break --------------------------------------------------------------//
+
+ const char * line_break()
+ {
+ return display_format ? "\n" : "<br>\n";
+ }
+
+
 // register_signature ------------------------------------------------------//
 
     void inspector::register_signature( const string & signature )
@@ -752,9 +751,9 @@
   fs::initial_path();
   
 
- {
+ { // begin reporting block
 
- // note how this is in its own block; reporting will happen
+ // since this is in its own block; reporting will happen
   // automatically, from each registered inspector, when
   // leaving, due to destruction of the inspector_list object
   inspector_list inspectors;
@@ -825,6 +824,7 @@
     std::cout
       << "<html>\n"
       "<head>\n"
+ "<style> body { font-family: sans-serif; } </style>\n"
       "<title>Boost Inspection Report</title>\n"
       "</head>\n"
 
@@ -852,43 +852,42 @@
 
 
     std::cout
- << "<h2>Totals</h2>\n<pre>"
- << file_count << " files scanned\n"
- << directory_count << " directories scanned (including root)\n"
- << error_count << " problems reported\n";
+ << "<h2>Totals</h2>\n"
+ << file_count << " files scanned<br>\n"
+ << directory_count << " directories scanned (including root)<br>\n"
+ << error_count << " problems reported\n<p>";
   }
 
   for ( inspector_list::iterator itr = inspectors.begin();
         itr != inspectors.end(); ++itr )
   {
- const string line_break (
- display_text == display_format? "\n" : "<br>\n"); // gps
 
     inspector_keys += static_cast<string>(" ")
         + itr->inspector->name()
         + ' ' + itr->inspector->desc()
- + line_break
+ + line_break()
         ;
   }
 
-
- std::cout
- << "\nProblem counts:\n";
+ if (display_text == display_format)
+ std::cout << "\nProblem counts:\n";
+ else
+ std::cout << "\n<h2>Problem counts</h2>\n<blockquote><p>\n" ;
 
   } // end of block: starts reporting
 
   if (display_text == display_format)
- {
     std::cout << "\n" ;
- }
+ else
+ std::cout << "</blockquote>\n";
 
   std::sort( msgs.begin(), msgs.end() );
 
- hall_of_shame_count();
+ worst_offenders_count();
   std::stable_sort( libs.begin(), libs.end() );
 
   if ( !libs.empty() )
- display_hall_of_shame();
+ display_worst_offenders();
 
   if ( !msgs.empty() )
   {

Modified: trunk/tools/inspect/inspector.hpp
==============================================================================
--- trunk/tools/inspect/inspector.hpp (original)
+++ trunk/tools/inspect/inspector.hpp 2008-06-27 10:46:07 EDT (Fri, 27 Jun 2008)
@@ -26,6 +26,8 @@
   {
     typedef std::set< string > string_set;
 
+ const char * line_break();
+
     class inspector
     {
     protected:

Modified: trunk/tools/inspect/license_check.hpp
==============================================================================
--- trunk/tools/inspect/license_check.hpp (original)
+++ trunk/tools/inspect/license_check.hpp 2008-06-27 10:46:07 EDT (Fri, 27 Jun 2008)
@@ -22,7 +22,7 @@
     public:
 
       license_check();
- virtual const char * name() const { return "*L*"; }
+ virtual const char * name() const { return "*Lic*"; }
       virtual const char * desc() const { return "missing Boost license info, or wrong reference text"; }
 
       virtual void inspect(
@@ -32,7 +32,7 @@
 
       virtual ~license_check()
         { std::cout << " "
- << m_files_with_errors << " files missing Boost license info or having wrong reference text\n"; }
+ << m_files_with_errors << " files missing Boost license info or having wrong reference text" << line_break(); }
     };
   }
 }

Modified: trunk/tools/inspect/link_check.hpp
==============================================================================
--- trunk/tools/inspect/link_check.hpp (original)
+++ trunk/tools/inspect/link_check.hpp 2008-06-27 10:46:07 EDT (Fri, 27 Jun 2008)
@@ -36,7 +36,7 @@
     public:
 
       link_check();
- virtual const char * name() const { return "*A*"; }
+ virtual const char * name() const { return "*HTML*"; }
       virtual const char * desc() const { return "invalid bookmarks, invalid urls, broken links, unlinked files"; }
 
       virtual void inspect(
@@ -52,10 +52,10 @@
 
       virtual ~link_check()
         {
- std::cout << " " << m_bookmark_errors << " bookmarks with invalid characters\n";
- std::cout << " " << m_invalid_errors << " invalid urls\n";
- std::cout << " " << m_broken_errors << " broken links\n";
- std::cout << " " << m_unlinked_errors << " unlinked files\n";
+ std::cout << " " << m_bookmark_errors << " bookmarks with invalid characters" << line_break();
+ std::cout << " " << m_invalid_errors << " invalid urls" << line_break();
+ std::cout << " " << m_broken_errors << " broken links" << line_break();
+ std::cout << " " << m_unlinked_errors << " unlinked files" << line_break();
         }
     };
   }

Modified: trunk/tools/inspect/long_name_check.cpp
==============================================================================
--- trunk/tools/inspect/long_name_check.cpp (original)
+++ trunk/tools/inspect/long_name_check.cpp 2008-06-27 10:46:07 EDT (Fri, 27 Jun 2008)
@@ -102,7 +102,7 @@
 
     file_name_check::~file_name_check()
     {
- std::cout << " " << m_name_errors << " " << desc() << '\n';
+ std::cout << " " << m_name_errors << " " << desc() << line_break();
     }
 
 

Modified: trunk/tools/inspect/minmax_check.hpp
==============================================================================
--- trunk/tools/inspect/minmax_check.hpp (original)
+++ trunk/tools/inspect/minmax_check.hpp 2008-06-27 10:46:07 EDT (Fri, 27 Jun 2008)
@@ -36,7 +36,7 @@
 
       virtual ~minmax_check()
       {
- std::cout << " " << m_errors << " violations of the Boost min/max guidelines\n";
+ std::cout << " " << m_errors << " violations of the Boost min/max guidelines" << line_break();
       }
     };
   }

Modified: trunk/tools/inspect/tab_check.hpp
==============================================================================
--- trunk/tools/inspect/tab_check.hpp (original)
+++ trunk/tools/inspect/tab_check.hpp 2008-06-27 10:46:07 EDT (Fri, 27 Jun 2008)
@@ -20,7 +20,7 @@
     public:
 
       tab_check();
- virtual const char * name() const { return "*T*"; }
+ virtual const char * name() const { return "*Tab*"; }
       virtual const char * desc() const { return "tabs in file"; }
 
       virtual void inspect(
@@ -29,7 +29,7 @@
         const std::string & contents );
 
       virtual ~tab_check()
- { std::cout << " " << m_files_with_errors << " files with tabs\n"; }
+ { std::cout << " " << m_files_with_errors << " files with tabs" << line_break(); }
     };
   }
 }

Modified: trunk/tools/inspect/unnamed_namespace_check.hpp
==============================================================================
--- trunk/tools/inspect/unnamed_namespace_check.hpp (original)
+++ trunk/tools/inspect/unnamed_namespace_check.hpp 2008-06-27 10:46:07 EDT (Fri, 27 Jun 2008)
@@ -30,7 +30,7 @@
         const std::string & contents );
 
       virtual ~unnamed_namespace_check()
- { std::cout << " " << m_errors << " usages of unnamed namespaces in headers (including .ipp files)\n"; }
+ { std::cout << " " << m_errors << " usages of unnamed namespaces in headers (including .ipp files)" << line_break(); }
     };
   }
 }


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk