@@ -755,26 +755,25 @@ static const std::set<std::string> misracpp2023Checkers{
755755
756756bool Settings::isPremiumEnabled (const char id[]) const
757757{
758- if (premiumArgs.empty ())
759- return false ;
760- if (premiumArgs.find (" autosar" ) != std::string::npos && autosarCheckers.count (id))
761- return true ;
762- if (premiumArgs.find (" cert-c++" ) != std::string::npos && certCppCheckers.count (id))
763- return true ;
764- if (premiumArgs.find (" cert-cpp" ) != std::string::npos && certCppCheckers.count (id))
765- return true ;
766- if (premiumArgs.find (" cert-c" ) != std::string::npos && certCCheckers.count (id))
767- return true ;
768- if (premiumArgs.find (" misra-c-" ) != std::string::npos && (misrac2012Checkers.count (id) || misrac2023Checkers.count (id) || misrac2025Checkers.count (id)))
769- return true ;
770- if (premiumArgs.find (" misra-c++-2008" ) != std::string::npos && misracpp2008Checkers.count (id))
771- return true ;
772- if (premiumArgs.find (" misra-cpp-2008" ) != std::string::npos && misracpp2008Checkers.count (id))
773- return true ;
774- if (premiumArgs.find (" misra-c++-2023" ) != std::string::npos && misracpp2023Checkers.count (id))
775- return true ;
776- if (premiumArgs.find (" misra-cpp-2023" ) != std::string::npos && misracpp2023Checkers.count (id))
777- return true ;
758+ for (std::string arg: splitString (premiumArgs, ' ' )) {
759+ std::transform (arg.cbegin (), arg.cend (), arg.begin (), [](char c) { return c==' +' ? ' p' : c; });
760+ if (startsWith (arg, " autosar" ) && autosarCheckers.count (id))
761+ return true ;
762+ if (startsWith (arg, " cert-cpp" ) && certCppCheckers.count (id))
763+ return true ;
764+ if (startsWith (arg, " cert-c" ) && certCCheckers.count (id))
765+ return true ;
766+ if (startsWith (arg, " misra-c-2012" ) && misrac2012Checkers.count (id))
767+ return true ;
768+ if (startsWith (arg, " misra-c-2023" ) && misrac2023Checkers.count (id))
769+ return true ;
770+ if (startsWith (arg, " misra-c-2025" ) && misrac2025Checkers.count (id))
771+ return true ;
772+ if (startsWith (arg, " misra-cpp-2008" ) && misracpp2008Checkers.count (id))
773+ return true ;
774+ if (startsWith (arg, " misra-cpp-2023" ) && misracpp2023Checkers.count (id))
775+ return true ;
776+ }
778777 return false ;
779778}
780779
0 commit comments