Repository: ioos/compliance-checker

Issue:
Misplaced High/Highly Recommended attribute checks for ACDD check in plaintext output
When invoking compliance checker against one of the test data files with the ACDD check, some of the highly recommended attributes are misplaced.  

`python cchecker.py -t acdd compliance_checker/tests/data/2dim-grid.nc > cc_output.txt`
[cc_output.txt](https://github.com/ioos/compliance-checker/files/224776/cc_output.txt)

Notice that only `keywords` are contained under the "High Priority" header, despite the fact that `title` and `summary` are high priority, as well as under the wrong header.  The variables are in the [correct list of variables to check in the current master as of this writing.](https://github.com/ioos/compliance-checker/blob/a95fc7f0f9eff8f9b6980788f540beb8f622857b/compliance_checker/acdd.py#L24)  I also checked the commits of some current production compliance-checker code and this issue appears to have existed back to 532426dc8117d91c0e87badb9b134535463a41c9, and probably beyond.

```
                                 High Priority                                 
--------------------------------------------------------------------------------                                                                             
    Name                            :Priority: Score                                                                                                         
keywords                                :3:     0/1                                                                                                          


                                Medium Priority                                                                                                              
--------------------------------------------------------------------------------                                                                             
    Name                            :Priority: Score                                                                                                         
keywords_vocabulary                     :2:     0/1                                                                                                          
lat_extents                             :2:     0/0                                                                                                          
license                                 :2:     0/1                                                                                                          
lon_extents                             :2:     0/0                                                                                                          
naming_authority                        :2:     0/1                                                                                                          
processing_level                        :2:     0/1                                                                                                          
project                                 :2:     0/1                                                                                                          
standard_name_vocabulary                :2:     0/1                                                                                                          
summary                                 :3:     0/1                                                                                                          
time_coverage_duration                  :2:     0/1                                                                                                          
time_coverage_end                       :2:     0/1                                                                                                          
time_coverage_resolution                :2:     0/1                                                                                                          
time_coverage_start                     :2:     0/1                                                                                                          
time_extents                            :2:     0/0                                                                                                          
title                                   :3:     0/1                                                                                                          
varattr                                 :3:    13/21                                                                                                         
vertical_extents                        :2:     0/0                                                                                                          
```

Side note, we ought to add some integration testing for the output of the checker.                                                                                 



Discussion:
Some findings:
- Does not occur with CF standard specified.
- Does not occur with HTML output.

Bisect told me it's in 5480d6ed829f156bc750221517151936c3a34fed

:+1: Nice work!


Resolving patch:
diff --git a/compliance_checker/suite.py b/compliance_checker/suite.py
--- a/compliance_checker/suite.py
+++ b/compliance_checker/suite.py
@@ -280,6 +280,8 @@ def get_points(self, groups, limit):
 
         points = sum(points)
         out_of = sum(out_of)
+        # sorts lists into high/medium/low order
+        score_list.sort(key=lambda x: x[1], reverse=True)
 
         return score_list, points, out_of
 


Test patch: