def __init__( self, config: Optional[FluffConfig] = None, formatter: Any = None, dialect: Optional[str] = None, rules: Optional[List[str]] = None, user_rules: Optional[List[BaseRule]] = None, exclude_rules: Optional[List[str]] = None, ) -> None: # Store the config object self.config = FluffConfig.from_kwargs( config=config, dialect=dialect, rules=rules, exclude_rules=exclude_rules, # Don't require a dialect to be provided yet. Defer this until we # are actually linting something, since the directory we are linting # from may provide additional configuration, including a dialect. require_dialect=False, ) # Get the dialect and templater self.dialect = self.config.get("dialect_obj") self.templater = self.config.get("templater_obj") # Store the formatter for output self.formatter = formatter # Store references to user rule classes self.user_rules = user_rules or []
def __init__( self, config: Optional[FluffConfig] = None, last_resort_lexer: Optional[SingletonMatcher] = None, dialect: Optional[str] = None, ): # Allow optional config and dialect self.config = FluffConfig.from_kwargs(config=config, dialect=dialect) lexer_struct = self.config.get("dialect_obj").get_lexer_struct() self.matcher = RepeatedMultiMatcher.from_struct(lexer_struct) self.last_resort_lexer = last_resort_lexer or RegexMatcher.from_shorthand( "<unlexable>", r"[^\t\n\,\.\ \-\+\*\\\/\'\"\;\:\[\]\(\)\|]*", is_code=True )
def __init__( self, config: Optional[FluffConfig] = None, last_resort_lexer: Optional[StringLexer] = None, dialect: Optional[str] = None, ): # Allow optional config and dialect self.config = FluffConfig.from_kwargs(config=config, dialect=dialect) # Store the matchers self.lexer_matchers = self.config.get( "dialect_obj").get_lexer_matchers() self.last_resort_lexer = last_resort_lexer or RegexLexer( "<unlexable>", r"[^\t\n\,\.\ \-\+\*\\\/\'\"\;\:\[\]\(\)\|]*", UnlexableSegment, )
def __init__( self, config: Optional[FluffConfig] = None, formatter: Any = None, dialect: Optional[str] = None, rules: Optional[Union[str, List[str]]] = None, user_rules: Optional[Union[str, List[str]]] = None, ) -> None: # Store the config object self.config = FluffConfig.from_kwargs(config=config, dialect=dialect, rules=rules) # Get the dialect and templater self.dialect = self.config.get("dialect_obj") self.templater = self.config.get("templater_obj") # Store the formatter for output self.formatter = formatter # Store references to user rule classes self.user_rules = user_rules or []
def __init__(self, config: Optional[FluffConfig] = None, dialect: Optional[str] = None): # Allow optional config and dialect self.config = FluffConfig.from_kwargs(config=config, dialect=dialect) self.RootSegment = self.config.get("dialect_obj").get_root_segment()