Extract and merge line counting methods from rules.