I believe there is a small typo in spam-check-bogofilter which causes the function to always return nil. Spam-check-bogofilter-headers should be called in the temporary buffer that contains the X-Bogosity line, not in the article buffer: