Skip to content
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

Closed
guwirth opened this issue Jun 7, 2018 · 6 comments · Fixed by #1981
Closed

Missing VC rules #1488

guwirth opened this issue Jun 7, 2018 · 6 comments · Fixed by #1981
Assignees
Milestone

Comments

@guwirth
Copy link
Collaborator

guwirth commented Jun 7, 2018

Some rules are missing in the file: https://github.com/SonarOpenCommunity/sonar-cxx/blob/master/cxx-sensors/src/main/resources/compiler-vc.xml

@guwirth
Copy link
Collaborator Author

guwirth commented Jun 17, 2018

Looking closer a longer list is missing (315):
https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warnings-by-compiler-version

C4006 #undef expected an identifier
C4008 'function': 'atribute' attribute ignored
C4019 empty statement at global scope
C4023 'function': based pointer passed to unprototyped function: parameter 'parameter_number'
C4025 'function': based pointer passed to function with variable arguments: parameter 'parameter_number'
C4026 function declared with formal parameter list
C4027 function declared without formal parameter list
C4030 first formal parameter list longer than the second list
C4033 'function' must return a value
C4035 'function': no return value
C4036 unnamed 'type' as actual parameter
C4038 'modifier': illegal class modifier
C4041 compiler limit: terminating browser output
C4045 'array': array bounds overflow
C4051 type conversion; possible loss of data
C4052 function declarations different; one contains variable arguments
C4053 one void operand for '?:'
C4055 'conversion' : from data pointer 'type1' to function pointer 'type2'
C4057 'operator': 'identifier1' differs in indirection to slightly different base types from 'identifier2'
C4060 switch statement contains no 'case' or 'default' labels
C4063 case 'identifier' is not a valid value for switch of enum 'enumeration'
C4064 switch of incomplete enum 'enumeration'
C4065 switch statement contains 'default' but no 'case' labels
C4066 characters beyond first in wide-character constant ignored
C4068 unknown pragma
C4069 long double is the same precision as double
C4075 initializers put in unrecognized initialization area
C4076 'type_modifier': can not be used with type 'typename'
C4077 unknown check_stack option
C4080 expected identifier for segment name; found 'symbol'
C4081 expected 'token1'; found 'token2'
C4085 expected pragma parameter to be 'on' or 'off'
C4086 expected pragma parameter to be '1', '2', '4', '8', or '16'
C4087 'function': declared with 'void' parameter list
C4097 expected pragma parameter to be 'restore' or 'off'
C4102 'label': unreferenced label
C4109 unexpected identifier 'identifier'
C4112 #line requires an integer between 1 and 'line_count'
C4115 'type': named type definition in parentheses
C4117 macro name 'name' is reserved, 'command' ignored
C4119 different bases 'base1' and 'base2' specified
C4120 based/unbased mismatch
C4122 'function': alloc_text applicable only to functions with C linkage
C4123 different base expressions specified
C4125 decimal digit terminates octal escape sequence
C4131 'function': uses old-style declarator
C4132 'object': const object should be initialized
C4137 'function': no return value from floating-point function
C4141 'modifier': used more than once
C4143 pragma 'same_seg' not supported; use __based allocation
C4145 'expression1': relational expression as switch expression; possible confusion with 'expression2'
C4150 deletion of pointer to incomplete type 'type'; no destructor called
C4152 nonstandard extension, function/data pointer conversion in expression
C4153 function/data pointer conversion in expression
C4155 deletion of an array expression without using the array form of 'delete'
C4158 assuming #pragma pointers_to_members(full_generality, 'inheritance_type')
C4160 #pragma 'pragma'(pop,...): did not find previously pushed identifier 'identifier'
C4161 #pragma 'pragma'(pop...): more pops than pushes
C4163 'identifier': not available as an intrinsic function
C4164 'function': intrinsic function not declared
C4165 'HRESULT' is being converted to 'bool'; are you sure this is what you want?
C4166 illegal calling convention for constructor/destructor
C4167 'function': only available as an intrinsic function
C4168 compiler limit: out of debugger types, delete program database 'database' and rebuild
C4174 'name': not available as a #pragma component
C4175 #pragma component(browser, on): browser info must initially be specified on the command line
C4176 'subcomponent': unknown subcomponent for #pragma component browser
C4177 #pragma 'pragma' should only be used at global scope or namespace scope
C4178 case constant 'constant' too big for the type of the switch expression
C4179 '//': parsed as '/' and '/*': confusion with standard '//' comments
C4180 qualifier applied to function type has no meaning; ignored
C4181 qualifier applied to reference type; ignored
C4182 #include nesting level is 'nest_count' deep; possible infinite recursion
C4185 ignoring unknown #import attribute 'attribute'
C4186 #import attribute 'attribute' requires 'argument_count' arguments; ignored
C4187 #import attributes 'attribute1' and 'attribute2' are incompatible; both ignored
C4188 constant expression is not integral
C4193 #pragma warning(pop): no matching '#pragma warning(push)'
C4194 #pragma start_map_region cannot be nested; ignored
C4195 #pragma stop_map_region used without matching #pragma start_map_region; ignored
C4196 expected '%$L' or '%$L'; found '%$L'
C4274 #ident ignored; see documentation for #pragma comment(exestr, 'string')
C4277 imported item 'classname::member' exists as both data member and function member; data member ignored
C4279 'identifier': identifier in type library 'library' is a keyword; use the 'rename' qualifier
C4298 'identifier': identifier in type library 'library' is already a macro; renaming to '__identifier'
C4299 'identifier': identifier in type library 'library' is a keyword; renaming to '__identifier'
C4301 'derived_class::function': overriding virtual function only differs from 'base_class::function' by const/volatile qualifier
C4314 expected pragma parameter to be '32' or '64'
C4315 'classname': 'this' pointer for member 'member' may not be aligned 'alignment' as expected by the constructor
C4319 'operator': zero extending 'type1' to 'type2' of greater size
C4321 automatically generating an IID for interface 'interface'
C4322 automatically generating a CLSID for class 'class'
C4323 re-using registered CLSID for class 'class'
C4330 attribute 'attribute' for section 'section' ignored
C4338 #pragma directive: standard section 'section' is used
C4352 'identifier': intrinsic function already defined
C4362 'type': alignment greater than 8 bytes is not supported by CLR
C4367 Conversion from 'type1' to 'type2' may cause datatype misalignment exception
C4370 'classname': layout of class has changed from a previous version of the compiler due to better packing
C4371 'classname': layout of class may have changed from a previous version of the compiler due to better packing of member 'member'
C4373 'derived_class::function': virtual function overrides 'base_class::function', previous versions of the compiler did not override when parameters only differed by const/volatile qualifiers
C4380 'class': A default constructor cannot be deprecated
C4387 'alternative': was considered
C4388 'expression': signed/unsigned mismatch
C4396 'function': the inline specifier cannot be used when a friend declaration refers to a specialization of a function template
C4413 'classname::member': reference member is initialized to a temporary that doesn't persist after the constructor exits
C4415 duplicate __declspec(code_seg('name'))
C4417 an explicit template instantiation cannot have __declspec(code_seg(...)): ignored
C4419 'symbol' has no effect when applied to private ref class 'class'.
C4421 'parameter': a reference parameter on a resumable function is potentially unsafe
C4424 catch for 'type1' preceded by 'type2' on line number; unpredictable behavior may result if 'std::bad_alloc' is thrown
C4425 A SAL annotation cannot be applied to '...'
C4427 'operator': overflow in constant division, undefined behavior
C4438 'function': cannot be called safely in /await:clrcompat mode. If 'function' calls into the CLR it may result in CLR head corruption
C4442 embedded null terminator in __annotation argument. Value will be truncated.
C4443 expected pragma parameter to be '0', '1', or '2'
C4444 'identifier': top level '__unaligned' is not implemented in this context
C4446 'type': cannot map member 'name1' into this type, due to conflict with the type name. The method was renamed to 'name2'
C4447 'main' signature found without threading model. Consider using 'int main(Platform::Array<Platform::String^>^ args)'.
C4448 'type1' does not have a default interface specified in metadata. Picking: 'type2', which may fail at runtime.
C4449 'type' an unsealed type should be marked as '[WebHostHidden]'
C4450 'type1' should be marked as '[WebHostHidden]' because it derives from 'type2'
C4451 'classname1::member': Usage of ref class 'classname2::member' inside this context can lead to invalid marshaling of object across contexts
C4452 'identifier': public type cannot be at global scope. It must be in a namespace that is a child of the name of the output .winmd file.
C4453 'type': A '[WebHostHidden]' type should not be used on the published surface of a public type that is not '[WebHostHidden]'
C4454 'function' is overloaded by more than the number of input parameters without having [DefaultOverload] specified. Picking 'declaration' as the default overload
C4455 'operator operator': literal suffix identifiers that do not start with an underscore are reserved
C4459 declaration of 'identifier' hides global declaration
C4463 overflow; assigning 'value' to bit-field that can only hold values from 'min_value' to 'max_value'
C4464 relative include path contains '..'
C4483 syntax error: expected C++ keyword
C4491 'name': has an illegal IDL version format
C4492 'function1': matches base ref class method 'function2', but is not marked 'override'
C4493 delete expression has no effect as the destructor of 'type' does not have 'public' accessibility
C4495 nonstandard extension '__super' used: replace with explicit base class name
C4496 nonstandard extension 'for each' used: replace with ranged-for statement
C4497 nonstandard extension 'sealed' used: replace with 'final'
C4498 nonstandard extension used: 'extension'
C4499 'function' : an explicit specialization cannot have a storage class (ignored)"
C4531 C++ exception handling not available on Windows CE. Use Structured Exception Handling
C4542 Skipping generation of merged injected text file, cannot write filetype file: 'issue': message
C4562 fully prototyped functions are required with the '/clr' option: converting '()' to '(void)'
C4568 'function': no members match the signature of the explicit override
C4569 'function': no members match the signature of the explicit override
C4573 the usage of 'lambda function' requires the compiler to capture 'this' but the current default capture mode does not allow it
C4574 'Identifier' is defined to be '0': did you mean to use '#if identifier'?
C4575 '__vectorcall' incompatible with the '/clr' option: converting to '__stdcall'
C4576 a parenthesized type followed by an initializer list is a non-standard explicit type conversion syntax
C4577 'noexcept' used with no exception handling mode specified; termination on exception is not guaranteed. Specify /EHsc
C4578 'abs': conversion from 'type1' to 'type2', possible loss of data (Did you mean to call 'function' or to #include <cmath>?)
C4582 'type': constructor is not implicitly called
C4583 'type': destructor is not implicitly called
C4585 'class': A WinRT 'public ref class' must either be sealed or derive from an existing unsealed class
C4586 'type': A public type cannot be declared in a top-level namespace called 'Windows'
C4587 'anonymous_structure': behavior change: constructor is no longer implicitly called
C4588 'anonymous_structure': behavior change: destructor is no longer implicitly called
C4591 'constexpr' call-depth limit of number exceeded (/constexpr:depth<NUMBER>)
C4592 'function': 'constexpr' call evaluation failed; function will be called at run-time
C4593 'function': 'constexpr' call evaluation step limit of 'limit' exceeded; use /constexpr:steps<NUMBER> to increase the limit
C4594 'type': destructor will not be implicitly called if an exception is thrown
C4595 'type': behavior change: destructor will no longer be implicitly called if an exception is thrown
C4596 'identifier': illegal qualified name in member declaration
C4597 undefined behavior: offsetof applied to a member of a virtual base
C4598 '#include "header"': header number number in the precompiled header does not match current compilation at that position
C4599 'flag path': command line argument number number does not match precompiled header
C4602 #pragma pop_macro: 'macro name' no previous #pragma push_macro for this identifier
C4603 'identifier': macro is not defined or definition is different after precompiled header use
C4604 'type': passing argument by value across native and managed boundary requires valid copy constructor. Otherwise the runtime behavior is undefined
C4605 '/Dmacro' specified on current command line, but was not specified when precompiled header was built
C4609 'type1' derives from default interface 'interface' on type 'type2'. Use a different default interface for 'type1', or break the base/derived relationship.
C4612 error in include filename
C4613 'symbol': class of segment cannot be changed
C4620 no postfix form of 'operator ++' found for type 'type', using prefix form
C4622 overwriting debug information formed during creation of the precompiled header in object file: 'file'
C4629 digraph used, character sequence 'digraph' interpreted as token 'char' (insert a space between the two characters if this is not what you intended)
C4631 MSXML or XPath unavailable, XML document comments will not be processed. reason
C4634 XML document comment target: cannot be applied: reason
C4635 XML document comment target: badly-formed XML: reason
C4636 XML document comment applied to construct: tag requires non-empty 'attribute' attribute.
C4637 XML document comment target: <include> tag discarded. Reason
C4638 XML document comment target: reference to unknown symbol 'symbol'.
C4648 standard attribute 'carries_dependency' is ignored
C4649 attributes are ignored in this context
C4654 Code placed before include of precompiled header line will be ignored. Add code to precompiled header.
C4655 'symbol': variable type is new since the latest build, or is defined differently elsewhere
C4657 expression involves a data type that is new since the latest build
C4658 'function': function prototype is new since the latest build, or is declared differently elsewhere
C4662 explicit instantiation; template-class 'identifier1' has no definition from which to specialize 'identifier2'
C4670 'identifier': this base class is inaccessible
C4671 'identifier': the copy constructor is inaccessible
C4672 'identifier1': ambiguous. First seen as 'identifier2'
C4674 'method' should be declared 'static' and have exactly one parameter
C4676 '%s': the destructor is inaccessible
C4678 base class 'base_type' is less accessible than 'derived_type'
C4681 'class': coclass does not specify a default interface that is an event source
C4682 'parameter': no directional parameter attribute specified, defaulting to [in]
C4685 expecting '> >' found '>>' when parsing template parameters
C4688 'constraint': constraint list contains assembly private type 'type'
C4689 '%c': unsupported character in #pragma detect_mismatch; #pragma ignored
C4693 'class': a sealed abstract class cannot have any instance members 'instance member'
C4694 'class': a sealed abstract class cannot have a base-class 'base_class'
C4695 #pragma execution_character_set: 'character set' is not a supported argument: currently only 'UTF-8' is supported
C4696 /ZBvalue1 option out of range; assuming 'value2'
C4718 'function call': recursive call has no side effects, deleting
C4719 Double constant found when Qfast specified - use 'f' as a suffix to indicate single precision
C4720 in-line assembler reports: 'message'
C4721 'function': not available as an intrinsic
C4722 'function': destructor never returns, potential memory leak
C4724 potential mod by 0
C4725 instruction may be inaccurate on some Pentiums
C4728 /Yl- option ignored because PCH reference is required
C4729 function too big for flow graph based warnings
C4732 intrinsic '%s' is not supported in this architecture
C4738 storing 32-bit float result in memory, possible loss of performance
C4739 reference to variable 'var' exceeds its storage space
C4749 conditionally supported: offsetof applied to non-standard-layout type 'type'
C4756 overflow in constant arithmetic
C4757 subscript is a large unsigned value, did you intend a negative constant?
C4764 Can not align catch objects to greater than 16 bytes
C4767 section name '%s' is longer than 8 characters and will be truncated by the linker
C4768 __declspec attributes before linkage specification are ignored
C4770 partially validated enum 'name' used as index
C4771 Bounds must be created using a simple pointer; MPX intrinsic function ignored
C4792 function '%s' declared using sysimport and referenced from native code; import library required to link
C4794 segment of thread local storage variable '%s' changed from '%s' to '%s'
C4807 'operation': unsafe mix of type 'type1' and signed bit field of type 'type2'
C4808 case 'value' is not a valid value for switch condition of type 'bool'
C4809 switch statement has redundant 'default' label; all possible 'case' labels are given
C4812 obsolete declaration style: please use 'new_syntax' instead
C4813 'function': a friend function of a local class must have been previously declared
C4816 'param': parameter has a zero-sized array which will be truncated (unless the object is passed by reference)
C4817 'member': illegal use of '.' to access this member; compiler replaced with '->'
C4822 'member function': local class member function does not have a body
C4827 A public 'ToString' method with 0 parameters should be marked as virtual and override
C4839 non-standard use of class 'type' as an argument to a variadic function
C4840 non-portable use of class 'type' as an argument to a variadic function
C4841 non-standard extension used: compound member designator used in offsetof
C4842 the result of 'offsetof' applied to a type using multiple inheritance is not guaranteed to be consistent between compiler releases
C4843 'type1': An exception handler of reference to array or function type is unreachable, use 'type2' instead
C4844 'export module module_name;' is now the preferred syntax for declaring a module interface
C4868 'file(line_number)' compiler may not enforce left-to-right evaluation order in braced initialization list
C4872 floating point division by zero detected when compiling the call graph for the concurrency::parallel_for_each at: 'location'
C4880 casting from 'const type_1' to 'type_2': casting away constness from a pointer or reference may result in undefined behavior in an amp restricted function
C4881 the constructor and/or the destructor will not be invoked for tile_static variable 'variable'
C4882 passing functors with non-const call operators to concurrency::parallel_for_each is deprecated
C4900 Il mismatch between 'tool1' version 'version1' and 'tool2' version 'version2'
C4910 '<identifier>: '__declspec(dllexport)' and 'extern' are incompatible on an explicit instantiation
C4912 'attribute': attribute has undefined behavior on a nested UDT
C4913 user defined binary operator ',' exists but no overload could convert all operands, default built-in binary operator ',' used
C4916 in order to have a dispid, 'description': must be introduced by an interface
C4918 'character': invalid character in pragma optimization list
C4920 enum enum member member_1=value_1 already seen in enum enum as member_2=value_2
C4921 'description': attribute value 'attribute' should not be multiply specified
C4925 'method': dispinterface method cannot be called from script
C4926 'identifier': symbol is already defined: attributes ignored
C4934 '__delegate(multicast)' is deprecated, use '__delegate' instead
C4935 assembly access specifier modified from 'access'
C4936 this __declspec is supported only when compiled with /clr or /clr:pure
C4937 'text1' and 'text2' are indistinguishable as arguments to 'directive'
C4938 'var': Floating point reduction variable may cause inconsistent results under /fp:strict or #pragma fenv_access
C4939 #pragma vtordisp is deprecated and will be removed in a future release of Visual C++
C4944 'symbol': cannot import symbol from 'assembly1': as 'symbol' already exists in the current scope
C4947 'type_or_member': marked as obsolete
C4950 'type_or_member': marked as obsolete
C4951 'function' has been edited since profile data was collected, function profile data not used
C4952 'function': no profile data found in program database 'pgd_file'
C4953 Inlinee 'function' has been edited since profile data was collected, profile data not used
C4954 'function': not profiled (contains __int64 switch expression)
C4955 'import2': import ignored; already imported from 'import1'
C4956 'type': this type is not verifiable
C4957 'cast': explicit cast from 'cast_from' to 'cast_to' is not verifiable
C4958 'operation': pointer arithmetic is not verifiable
C4959 cannot define unmanaged type 'type' in /clr:safe because accessing its members yields unverifiable code
C4960 'function' is too big to be profiled
C4961 No profile data was merged into '.pgd file', profile-guided optimizations disabled
C4962 'function': Profile-guided optimizations disabled because optimizations caused profile data to become inconsistent
C4963 'description': no profile data found; different compiler options were used in instrumented build
C4966 'function' has __code_seg annotation with unsupported segment name, annotation ignored
C4970 delegate constructor: target object ignored since 'type' is static
C4971 Argument order: <target object>, <target function> for delegate constructor is deprecated, use <target function>, <target object="">
C4972 Directly modifying or treating the result of an unbox operation as an lvalue is unverifiable
C4973 'symbol': marked as deprecated
C4974 'symbol': marked as deprecated
C4981 Warbird: function 'function' marked as __forceinline not inlined because it contains exception semantics
C4985 symbol name': attributes not present on previous declaration.
C4987 nonstandard extension used: 'throw (...)'
C4988 'variable': variable declared outside class/function scope
C4989 'type': type has conflicting definitions.
C4990 Warbird: message
C4991 Warbird: function 'function' marked as __forceinline not inlined because protection level of inlinee is greater than the parent
C4992 Warbird: function 'function' marked as __forceinline not inlined because it contains inline assembly which cannot be protected
C4997 'class': coclass does not implement a COM interface or pseudo-interface
C4998 EXPECTATION FAILED: expectation(value)
C4999 UNKNOWN WARNING Please choose the Technical Support command on the Visual C++ Help menu, or open the Technical Support help file for more information
C5022 'type': multiple move constructors specified
C5023 'type': multiple move assignment operators specified
C5024 'type': move constructor was implicitly defined as deleted
C5025 'type': move assignment operator was implicitly defined as deleted
C5026 'type': move constructor was implicitly defined as deleted
C5027 'type': move assignment operator was implicitly defined as deleted
C5029 nonstandard extension used: alignment attributes in C++ apply to variables, data members and tag types only
C5030 attribute 'attribute' is not recognized
C5031 #pragma warning(pop): likely mismatch, popping warning state pushed in different file
C5033 'storage-class' is no longer a supported storage class
C5034 use of intrinsic 'intrinsic' causes function function to be compiled as guest code
C5035 use of feature 'feature' causes function function to be compiled as guest code
C5036 varargs function pointer conversion when compiling with /hybrid:x86arm64 'type1' to 'type2'
C5037 'member-function': an out-of-line definition of a member of a class template cannot have default arguments
C5038 data member 'member1' will be initialized after data member 'member2'
C5039 'function': pointer or reference to potentially throwing function passed to extern C function under -EHc. Undefined behavior may occur if this function throws an exception.
C5040 dynamic exception specifications are valid only in C++14 and earlier; treating as noexcept(false)
C5041 'definition': out-of-line definition for constexpr static data member is not needed and is deprecated in C++17
C5042 'declaration': function declarations at block scope cannot be specified 'inline' in standard C++; remove 'inline' specifier
C5043 'specification': exception specification does not match previous declaration
C5044 An argument to command-line option option points to a path 'path' that does not exist

@guwirth guwirth modified the milestones: 1.1, 1.2 Jun 19, 2018
@guwirth guwirth removed this from the 1.2 milestone Oct 29, 2018
@gerboengels
Copy link

There's a whole lot more to discover:
https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warnings-by-compiler-version
https://docs.microsoft.com/en-us/cpp/code-quality/code-analysis-for-c-cpp-warnings

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?

@guwirth
Copy link
Collaborator Author

guwirth commented Nov 1, 2020

Hi @gerboengels,

The list with current VS messages is here:
https://github.com/SonarOpenCommunity/sonar-cxx/blob/master/cxx-sensors/src/main/resources/compiler-vc.xml

We also have some scripts to extract messages but not for VS:
https://github.com/SonarOpenCommunity/sonar-cxx/tree/master/cxx-sensors/src/tools

If you have some time it would be really helpful if you could provide also a Python script for VS.

Regards,

@gerboengels
Copy link

If you have some time [...]

Well, that's always a problem ;-)
I'll try to find some time to look into it, but I cannot promise anything...

I did find the sources for the MSVC documentation, maybe that's better parsable than scraping their website...
https://github.com/MicrosoftDocs/cpp-docs/tree/master/docs/error-messages/compiler-warnings
https://github.com/MicrosoftDocs/cpp-docs/tree/master/docs/code-quality

@guwirth
Copy link
Collaborator Author

guwirth commented Nov 14, 2020

Hi @gerboengels ,

whth code like the one below the messages can be read from the Microsoft page.
Not sure if we should copy the message text or set only a link to the original docu.

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)

@guwirth guwirth added this to the 2.0.0 milestone Nov 16, 2020
@guwirth guwirth self-assigned this Nov 25, 2020
guwirth added a commit to guwirth/sonar-cxx that referenced this issue Nov 25, 2020
- 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
guwirth added a commit to guwirth/sonar-cxx that referenced this issue Nov 29, 2020
- 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
@guwirth
Copy link
Collaborator Author

guwirth commented Nov 29, 2020

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-vc.xml to other sensor.

guwirth added a commit to guwirth/sonar-cxx that referenced this issue Nov 29, 2020
- 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

2 participants