private void checkQualityProfilesConsistency ( ScannerReport . Metadata metadata , Organization organization ) { List < String > profileKeys = metadata . getQprofilesPerLanguage ( ) . values ( ) . stream ( ) . map ( QProfile :: getKey ) . collect ( toList ( metadata . getQprofilesPerLanguage ( ) . size ( ) ) ) ; try ( DbSession dbSession = dbClient . openSession ( false ) ) { List < QProfileDto > profiles = dbClient . qualityProfileDao ( ) . selectByUuids ( dbSession , profileKeys ) ; String badKeys = profiles . stream ( ) . filter ( p -> ! p . getOrganizationUuid ( ) . equals ( organization . getUuid ( ) ) ) . map ( QProfileDto :: getKee ) . collect ( MoreCollectors . join ( Joiner . on ( ", " ) ) ) ; if ( ! badKeys . isEmpty ( ) ) { throw MessageException . of ( format ( "Quality profiles with following keys don't exist in organization [%s]: %s" , organization . getKey ( ) , badKeys ) ) ; } } }
Check that the Quality profiles sent by scanner correctly relate to the project organization .