mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Visual Studio: Enable support for Static Code Analysis
This commit is contained in:
parent
de118ddae2
commit
947185bdcc
@ -787,6 +787,35 @@ else(OCTAVE_MKOCTFILE)
|
||||
)
|
||||
endif(OCTAVE_MKOCTFILE)
|
||||
|
||||
# ##############################################################################
|
||||
# Visual Studio : Create the ruleset file to be used by Static Code Analysis
|
||||
# https://stackoverflow.com/questions/75031903/how-to-enable-static-analysis-with-custom-ruleset-in-msvc-via-cmakelists-txt
|
||||
# ##############################################################################
|
||||
|
||||
option(RESINSIGHT_ENABLE_STATIC_ANALYSIS "Enable static analysis" OFF)
|
||||
if(MSVC AND RESINSIGHT_ENABLE_STATIC_ANALYSIS)
|
||||
set(RULESET_FILE ${CMAKE_CURRENT_BINARY_DIR}/msvc-ruleset.props)
|
||||
configure_file(
|
||||
${CMAKE_SOURCE_DIR}/scripts/static-code-analysis/msvc-property-sheet-template.props
|
||||
${RULESET_FILE}
|
||||
@ONLY
|
||||
)
|
||||
|
||||
set(TARGETS_FOR_STATIC_ANALYSIS
|
||||
${APP_FWK_LIBRARIES} ApplicationLibCode Commands ResultStatisticsCache
|
||||
RigGeoMechDataModel
|
||||
)
|
||||
|
||||
foreach(TARGET_PROJECT ${TARGETS_FOR_STATIC_ANALYSIS})
|
||||
set_property(
|
||||
TARGET ${TARGET_PROJECT} PROPERTY VS_USER_PROPS "${RULESET_FILE}"
|
||||
)
|
||||
target_compile_options(
|
||||
${TARGET_PROJECT} PRIVATE /external:anglebrackets /analyze:external-
|
||||
)
|
||||
endforeach()
|
||||
endif(MSVC AND RESINSIGHT_ENABLE_STATIC_ANALYSIS)
|
||||
|
||||
# ##############################################################################
|
||||
# Code documentation using Doxygen
|
||||
# ##############################################################################
|
||||
|
257
scripts/static-code-analysis/msvc-code-analysis.ruleset
Normal file
257
scripts/static-code-analysis/msvc-code-analysis.ruleset
Normal file
@ -0,0 +1,257 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RuleSet Name="ResInsight Analysis Rules" Description="These rules focus on the most critical and common problems in your native code, including potential security holes and application crashes. You should include this rule set in any custom rule set you create for your native projects. This ruleset is designed to work with Visual Studio Professional edition and higher." ToolsVersion="17.0">
|
||||
<Rules AnalyzerId="Microsoft.Analyzers.NativeCodeAnalysis" RuleNamespace="Microsoft.Rules.Native">
|
||||
<Rule Id="C26100" Action="Warning" />
|
||||
<Rule Id="C26101" Action="Warning" />
|
||||
<Rule Id="C26110" Action="Warning" />
|
||||
<Rule Id="C26111" Action="Warning" />
|
||||
<Rule Id="C26112" Action="Warning" />
|
||||
<Rule Id="C26115" Action="Warning" />
|
||||
<Rule Id="C26116" Action="Warning" />
|
||||
<Rule Id="C26117" Action="Warning" />
|
||||
<Rule Id="C26140" Action="Warning" />
|
||||
<Rule Id="C26437" Action="Warning" />
|
||||
<Rule Id="C26439" Action="Warning" />
|
||||
<Rule Id="C26441" Action="Warning" />
|
||||
<Rule Id="C26444" Action="Warning" />
|
||||
<Rule Id="C26449" Action="Warning" />
|
||||
<Rule Id="C26450" Action="Warning" />
|
||||
<Rule Id="C26452" Action="Warning" />
|
||||
<Rule Id="C26453" Action="Warning" />
|
||||
<Rule Id="C26454" Action="Warning" />
|
||||
<Rule Id="C26478" Action="Warning" />
|
||||
<Rule Id="C26479" Action="Warning" />
|
||||
<Rule Id="C26495" Action="Warning" />
|
||||
<Rule Id="C26498" Action="Warning" />
|
||||
<Rule Id="C26800" Action="Warning" />
|
||||
<Rule Id="C26810" Action="Warning" />
|
||||
<Rule Id="C26811" Action="Warning" />
|
||||
<Rule Id="C26813" Action="Warning" />
|
||||
<Rule Id="C26815" Action="Warning" />
|
||||
<Rule Id="C26816" Action="Warning" />
|
||||
<Rule Id="C26817" Action="Warning" />
|
||||
<Rule Id="C26819" Action="Warning" />
|
||||
<Rule Id="C26820" Action="Warning" />
|
||||
<Rule Id="C26827" Action="Warning" />
|
||||
<Rule Id="C26828" Action="Warning" />
|
||||
<Rule Id="C26829" Action="Warning" />
|
||||
<Rule Id="C28020" Action="Warning" />
|
||||
<Rule Id="C28021" Action="Warning" />
|
||||
<Rule Id="C28022" Action="Warning" />
|
||||
<Rule Id="C28023" Action="Warning" />
|
||||
<Rule Id="C28024" Action="Warning" />
|
||||
<Rule Id="C28039" Action="Warning" />
|
||||
<Rule Id="C28112" Action="Warning" />
|
||||
<Rule Id="C28113" Action="Warning" />
|
||||
<Rule Id="C28125" Action="Warning" />
|
||||
<Rule Id="C28137" Action="Warning" />
|
||||
<Rule Id="C28138" Action="Warning" />
|
||||
<Rule Id="C28159" Action="Warning" />
|
||||
<Rule Id="C28160" Action="Warning" />
|
||||
<Rule Id="C28163" Action="Warning" />
|
||||
<Rule Id="C28164" Action="Warning" />
|
||||
<Rule Id="C28182" Action="Warning" />
|
||||
<Rule Id="C28183" Action="Warning" />
|
||||
<Rule Id="C28193" Action="Warning" />
|
||||
<Rule Id="C28196" Action="Warning" />
|
||||
<Rule Id="C28202" Action="Warning" />
|
||||
<Rule Id="C28203" Action="Warning" />
|
||||
<Rule Id="C28205" Action="Warning" />
|
||||
<Rule Id="C28206" Action="Warning" />
|
||||
<Rule Id="C28207" Action="Warning" />
|
||||
<Rule Id="C28209" Action="Warning" />
|
||||
<Rule Id="C28210" Action="Warning" />
|
||||
<Rule Id="C28211" Action="Warning" />
|
||||
<Rule Id="C28212" Action="Warning" />
|
||||
<Rule Id="C28213" Action="Warning" />
|
||||
<Rule Id="C28214" Action="Warning" />
|
||||
<Rule Id="C28215" Action="Warning" />
|
||||
<Rule Id="C28216" Action="Warning" />
|
||||
<Rule Id="C28217" Action="Warning" />
|
||||
<Rule Id="C28218" Action="Warning" />
|
||||
<Rule Id="C28219" Action="Warning" />
|
||||
<Rule Id="C28220" Action="Warning" />
|
||||
<Rule Id="C28221" Action="Warning" />
|
||||
<Rule Id="C28222" Action="Warning" />
|
||||
<Rule Id="C28223" Action="Warning" />
|
||||
<Rule Id="C28224" Action="Warning" />
|
||||
<Rule Id="C28225" Action="Warning" />
|
||||
<Rule Id="C28226" Action="Warning" />
|
||||
<Rule Id="C28227" Action="Warning" />
|
||||
<Rule Id="C28228" Action="Warning" />
|
||||
<Rule Id="C28229" Action="Warning" />
|
||||
<Rule Id="C28230" Action="Warning" />
|
||||
<Rule Id="C28231" Action="Warning" />
|
||||
<Rule Id="C28232" Action="Warning" />
|
||||
<Rule Id="C28233" Action="Warning" />
|
||||
<Rule Id="C28234" Action="Warning" />
|
||||
<Rule Id="C28235" Action="Warning" />
|
||||
<Rule Id="C28236" Action="Warning" />
|
||||
<Rule Id="C28237" Action="Warning" />
|
||||
<Rule Id="C28238" Action="Warning" />
|
||||
<Rule Id="C28239" Action="Warning" />
|
||||
<Rule Id="C28240" Action="Warning" />
|
||||
<Rule Id="C28241" Action="Warning" />
|
||||
<Rule Id="C28243" Action="Warning" />
|
||||
<Rule Id="C28244" Action="Warning" />
|
||||
<Rule Id="C28245" Action="Warning" />
|
||||
<Rule Id="C28246" Action="Warning" />
|
||||
<Rule Id="C28250" Action="Warning" />
|
||||
<Rule Id="C28251" Action="Warning" />
|
||||
<Rule Id="C28252" Action="Warning" />
|
||||
<Rule Id="C28253" Action="Warning" />
|
||||
<Rule Id="C28254" Action="Warning" />
|
||||
<Rule Id="C28262" Action="Warning" />
|
||||
<Rule Id="C28263" Action="Warning" />
|
||||
<Rule Id="C28267" Action="Warning" />
|
||||
<Rule Id="C28272" Action="Warning" />
|
||||
<Rule Id="C28273" Action="Warning" />
|
||||
<Rule Id="C28275" Action="Warning" />
|
||||
<Rule Id="C28279" Action="Warning" />
|
||||
<Rule Id="C28280" Action="Warning" />
|
||||
<Rule Id="C28282" Action="Warning" />
|
||||
<Rule Id="C28285" Action="Warning" />
|
||||
<Rule Id="C28286" Action="Warning" />
|
||||
<Rule Id="C28287" Action="Warning" />
|
||||
<Rule Id="C28288" Action="Warning" />
|
||||
<Rule Id="C28289" Action="Warning" />
|
||||
<Rule Id="C28290" Action="Warning" />
|
||||
<Rule Id="C28291" Action="Warning" />
|
||||
<Rule Id="C28300" Action="Warning" />
|
||||
<Rule Id="C28301" Action="Warning" />
|
||||
<Rule Id="C28302" Action="Warning" />
|
||||
<Rule Id="C28303" Action="Warning" />
|
||||
<Rule Id="C28304" Action="Warning" />
|
||||
<Rule Id="C28305" Action="Warning" />
|
||||
<Rule Id="C28306" Action="Warning" />
|
||||
<Rule Id="C28307" Action="Warning" />
|
||||
<Rule Id="C28308" Action="Warning" />
|
||||
<Rule Id="C28309" Action="Warning" />
|
||||
<Rule Id="C28350" Action="Warning" />
|
||||
<Rule Id="C28351" Action="Warning" />
|
||||
<Rule Id="C33001" Action="Warning" />
|
||||
<Rule Id="C33004" Action="Warning" />
|
||||
<Rule Id="C33005" Action="Warning" />
|
||||
<Rule Id="C33010" Action="Warning" />
|
||||
<Rule Id="C33011" Action="Warning" />
|
||||
<Rule Id="C33020" Action="Warning" />
|
||||
<Rule Id="C6001" Action="Warning" />
|
||||
<Rule Id="C6011" Action="Warning" />
|
||||
<Rule Id="C6029" Action="Warning" />
|
||||
<Rule Id="C6031" Action="Warning" />
|
||||
<Rule Id="C6053" Action="Warning" />
|
||||
<Rule Id="C6054" Action="Warning" />
|
||||
<Rule Id="C6059" Action="Warning" />
|
||||
<Rule Id="C6063" Action="Warning" />
|
||||
<Rule Id="C6064" Action="Warning" />
|
||||
<Rule Id="C6066" Action="Warning" />
|
||||
<Rule Id="C6067" Action="Warning" />
|
||||
<Rule Id="C6101" Action="Warning" />
|
||||
<Rule Id="C6200" Action="Warning" />
|
||||
<Rule Id="C6201" Action="Warning" />
|
||||
<Rule Id="C6214" Action="Warning" />
|
||||
<Rule Id="C6215" Action="Warning" />
|
||||
<Rule Id="C6216" Action="Warning" />
|
||||
<Rule Id="C6217" Action="Warning" />
|
||||
<Rule Id="C6220" Action="Warning" />
|
||||
<Rule Id="C6226" Action="Warning" />
|
||||
<Rule Id="C6230" Action="Warning" />
|
||||
<Rule Id="C6235" Action="Warning" />
|
||||
<Rule Id="C6236" Action="Warning" />
|
||||
<Rule Id="C6237" Action="Warning" />
|
||||
<Rule Id="C6242" Action="Warning" />
|
||||
<Rule Id="C6248" Action="Warning" />
|
||||
<Rule Id="C6250" Action="Warning" />
|
||||
<Rule Id="C6255" Action="Warning" />
|
||||
<Rule Id="C6258" Action="Warning" />
|
||||
<Rule Id="C6259" Action="Warning" />
|
||||
<Rule Id="C6260" Action="Warning" />
|
||||
<Rule Id="C6262" Action="Warning" />
|
||||
<Rule Id="C6263" Action="Warning" />
|
||||
<Rule Id="C6268" Action="Warning" />
|
||||
<Rule Id="C6269" Action="Warning" />
|
||||
<Rule Id="C6270" Action="Warning" />
|
||||
<Rule Id="C6271" Action="Warning" />
|
||||
<Rule Id="C6272" Action="Warning" />
|
||||
<Rule Id="C6273" Action="Warning" />
|
||||
<Rule Id="C6274" Action="Warning" />
|
||||
<Rule Id="C6276" Action="Warning" />
|
||||
<Rule Id="C6277" Action="Warning" />
|
||||
<Rule Id="C6278" Action="Warning" />
|
||||
<Rule Id="C6279" Action="Warning" />
|
||||
<Rule Id="C6280" Action="Warning" />
|
||||
<Rule Id="C6281" Action="Warning" />
|
||||
<Rule Id="C6282" Action="Warning" />
|
||||
<Rule Id="C6283" Action="Warning" />
|
||||
<Rule Id="C6284" Action="Warning" />
|
||||
<Rule Id="C6285" Action="Warning" />
|
||||
<Rule Id="C6286" Action="Warning" />
|
||||
<Rule Id="C6287" Action="Warning" />
|
||||
<Rule Id="C6288" Action="Warning" />
|
||||
<Rule Id="C6289" Action="Warning" />
|
||||
<Rule Id="C6290" Action="Warning" />
|
||||
<Rule Id="C6291" Action="Warning" />
|
||||
<Rule Id="C6292" Action="Warning" />
|
||||
<Rule Id="C6293" Action="Warning" />
|
||||
<Rule Id="C6294" Action="Warning" />
|
||||
<Rule Id="C6295" Action="Warning" />
|
||||
<Rule Id="C6296" Action="Warning" />
|
||||
<Rule Id="C6297" Action="Warning" />
|
||||
<Rule Id="C6299" Action="Warning" />
|
||||
<Rule Id="C6302" Action="Warning" />
|
||||
<Rule Id="C6303" Action="Warning" />
|
||||
<Rule Id="C6305" Action="Warning" />
|
||||
<Rule Id="C6306" Action="Warning" />
|
||||
<Rule Id="C6308" Action="Warning" />
|
||||
<Rule Id="C6310" Action="Warning" />
|
||||
<Rule Id="C6312" Action="Warning" />
|
||||
<Rule Id="C6314" Action="Warning" />
|
||||
<Rule Id="C6317" Action="Warning" />
|
||||
<Rule Id="C6318" Action="Warning" />
|
||||
<Rule Id="C6319" Action="Warning" />
|
||||
<Rule Id="C6324" Action="Warning" />
|
||||
<Rule Id="C6328" Action="Warning" />
|
||||
<Rule Id="C6331" Action="Warning" />
|
||||
<Rule Id="C6332" Action="Warning" />
|
||||
<Rule Id="C6333" Action="Warning" />
|
||||
<Rule Id="C6335" Action="Warning" />
|
||||
<Rule Id="C6381" Action="Warning" />
|
||||
<Rule Id="C6383" Action="Warning" />
|
||||
<Rule Id="C6384" Action="Warning" />
|
||||
<Rule Id="C6385" Action="Warning" />
|
||||
<Rule Id="C6386" Action="Warning" />
|
||||
<Rule Id="C6387" Action="Warning" />
|
||||
<Rule Id="C6388" Action="Warning" />
|
||||
<Rule Id="C6500" Action="Warning" />
|
||||
<Rule Id="C6501" Action="Warning" />
|
||||
<Rule Id="C6503" Action="Warning" />
|
||||
<Rule Id="C6504" Action="Warning" />
|
||||
<Rule Id="C6505" Action="Warning" />
|
||||
<Rule Id="C6506" Action="Warning" />
|
||||
<Rule Id="C6508" Action="Warning" />
|
||||
<Rule Id="C6509" Action="Warning" />
|
||||
<Rule Id="C6510" Action="Warning" />
|
||||
<Rule Id="C6511" Action="Warning" />
|
||||
<Rule Id="C6513" Action="Warning" />
|
||||
<Rule Id="C6514" Action="Warning" />
|
||||
<Rule Id="C6515" Action="Warning" />
|
||||
<Rule Id="C6516" Action="Warning" />
|
||||
<Rule Id="C6517" Action="Warning" />
|
||||
<Rule Id="C6518" Action="Warning" />
|
||||
<Rule Id="C6522" Action="Warning" />
|
||||
<Rule Id="C6525" Action="Warning" />
|
||||
<Rule Id="C6527" Action="Warning" />
|
||||
<Rule Id="C6530" Action="Warning" />
|
||||
<Rule Id="C6540" Action="Warning" />
|
||||
<Rule Id="C6551" Action="Warning" />
|
||||
<Rule Id="C6552" Action="Warning" />
|
||||
<Rule Id="C6701" Action="Warning" />
|
||||
<Rule Id="C6702" Action="Warning" />
|
||||
<Rule Id="C6703" Action="Warning" />
|
||||
<Rule Id="C6704" Action="Warning" />
|
||||
<Rule Id="C6705" Action="Warning" />
|
||||
<Rule Id="C6706" Action="Warning" />
|
||||
<Rule Id="C6995" Action="Warning" />
|
||||
<Rule Id="C6997" Action="Warning" />
|
||||
</Rules>
|
||||
</RuleSet>
|
@ -0,0 +1,5 @@
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<CodeAnalysisRuleset>@CMAKE_SOURCE_DIR@/scripts/static-code-analysis/msvc-code-analysis.ruleset</CodeAnalysisRuleset>
|
||||
</PropertyGroup>
|
||||
</Project>
|
Loading…
Reference in New Issue
Block a user