Refactor W025 Generation

As noted in the commit message, I think this refactoring is more efficient and easier to read. Since there is currently no unit test backing the warning in question, I added one in a separate commit.