-
Notifications
You must be signed in to change notification settings - Fork 363
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Missing VC rules #1488
Comments
Looking closer a longer list is missing (315):
|
There's a whole lot more to discover: It looks like the warnings in compiler-vc.xml are scraped from somewhere, but I can't find any script in the repo. Any hints on this? |
Hi @gerboengels, The list with current VS messages is here: We also have some scripts to extract messages but not for VS: If you have some time it would be really helpful if you could provide also a Python script for VS. Regards, |
Well, that's always a problem ;-) I did find the sources for the MSVC documentation, maybe that's better parsable than scraping their website... |
Hi @gerboengels , whth code like the one below the messages can be read from the Microsoft page. Regards, # pip install beautifulsoup4
# pip install selenium-requests
from bs4 import BeautifulSoup
from selenium import webdriver
import re
# url of overview pages
url_corechecks = 'https://docs.microsoft.com/en-us/cpp/code-quality/code-analysis-for-cpp-corecheck'
url_code_analysis = 'https://docs.microsoft.com/en-us/cpp/code-quality/code-analysis-for-c-cpp-warnings'
# page contains JavaScript. Use Firefox to create HTML page
# you have to download and install https://github.com/mozilla/geckodriver/releases
browser = webdriver.Firefox(executable_path=r'C:\Program Files\geckodriver\geckodriver.exe')
browser.get(url_code_analysis)
# parse HTML page
soup = BeautifulSoup(browser.page_source, 'html.parser')
# read all warnings from menu: Cnnnnn
warnings = {}
for menu_item in soup.find_all('a', href=True, string=re.compile('C[0-9]+')):
id = menu_item.string
href = menu_item['href']
if id and href:
warnings[id] = {'href': href }
# read HTML pages of warnings
for id, data in warnings.items():
browser.get(data['href'])
soup = BeautifulSoup(browser.page_source, 'html.parser')
content = soup.find('main')
data['key'] = content.h1.string
desc = ''
for p in content.find_all('p'):
if 'name' not in data:
data['name'] = p.string
else:
desc += str(p)
data['description'] = desc
print(warnings) |
- Compiler warnings C4000 - C5999 - Code analysis for C/C++ warnings - C++ Core Guidelines checker warnings - add script to read VC messages from web - close SonarOpenCommunity#1488
- Compiler warnings C4000 - C5999 - default 'severity': 'INFO', 'type': 'CODE_SMELL' - Code analysis for C/C++ warnings - default: 'severity': 'CRITICAL', 'type': 'CODE_SMELL' - C++ Core Guidelines checker warnings - default 'severity': 'INFO', 'type': 'CODE_SMELL' - add script to read VC messages from web - Unfortunately the warnings are not uniformly structured, which is why some manual rework is often necessary. - close SonarOpenCommunity#1488
solved with #1981 for v2.0 (support latest warnings VS 2019 / msvc 160) @gerboengels you can try it. If you like to use it with v1.3 you can copy content of file |
- Compiler warnings C4000 - C5999 - default 'severity': 'INFO', 'type': 'CODE_SMELL' - Code analysis for C/C++ warnings - default: 'severity': 'CRITICAL', 'type': 'CODE_SMELL' - C++ Core Guidelines checker warnings - default 'severity': 'INFO', 'type': 'CODE_SMELL' - add script to read VC messages from web - Unfortunately the warnings are not uniformly structured, which is why some manual rework is often necessary. - close SonarOpenCommunity#1488
Some rules are missing in the file: https://github.com/SonarOpenCommunity/sonar-cxx/blob/master/cxx-sensors/src/main/resources/compiler-vc.xml
The text was updated successfully, but these errors were encountered: