### SUMMARY

Update validate-modules to report messages using named error codes like `version-added` instead of error numbers like `E305`.

This would match the behavior of other tools we use, such as pylint, which have one named error code per rule. This will also make ignore entries much easier to read.

Doing this before 2.9 is released will avoid potential backwards compatibility issues with ignore entries in collections.

##### ISSUE TYPE

Feature Idea

##### COMPONENT NAME

validate-modules

""" Ensure that the module ends with:
            if __name__ == '__main__':
                main()
        OR, in the case of modules that are in the docs-only deprecation phase
            if __name__ == '__main__':
                removed_module()
        """
        lineno = False
        if_bodies = []
        for child in self.ast.body:
            if isinstance(child, ast.If):
                try:
                    if child.test.left.id == '__name__':
                        if_bodies.extend(child.body)
                except AttributeError:
                    pass
        bodies = self.ast.body
        bodies.extend(if_bodies)
        for child in bodies:
            
            if child.lineno == (self.length - 1):
                mainchecked = False
                try:
                    if isinstance(child, ast.If) and \
                            child.test.left.id == '__name__' and \
                            len(child.test.ops) == 1 and \
                            isinstance(child.test.ops[0], ast.Eq) and \
                            child.test.comparators[0].s == '__main__':
                        mainchecked = True