@@ -88,7 +88,8 @@ def load_config(config_file: str | None) -> tuple[dict[Any, Any], str | None]:
8888
8989 config = clean_json (config_lintable .data )
9090 if not isinstance (config , dict ):
91- raise RuntimeError ("Schema failed to properly validate the config file." )
91+ msg = "Schema failed to properly validate the config file."
92+ raise RuntimeError (msg )
9293 config ["config_file" ] = config_path
9394 config_dir = os .path .dirname (config_path )
9495 expand_to_normalized_paths (config , config_dir )
@@ -158,9 +159,11 @@ def __init__( # pylint: disable=too-many-arguments,redefined-builtin
158159 ) -> None :
159160 """Create the argparse action with WriteArg-specific defaults."""
160161 if nargs is not None :
161- raise ValueError ("nargs for WriteArgAction must not be set." )
162+ msg = "nargs for WriteArgAction must not be set."
163+ raise ValueError (msg )
162164 if const is not None :
163- raise ValueError ("const for WriteArgAction must not be set." )
165+ msg = "const for WriteArgAction must not be set."
166+ raise ValueError (msg )
164167 super ().__init__ (
165168 option_strings = option_strings ,
166169 dest = dest ,
@@ -589,9 +592,8 @@ def get_config(arguments: list[str]) -> Options:
589592 )
590593
591594 if not options .project_dir or not os .path .exists (options .project_dir ):
592- raise RuntimeError (
593- f"Failed to determine a valid project_dir: { options .project_dir } " ,
594- )
595+ msg = f"Failed to determine a valid project_dir: { options .project_dir } "
596+ raise RuntimeError (msg )
595597
596598 # Compute final verbosity level by subtracting -q counter.
597599 options .verbosity -= options .quiet
0 commit comments