@@ -791,26 +791,25 @@ static const std::set<std::string> misracpp2023Checkers{
791791
792792bool Settings::isPremiumEnabled (const char id[]) const
793793{
794- if (premiumArgs.empty ())
795- return false ;
796- if (premiumArgs.find (" autosar" ) != std::string::npos && autosarCheckers.count (id))
797- return true ;
798- if (premiumArgs.find (" cert-c++" ) != std::string::npos && certCppCheckers.count (id))
799- return true ;
800- if (premiumArgs.find (" cert-cpp" ) != std::string::npos && certCppCheckers.count (id))
801- return true ;
802- if (premiumArgs.find (" cert-c" ) != std::string::npos && certCCheckers.count (id))
803- return true ;
804- if (premiumArgs.find (" misra-c-" ) != std::string::npos && (misrac2012Checkers.count (id) || misrac2023Checkers.count (id) || misrac2025Checkers.count (id)))
805- return true ;
806- if (premiumArgs.find (" misra-c++-2008" ) != std::string::npos && misracpp2008Checkers.count (id))
807- return true ;
808- if (premiumArgs.find (" misra-cpp-2008" ) != std::string::npos && misracpp2008Checkers.count (id))
809- return true ;
810- if (premiumArgs.find (" misra-c++-2023" ) != std::string::npos && misracpp2023Checkers.count (id))
811- return true ;
812- if (premiumArgs.find (" misra-cpp-2023" ) != std::string::npos && misracpp2023Checkers.count (id))
813- return true ;
794+ for (std::string arg: splitString (premiumArgs, ' ' )) {
795+ std::transform (arg.cbegin (), arg.cend (), arg.begin (), [](char c) { return c==' +' ? ' p' : c; });
796+ if (startsWith (arg, " autosar" ) && autosarCheckers.count (id))
797+ return true ;
798+ if (startsWith (arg, " cert-cpp" ) && certCppCheckers.count (id))
799+ return true ;
800+ if (startsWith (arg, " cert-c" ) && certCCheckers.count (id))
801+ return true ;
802+ if (startsWith (arg, " misra-c-2012" ) && misrac2012Checkers.count (id))
803+ return true ;
804+ if (startsWith (arg, " misra-c-2023" ) && misrac2023Checkers.count (id))
805+ return true ;
806+ if (startsWith (arg, " misra-c-2025" ) && misrac2025Checkers.count (id))
807+ return true ;
808+ if (startsWith (arg, " misra-cpp-2008" ) && misracpp2008Checkers.count (id))
809+ return true ;
810+ if (startsWith (arg, " misra-cpp-2023" ) && misracpp2023Checkers.count (id))
811+ return true ;
812+ }
814813 return false ;
815814}
816815
0 commit comments