@@ -338,7 +338,7 @@ def get_license_files(self, project_dir: pathlib.Path) -> list[pathlib.Path] | N
338338
339339 return list (_get_files_from_globs (project_dir , license_files ))
340340
341- def get_readme (self , project_dir : pathlib .Path ) -> Readme | None : # noqa: C901
341+ def get_readme (self , project_dir : pathlib .Path ) -> Readme | None : # noqa: C901, PLR0912
342342 if 'project.readme' not in self :
343343 return None
344344
@@ -543,7 +543,7 @@ def __setattr__(self, name: str, value: Any) -> None:
543543 raise AttributeError (msg )
544544 super ().__setattr__ (name , value )
545545
546- def validate (self , * , warn : bool = True ) -> None :
546+ def validate (self , * , warn : bool = True ) -> None : # noqa: C901
547547 if self .auto_metadata_version not in KNOWN_METADATA_VERSIONS :
548548 msg = f'The metadata_version must be one of { KNOWN_METADATA_VERSIONS } or None (default)'
549549 raise ConfigurationError (msg )
@@ -569,19 +569,26 @@ def validate(self, *, warn: bool = True) -> None:
569569 msg = 'Setting "project.license" to an SPDX license expression is not compatible with "License ::" classifiers'
570570 raise ConfigurationError (msg )
571571
572- if warn and self . auto_metadata_version not in PRE_SPDX_METADATA_VERSIONS :
573- if isinstance ( self .license , License ) :
572+ if warn :
573+ if self .description and ' \n ' in self . description :
574574 warnings .warn (
575- 'Set "project.license" to an SPDX license expression for metadata >= 2.4' ,
576- ConfigurationWarning ,
577- stacklevel = 2 ,
578- )
579- elif any (c .startswith ('License ::' ) for c in self .classifiers ):
580- warnings .warn (
581- '"License ::" classifiers are deprecated for metadata >= 2.4, use a SPDX license expression for "project.license" instead' ,
575+ 'The one-line summary "project.description" should not contain more than one line. Readers might merge or truncate newlines.' ,
582576 ConfigurationWarning ,
583577 stacklevel = 2 ,
584578 )
579+ if self .auto_metadata_version not in PRE_SPDX_METADATA_VERSIONS :
580+ if isinstance (self .license , License ):
581+ warnings .warn (
582+ 'Set "project.license" to an SPDX license expression for metadata >= 2.4' ,
583+ ConfigurationWarning ,
584+ stacklevel = 2 ,
585+ )
586+ elif any (c .startswith ('License ::' ) for c in self .classifiers ):
587+ warnings .warn (
588+ '"License ::" classifiers are deprecated for metadata >= 2.4, use a SPDX license expression for "project.license" instead' ,
589+ ConfigurationWarning ,
590+ stacklevel = 2 ,
591+ )
585592
586593 if (
587594 isinstance (self .license , str )
@@ -701,7 +708,7 @@ def as_rfc822(self) -> RFC822Message:
701708 self .write_to_rfc822 (message )
702709 return message
703710
704- def write_to_rfc822 (self , message : email .message .Message ) -> None : # noqa: C901
711+ def write_to_rfc822 (self , message : email .message .Message ) -> None : # noqa: C901, PLR0912
705712 self .validate (warn = False )
706713
707714 smart_message = _SmartMessageSetter (message )
0 commit comments