pylint/checkers/misc.py
def process_tokens(self, tokens):
        """inspect the source to find fixme problems"""
        if not self.config.notes:
            return
        comments = (
            token_info for token_info in tokens if token_info.type == tokenize.COMMENT
        )
        for comment in comments:
            comment_text = comment.string[1:].lstrip()  # trim '#' and whitespaces

            # handle pylint disable clauses
            disable_option_match = OPTION_RGX.search(comment_text)
            if disable_option_match:
                try:
                    _, value = disable_option_match.group(1).split("=", 1)
                    values = [_val.strip().upper() for _val in value.split(",")]
                    if set(values) & set(self.config.notes):
                        continue
                except ValueError:
                    self.add_message(
                        "bad-inline-option",
                        args=disable_option_match.group(1).strip(),
                        line=comment.string,
                    )
                    continue

            # emit warnings if necessary
            match = self._fixme_pattern.search("#" + comment_text.lower())
            if match:
                note = match.group(1)
                self.add_message(
                    "fixme",
                    col_offset=comment.string.lower().index(note.lower()),
                    args=comment_text,
                    line=comment.start[0],
                )
def process_tokens(self, tokens):
        if not self.config.notes:
            return
        comments = (
            token_info for token_info in tokens if token_info.type == tokenize.COMMENT
        )
        for comment in comments:
            comment_text = comment.string[1:].lstrip()  # trim '#' and whitespaces

            # handle pylint disable clauses
            disable_option_match = OPTION_RGX.search(comment_text)
            if disable_option_match:
                try:
                    _, value = disable_option_match.group(1).split("=", 1)
                    values = [_val.strip().upper() for _val in value.split(",")]
                    if set(values) & set(self.config.notes):
                        continue
                except ValueError:
                    self.add_message(
                        "bad-inline-option",
                        args=disable_option_match.group(1).strip(),
                        line=comment.string,
                    )
                    continue

            # emit warnings if necessary
            match = self._fixme_pattern.search("#" + comment_text.lower())
            if match:
                note = match.group(1)
                self.add_message(
                    "fixme",
                    col_offset=comment.string.lower().index(note.lower()),
                    args=comment_text,
                    line=comment.start[0],
                )
def process_tokens ( self , tokens ) : if not self . config . notes : return comments = ( token_info for token_info in tokens if token_info . type == tokenize . COMMENT ) for comment in comments : comment_text = comment . string [ 1 : ] . lstrip ( ) # trim '#' and whitespaces # handle pylint disable clauses disable_option_match = OPTION_RGX . search ( comment_text ) if disable_option_match : try : _ , value = disable_option_match . group ( 1 ) . split ( "=" , 1 ) values = [ _val . strip ( ) . upper ( ) for _val in value . split ( "," ) ] if set ( values ) & set ( self . config . notes ) : continue except ValueError : self . add_message ( "bad-inline-option" , args = disable_option_match . group ( 1 ) . strip ( ) , line = comment . string , ) continue # emit warnings if necessary match = self . _fixme_pattern . search ( "#" + comment_text . lower ( ) ) if match : note = match . group ( 1 ) self . add_message ( "fixme" , col_offset = comment . string . lower ( ) . index ( note . lower ( ) ) , args = comment_text , line = comment . start [ 0 ] , )
inspect the source to find fixme problems
inspect the source to find fixme problems