fontbakery icon indicating copy to clipboard operation
fontbakery copied to clipboard

profile.configuration_defaults should be inherited if not set explicitely

Open felipesanches opened this issue 2 years ago • 2 comments

(note: This was happening while invoking the check via the fontwerk profile, before #3581 was fixed.)

>> com.google.fonts/check/file_size
    Ensure files are not too large.
    with ../fonts/ofl/abeezee/ABeeZee-Regular.ttf

      Rationale:                                                                
      Serving extremely large font files on Google Fonts causes usability       
      issues. This check ensures that file sizes are reasonable.                

     INFO 46160 size None FAIL_SIZE None WARN_SIZE                              

    ERROR Failed with TypeError: '>' not supported between                      
          instances of 'int' and 'NoneType'                                     
          ↳ File "/home/commander/Projects/googlefonts/fontbakery/Lib/fontbakery
          /checkrunner.py", line 193, in _exec_check                            
          for sub_result in result:  # Might raise.                             
          ↳ File "/home/commander/Projects/googlefonts/fontbakery/Lib/fontbakery
          /profiles/googlefonts.py", line 1511, in                              
          com_google_fonts_check_file_size                                      
          if size > FAIL_SIZE:                                                  


    Result: ERROR

Which is because the googlefonts profile defines somewhere:

profile.configuration_defaults = {
    "com.google.fonts/check/file_size": {
        "WARN_SIZE": 1 * 1024 * 1024,
        "FAIL_SIZE": 9 * 1024 * 1024
    }
}

But the fontwerk profile does not.

@felipesanches I'm not happy with this, we should somewhow in profile.auto_register or profile._load_profile_imports take care of inheriting these defaults, if they are not set in the current profile.

Originally posted by @graphicore in https://github.com/googlefonts/fontbakery/issues/3579#issuecomment-1027983435

felipesanches avatar Feb 02 '22 14:02 felipesanches