Powered By Blogger

Sunday, September 14, 2014

StyleCop Integration with csproj and MSBuild

StyleCop Integration with csproj and MSBuild.

Step 1. Install StyleCope 4.7
Step 2: Update .csproj by adding 
                <Import Project="$(ProgramFiles)\MSBuild\StyleCop\v4.7\StyleCop.Targets" />
                ----------------
                </Project>
Step 3: Add the below Tag under   <PropertyGroup> to Treat Stylecop Warnings as Errors
<StyleCopTreatErrorsAsWarnings>false</StyleCopTreatErrorsAsWarnings>
                </PropertyGroup>
Step 4: By default, the "Merge with settings file found in parent folders" option is selected. StyleCop will continue searching above the current directory for additional parent settings files.


Step 5: Rather than merging with a settings file found within a parent directory, it is also possible to provide an explicit link to another settings file to merge with.


Step 6: Build csproj with MSBuild:


NOTE: If we are implementing Stylecop, we should edit all csproj before building the same. also there is no direct logging mechanism for StyleCop.
So Personally I will recommend FxCop instead of StyleCop.

SAP ABAP static code analysis using Fortify SCA

Description: ABAP is one of the many application-specific fourth-generation languages. It was originally the report language for SAP R/2, a platform that enabled large corporations to build mainframe business applications for materials management and financial and management accounting.

Our Problem: Whether Fortify supports ABAP?
Yes, Fortify Supports ABAP.
How we can achive and create Fortify Reports?
get .abap files to be scanned. If you are getting txt files, then change the extension to .abap.
Now apply below commandlines to generate frp.


"C:\Program Files\HP_Fortify\HP_Fortify_SCA_and_Apps_4.00\bin\sourceanalyzer.exe" -b abapSample -clean

"C:\Program Files\HP_Fortify\HP_Fortify_SCA_and_Apps_4.00\bin\sourceanalyzer.exe" -b abapSample myABAPfile.abap


"C:\Program Files\HP_Fortify\HP_Fortify_SCA_and_Apps_4.00\bin\sourceanalyzer.exe" -b abapSample -scan -f myABAPfile.fpr

From .frp file, you can generate Report as xml and  pdf files.

"C:\Program Files\HP_Fortify\HP_Fortify_SCA_and_Apps_4.00\bin\ReportGenerator.bat" -format xml -f "myABAPfile_Report.xml" -source  “myABAPfile.fpr"

"C:\Program Files\HP_Fortify\HP_Fortify_SCA_and_Apps_4.00\bin\ReportGenerator.bat" -format pdf -f "myABAPfile_Security_Report.pdf" -source "myABAPfile.fpr"

"C:\Program Files\HP_Fortify\HP_Fortify_SCA_and_Apps_4.00\bin\ReportGenerator.bat" -format pdf -template "C:\Program Files\HP_Fortify\HP_Fortify_SCA_and_Apps_4.00\Core\config\reports\DeveloperWorkbook.xml" -f "myABAPfile_Developer_Workbook.pdf" -source "myABAPfile.fpr"

"C:\Program Files\HP_Fortify\HP_Fortify_SCA_and_Apps_4.00\bin\ReportGenerator.bat" -format pdf -template "C:\Program Files\HP_Fortify\HP_Fortify_SCA_and_Apps_4.00\Core\config\reports\ScanReport.xml" -f "myABAPfile_Scan_Summary.pdf" -source "myABAPfile.fpr"