'How can I check the filename of a file being linted by ktlint?

I am trying to prevent certain imports in files with "ViewModel" in their filename but have so far only found a way to use ktlint to check for classes with ViewModel in their name. Does anyone know how to leverage ktlint to write a lint rule that would forbid imports in a file based on the file's name?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source