third_party/blink/tools/blinkpy/style/checker.py
def _create_checker(self, file_type, file_path, handle_style_error,
                        min_confidence):
        """Instantiate and return a style checker based on file type."""
        if file_type == FileType.NONE:
            checker = None
        elif file_type == FileType.CPP:
            file_extension = self._file_extension(file_path)
            checker = CppChecker(file_path, file_extension, handle_style_error,
                                 min_confidence)
        elif file_type == FileType.JSON:
            checker = JSONChecker(file_path, handle_style_error)
        elif file_type == FileType.PYTHON:
            checker = PythonChecker(file_path, handle_style_error)
        elif file_type == FileType.XML:
            checker = XMLChecker(file_path, handle_style_error)
        elif file_type == FileType.XCODEPROJ:
            checker = XcodeProjectFileChecker(file_path, handle_style_error)
        elif file_type == FileType.PNG:
            checker = PNGChecker(file_path, handle_style_error)
        elif file_type == FileType.TEXT:
            basename = os.path.basename(file_path)
            if basename == 'TestExpectations':
                checker = TestExpectationsChecker(file_path,
                                                  handle_style_error)
            else:
                checker = TextChecker(file_path, handle_style_error)
        else:
            raise ValueError(
                'Invalid file type "%(file_type)s": the only valid file types '
                'are %(NONE)s, %(CPP)s, and %(TEXT)s.' % {
                    'file_type': file_type,
                    'NONE': FileType.NONE,
                    'CPP': FileType.CPP,
                    'TEXT': FileType.TEXT
                })

        return checker
Instantiate and return a style checker based on file type.
Instantiate and return a style checker based on file type.
Instantiate and return a style checker based on file type .
def _create_checker(self, file_type, file_path, handle_style_error,
                        min_confidence):
        if file_type == FileType.NONE:
            checker = None
        elif file_type == FileType.CPP:
            file_extension = self._file_extension(file_path)
            checker = CppChecker(file_path, file_extension, handle_style_error,
                                 min_confidence)
        elif file_type == FileType.JSON:
            checker = JSONChecker(file_path, handle_style_error)
        elif file_type == FileType.PYTHON:
            checker = PythonChecker(file_path, handle_style_error)
        elif file_type == FileType.XML:
            checker = XMLChecker(file_path, handle_style_error)
        elif file_type == FileType.XCODEPROJ:
            checker = XcodeProjectFileChecker(file_path, handle_style_error)
        elif file_type == FileType.PNG:
            checker = PNGChecker(file_path, handle_style_error)
        elif file_type == FileType.TEXT:
            basename = os.path.basename(file_path)
            if basename == 'TestExpectations':
                checker = TestExpectationsChecker(file_path,
                                                  handle_style_error)
            else:
                checker = TextChecker(file_path, handle_style_error)
        else:
            raise ValueError(
                'Invalid file type "%(file_type)s": the only valid file types '
                'are %(NONE)s, %(CPP)s, and %(TEXT)s.' % {
                    'file_type': file_type,
                    'NONE': FileType.NONE,
                    'CPP': FileType.CPP,
                    'TEXT': FileType.TEXT
                })
        return checker
def _create_checker ( self , file_type , file_path , handle_style_error , min_confidence ) : if file_type == FileType . NONE : checker = None elif file_type == FileType . CPP : file_extension = self . _file_extension ( file_path ) checker = CppChecker ( file_path , file_extension , handle_style_error , min_confidence ) elif file_type == FileType . JSON : checker = JSONChecker ( file_path , handle_style_error ) elif file_type == FileType . PYTHON : checker = PythonChecker ( file_path , handle_style_error ) elif file_type == FileType . XML : checker = XMLChecker ( file_path , handle_style_error ) elif file_type == FileType . XCODEPROJ : checker = XcodeProjectFileChecker ( file_path , handle_style_error ) elif file_type == FileType . PNG : checker = PNGChecker ( file_path , handle_style_error ) elif file_type == FileType . TEXT : basename = os . path . basename ( file_path ) if basename == 'TestExpectations' : checker = TestExpectationsChecker ( file_path , handle_style_error ) else : checker = TextChecker ( file_path , handle_style_error ) else : raise ValueError ( 'Invalid file type "%(file_type)s": the only valid file types ' 'are %(NONE)s, %(CPP)s, and %(TEXT)s.' % { 'file_type' : file_type , 'NONE' : FileType . NONE , 'CPP' : FileType . CPP , 'TEXT' : FileType . TEXT } ) return checker
Instantiate and return a style checker based on file type.
Instantiate and return a style checker based on file type .
"""Instantiate and return a style checker based on file type."""
self
file_type
file_path
handle_style_error
min_confidence