

def _CheckSortedRequiresProvides(self, token):
    'Checks that all goog.require and goog.provide statements are sorted.\n\n    Note that this method needs to be run after missing statements are added to\n    preserve alphabetical order.\n\n    Args:\n      token: The first token in the token stream.\n    '
    sorter = requireprovidesorter.RequireProvideSorter()
    first_provide_token = sorter.CheckProvides(token)
    if first_provide_token:
        new_order = sorter.GetFixedProvideString(first_provide_token)
        self._HandleError(errors.GOOG_PROVIDES_NOT_ALPHABETIZED, ('goog.provide classes must be alphabetized.  The correct code is:\n' + new_order), first_provide_token, position=Position.AtBeginning(), fix_data=first_provide_token)
    first_require_token = sorter.CheckRequires(token)
    if first_require_token:
        new_order = sorter.GetFixedRequireString(first_require_token)
        self._HandleError(errors.GOOG_REQUIRES_NOT_ALPHABETIZED, ('goog.require classes must be alphabetized.  The correct code is:\n' + new_order), first_require_token, position=Position.AtBeginning(), fix_data=first_require_token)

dataset/ETHPy150Open google/closure-linter/closure_linter/javascriptlintrules.py JavaScriptLintRules._CheckSortedRequiresProvides/original