Fontbakery: Major refactoring: moving each check into its own function

Created on 12 Nov 2016  路  6Comments  路  Source: googlefonts/fontbakery

The benefits of this are:

  • better organization
  • reducing indentation level helps to make it easier to read & understand
  • also reduces namespace polution
  • functions get as parameters just the bits of really needed info, thus making the code clearer
  • also helps to facilitate fitting it all within 80 columns
  • individual functions per-check seem to be one pre-requisite (of many) for issue #681 It is also the main task at issue #891
  • a very good side effect of this refactoring is the ability to grasp the full list of checks that are performed by simply looking at the sequence of function invocations for each of them
  • once checks are separated out in their own functions, we can invoke them more than once, which is a pre-requisite for issue #971
P0 Urgent

All 6 comments

Marc and lasse, what do you think? Should Felipe continue this?

@davelab6 @m4rc1e and @graphicore I'd like to mention here that I am putting this effort because I think this will make my work easier. The lack of structure in this giant script has been a pain for a while already. I think the refactoring suggested here (45% of which was already implemented today and probably the rest to be done on my next work day) will have a positive impact not only on the overall code readability, but also in its reliability.

I agree with Felipe here.

I used a similar approach for my glyphsapp QA scripts. Many tests rely on other tests to work properly. By having every test as a function, we'll cut down on the duplication.

Cheers,
Marc

Cool! I'll move on and finish this today. Thanks, @m4rc1e and @graphicore

Thanks both

Was this page helpful?
0 / 5 - 0 ratings