diff --git a/.vs/VSWorkspaceState.json b/.vs/VSWorkspaceState.json
new file mode 100644
index 00000000..2f6e438b
--- /dev/null
+++ b/.vs/VSWorkspaceState.json
@@ -0,0 +1,23 @@
+{
+ "ExpandedNodes": [
+ "",
+ "\\project",
+ "\\project\\dexter-cs",
+ "\\project\\dexter-cs\\DexterCRC",
+ "\\project\\dexter-cs\\DexterCRC\\Resource",
+ "\\project\\dexter-cs\\DexterCRC\\Src",
+ "\\project\\dexter-cs\\DexterCRC\\Src\\Util",
+ "\\project\\dexter-cs\\DexterCS",
+ "\\project\\dexter-cs\\DexterCSTest",
+ "\\project\\dexter-cs\\DexterCSTest\\Src",
+ "\\project\\dexter-cs\\DexterCSTest\\Src\\CheckerLogic",
+ "\\project\\dexter-cs\\DexterCS\\Src",
+ "\\project\\dexter-cs\\DexterCS\\Src\\Client",
+ "\\project\\dexter-cs\\DexterCS\\Src\\Util",
+ "\\project\\dexter-cs\\DexterDepend",
+ "\\project\\dexter-cs\\DexterDepend\\Src",
+ "\\project\\dexter-cs\\DexterDepend\\Src\\CheckerLogic"
+ ],
+ "SelectedNode": "\\project\\dexter-cs\\DexterCSTest\\Src\\CheckerLogic\\MethodSpacingTests.cs",
+ "PreviewInSolutionExplorer": false
+}
\ No newline at end of file
diff --git a/.vs/slnx.sqlite b/.vs/slnx.sqlite
new file mode 100644
index 00000000..42e6be1e
Binary files /dev/null and b/.vs/slnx.sqlite differ
diff --git a/README.md b/README.md
index c7b784a7..43bd593c 100644
--- a/README.md
+++ b/README.md
@@ -1,63 +1,175 @@
-# Dexter
-Dexter helps you to improve coding skills. Whenever you save a source file, Dexter analyzes it and shows its improvements point on your editor in real-time.
+# Dexter
+The **DE**fect e**XTER**minator
-## Who needs Dexter?
-- A developer who sometimes forgets to check code quality (just like me !)
-- A developer who needs a peer reviewer (but you are shy)
-- A S/W engineering team member who wants to improve developers' code quality without annoying
-- A static analysis engine developer who needs UI and server-side features
+**Dexter is a static analysis tool** for detecting and removing defects
+and improving code quality even before a third party review.
+In addition, Dexter allows storing the analysis results on Dexter Server
+and using customized checkers as plugins. You can code safely now!
-## Links
-- [Dexter Introduction Video(4min)](https://youtu.be/86exIHcwi6c)
+
+
+Table of contents
+
+
+
+
+
+
+Disclaimer
+
+
+GitHub no longer supports Internet Explorer, neither does this page.
+If anything is displayed incorrectly, illegibly, not at all etc.
+please make sure that you are using one of the
+supported browsers.
+
+
+
+## How does it work?
+
+
+
+Whenever you commission the scrutiny
+(manually or after saving the file - it's configurable)
+Dexter performs the analysis on a scope of a file, project or solution.
+It checks only the appropriate files (e.g. *.cs for C#)
+and shows you directly in code where the **defects** may appear.
+
+
+Psst! If you've already found the mistake in the code above,
+perhaps you should think of contributing to Dexter?
+
+## Defects? Same as IDE hints?
+
+
+
+**Not exactly**.
+What Dexter finds are not the obvious errors that any IDE can find.
+It looks for defects as trivial as possible "array index out of bounds"
+up to less anticipated like "usleep misuse" (see [the full list of checkers here](https://dexter.atlassian.net/wiki/spaces/DW/pages/3211284/Checker+List)).
+
+## Ok, but do YOU need Dexter?
+
+
+
+**You would definitely benefit from having Dexter if**
+you fall into any of the categories:
+
+
A coder who hates coding gremlins
+
A developer who is so passionate about coding that sometimes forget about quality (we all do!)
+
A developer who needs a peer reviewer (but is to shy to ask)
+
A software engineer who wants to elevate the rank of their code
+
A static analysis engine developer who needs UI and server-side features
+
+
+However, *you do not need Dexter* if you are a developer
+and you find yourself in one of these groups:
+
+
+
+
+
+## What IDEs does Dexter support?
+Dexter supports the most popular programming Environments and also provides a CLI version for you to use!
+
+
+
+See which ones!
+
+
+
+
+**Eclipse** IDE for Java (Kepler 4.3 and highers)
+
+
+
+**Microsoft Visual Studio** (2017 and higher) for C#
+
+
+
+**Source Insight** for C/C++ (3.50.0072+)
+
+
+
+**CLI** - yes, command-line interface is not an IDE, but you can also execute Dexter from it (Jenkins, other editors)
+
+
+## Where can I find more?
+
+
+
+There are two ways to find out more about Dexter...
+
+
+For much more detailed information and a rich Dexter resource please refer to Dexter Wiki at Atlassian:
- [Dexter Wiki (How to install/Use)](https://dexter.atlassian.net)
-## Downloads (ver. 0.10.6, 20. Oct. 2016)
+...and in the mean time check out the (old but gold) video about Dexter!
+- [Dexter Introduction Video (4min)](https://youtu.be/86exIHcwi6c)
+
+
+## Download Dexter now!
+
+
+Latest Version 0.10.6 (20. Oct. 2016)
+
#### Eclipse Update Site
-##### Eclipse JAVA+CPP
-- Win 32bit: http://dl.bintray.com/minho/dexter-eclipse-32
-- Win 64bit: http://dl.bintray.com/minho/dexter-eclipse-64
-#####Eclipse JAVA
-- Win 32bit: http://dl.bintray.com/minho/dexter-eclipse-java-32
-- Win 64bit: http://dl.bintray.com/minho/dexter-eclipse-java-64
+##### Eclipse JAVA+CPP
+- Win [32bit](http://dl.bintray.com/minho/dexter-eclipse-32)
+ / [64bit](http://dl.bintray.com/minho/dexter-eclipse-64)
-#####Eclipse C/C++
-- Win 32bit: http://dl.bintray.com/minho/dexter-eclipse-cpp-32
-- Win 64bit: http://dl.bintray.com/minho/dexter-eclipse-cpp-64
+##### Eclipse JAVA
+- Win [32bit](http://dl.bintray.com/minho/dexter-eclipse-java-32)
+ / [64bit](http://dl.bintray.com/minho/dexter-eclipse-java-64)
-#####Tizen SDK
-- Win 32bit: http://dl.bintray.com/minho/dexter-tizen-sdk-32
-- Win 64bit: http://dl.bintray.com/minho/dexter-tizen-sdk-64
+##### Eclipse C/C++
+- Win [32bit](http://dl.bintray.com/minho/dexter-eclipse-cpp-32)
+ /[64bit](http://dl.bintray.com/minho/dexter-eclipse-cpp-64)
+##### Tizen SDK
+- Win [32bit](http://dl.bintray.com/minho/dexter-tizen-sdk-32)
+ / [64bit](http://dl.bintray.com/minho/dexter-tizen-sdk-64)
#### Dexter Daemon for Source Insight
-- [Win 32bit](https://dexter.atlassian.net/wiki/download/attachments/6258746/dexter-daemon_0.10.6_32.zip?api=v2)
-- [Win 64bit](https://dexter.atlassian.net/wiki/download/attachments/6258746/dexter-daemon_0.10.6_64.zip?api=v2)
+- Win [32bit](https://dexter.atlassian.net/wiki/download/attachments/6258746/dexter-daemon_0.10.6_32.zip?api=v2)
+/ [64bit](https://dexter.atlassian.net/wiki/download/attachments/6258746/dexter-daemon_0.10.6_64.zip?api=v2)
+
#### Dexter CLI
-- [Win/Linux/Mac 32bit](https://dexter.atlassian.net/wiki/download/attachments/6258746/dexter-cli_0.10.6_32.zip?api=v2)
-- [Win/Linux/Mac 64bit](https://dexter.atlassian.net/wiki/download/attachments/6258746/dexter-cli_0.10.6_64.zip?api=v2)
+- Win/Linux/Mac [32bit](https://dexter.atlassian.net/wiki/download/attachments/6258746/dexter-cli_0.10.6_32.zip?api=v2)
+ / [64bit](https://dexter.atlassian.net/wiki/download/attachments/6258746/dexter-cli_0.10.6_64.zip?api=v2)
#### Dexter Server
- [Win/Linux/Mac](https://dexter.atlassian.net/wiki/download/attachments/6258746/dexter-server_0.10.6.zip?api=v2)
#### Dexter Monitor
- [Win/Linux/Mac](https://dexter.atlassian.net/wiki/download/attachments/6258746/dexter-monitor_0.10.6.zip?api=v2)
-
-## Supports
-- Eclipse IDE for Java language (Kepler 4.3+)
-- Source Insight for C/C++ (3.50.0072+)
-- CLI for executing by a script (Jenkins, other editors)
-
-## Concepts
-Dexter is a static analysis platform to find and remove defects efficiently and immediately during the coding-time. In addition, Dexter saves your learning cost because it contains multiple static analysis tools as a plug-in type.
+
-![](https://github.com/Samsung/Dexter/blob/master/wiki/image/overview.png)
+# Contribution
+Dexter is fully open source so do not hesitate to explore the deepest guts of it
+and we heartfully invite you to contribute.
+Simply check the "How to build" below and setup your first self-made instance of Dexter.
+Then - if you are feeling brave and creative - just hit us with a clever GitHub Pull Request!
# How to build
-(refer to detailed document : https://github.com/Samsung/Dexter/blob/master/doc/Dexter_Build_Guide.pdf)
+***For mighty developers!***
+
+**Check out the detailed document** at https://github.com/Samsung/Dexter/blob/master/doc/Dexter_Build_Guide.pdf
+
+
+
+... or see the general steps!
+
## Prerequisites
- Install JDK 7 update 40+
@@ -67,75 +179,102 @@ Dexter is a static analysis platform to find and remove defects efficiently and
- Download Dexter Source Codes (https://github.com/Samsung/Dexter)
## Import Dexter Projects into Eclipse
-- run with suffice memory (in eclipse.ini) : -Xmx1024m --launcher.XXMaxPermSize256m
-- make sure your text file encoding setting is 'UTF-8' : eclipse > Preferences > General > Workspace
+- run with sufficient memory (in eclipse.ini) : -Xmx1024m --launcher.XXMaxPermSize256m
+- make sure your text file encoding setting is 'UTF-8' : Eclipse > Preferences > General > Workspace
- import Dexter Projects that you already downloaded except dexter-server project
- use 'gradle build' command in a command line console : '/project' folder
-- refresh all projects in eclipse, then all errors will be gone
+- refresh all projects in eclipse, then all errors should disapear
## Build Dexter CLI
- use ant script on build-install.xml file in dexter-executor project
- you can see the 'dexter-cli_#.#.#_bit.zip file in dexter-executor/install folder
-- after unzip this file, you can run dexter in a command line: unzip-folder/bin/dexter.bat or dexter.sh
-- before you run dexter.bat file, you have to set dexter_cfg.json file to set the scope of analysis (refer to dexter_cfg.json.help file)
+- after unzipping this file, you can run dexter in a command line: unzip-folder/bin/dexter.bat or dexter.sh
+- before running dexter.bat file, you have to set dexter_cfg.json file to set the scope of analysis (refer to dexter_cfg.json.help file)
## Build Dexter Daemon for source insight
- open dexter-daemon.product file in dexter-daemon project
- click 'Eclipse Product export wizard' link on the 'Exporting' tab in a editor
-- set the fields - Root direoct:dexter-daemon Destination/Directory: your directory
+- set the fields - Root directory:dexter-daemon Destination/Directory: your directory
- click "Finish" button
-- check export folder, there will be dexter-daemon folder
-- run dexter.exe file, then you can see the login dialog
-- check 'Run in Standalong mode', then you can run dexter without Dexter Server
-- run source insight, and open 'Base' project
-- add 'project/script/dexter.em' macro file into 'Base' project
+- check export folder, it should contain dexter-daemon folder
+- run dexter.exe, then you can see the login dialog
+- check 'Run in Standalone mode' (running Dexter without Dexter Server)
+- run Source Insight, and open 'Base' project
+- add 'project/script/dexter.em' macro file to 'Base' project
- after editing and saving your source file, you will see the result of analysis in your editor and Dexter Daemon
## Build Dexter Eclipse Plugins
-- create feature project in your eclipse
-- include all of dexter projects witout dexter-daemon and dexter-cppcheck project
+- create a Feature project in Eclipse
+- include all of Dexter projects without dexter-daemon and dexter-cppcheck projects
- create update site on the feature.xml file
- include your feature and build all, then you will see the feature and plugins folders in you update project
-- you can make a update site or just copy plugin folder into your new eclipse
+- you can make an update site or just copy plugin folder into your new Eclipse
- then, you can use Dexter
## Build Dexter Visual Studio Plugin
-In order to build a plugin for Visual Studio you need following prerequisites:
+In order to build a plugin for Visual Studio you need what follows:
- Microsoft Visual Studio 2013 or newer
- Microsoft Visual Studio SDK (2013 or newer)
- (Optionally) NUnit3 Test Adapter (Visual Studio Extension) - for executing unit tests
To build a plugin:
-- open a solution file "dexter-vs.sln" located in project/dexter-vs directory.
-- right click on "Build/Rebuild dexter-vs". NuGet will download all required dependencies and Visual Studio will rebuild you project.
+- open a solution file "dexter-vs.sln" located in project/dexter-vs directory
+- right click on "Build/Rebuild dexter-vs". NuGet will download all required dependencies and Visual Studio will rebuild you project
- after this, you should have a self-installing extension file "dexter.vsix" located in "dexter-vs/bin/{ConfigurationName}"
-- you can install an extension by double clicking it.
+- you can install an extension by double clicking it
-The most convenient way to debug this plugin is to use an Experimental Instance of Visual Studio.
-- go to "Project/dexter-vs Properties..." and then go to "Debug" tab.
-- select "Start external program:" and provide path to Visual Studio executable (devenv.exe).
-- enter in "Command line arguments" value "/RootSuffix Exp".
+The most convenient way to debug this plugin is to use an Experimental Instance of Visual Studio
+- go to the "Project/dexter-vs Properties..." and then go to the "Debug" tab
+- select "Start external program:" and provide path to Visual Studio executable (devenv.exe)
+- enter "/RootSuffix Exp" in "Command line arguments"
- save your changes
-- run a project (F5).
-- it should start Visual Studio Experimental Instance with dexter-vs installed as an extension.
+- run a project (F5)
+- it should start Visual Studio Experimental Instance with dexter-vs installed as an extension
-# Future Plan
-## support more languages
-- JavaScript
+
-## support more IDEs
-- Tizen SDK
-- WebStorm
-- Android Studio
-- Enhance Source Insight
+# Future plans
+
+
Supporting more languages
+
+
JavaScript
+
+
-## support more Static Analysis Open Source
-- Java: PMD, Checkstyle, etc.
-- JavaScript: Flow, JSHint
-- Custom Checkers
+
+
Supporting more IDEs
+
+
Tizen SDK
+
WebStorm
+
Android Studio
+
Enhance Source Insight
+
+
-## Dexter Web Monitor for organization(SE)
-- TBD
+
+
Support for more Static Analysis Open Source tools
+
+
Java: PMD, Checkstyle, etc.
+
JavaScript: Flow, JSHint
+
Custom Checkers
+
+
+
+
+
Dexter Web Monitor for organizations (SE)
+
+
TBD
+
+
# License
-Dexter is BSD-licensed.
+Dexter is fully open source and BSD-licensed. See [the full license](../master/LICENSE) (it's really short, even we've read it).
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/project/dexter-cs/.gitignore b/project/dexter-cs/.gitignore
new file mode 100644
index 00000000..4f21f62e
--- /dev/null
+++ b/project/dexter-cs/.gitignore
@@ -0,0 +1,245 @@
+## Ignore Visual Studio temporary files, build results, and
+## files generated by popular Visual Studio add-ons.
+
+# User-specific files
+*.suo
+*.user
+*.userosscache
+*.sln.docstates
+
+# User-specific files (MonoDevelop/Xamarin Studio)
+*.userprefs
+
+# Build results
+[Dd]ebug/
+[Dd]ebugPublic/
+[Rr]elease/
+[Rr]eleases/
+x64/
+x86/
+bld/
+[Bb]in/
+[Oo]bj/
+[Ll]og/
+
+# Visual Studio 2015 cache/options directory
+.vs/
+# Uncomment if you have tasks that create the project's static files in wwwroot
+#wwwroot/
+
+# MSTest test Results
+[Tt]est[Rr]esult*/
+[Bb]uild[Ll]og.*
+
+# NUNIT
+*.VisualState.xml
+TestResult.xml
+
+# Build Results of an ATL Project
+[Dd]ebugPS/
+[Rr]eleasePS/
+dlldata.c
+
+# DNX
+project.lock.json
+artifacts/
+
+*_i.c
+*_p.c
+*_i.h
+*.ilk
+*.meta
+*.obj
+*.pch
+*.pdb
+*.pgc
+*.pgd
+*.rsp
+*.sbr
+*.tlb
+*.tli
+*.tlh
+*.tmp
+*.tmp_proj
+*.log
+*.vspscc
+*.vssscc
+.builds
+*.pidb
+*.svclog
+*.scc
+
+# Chutzpah Test files
+_Chutzpah*
+
+# Visual C++ cache files
+ipch/
+*.aps
+*.ncb
+*.opendb
+*.opensdf
+*.sdf
+*.cachefile
+
+# Visual Studio profiler
+*.psess
+*.vsp
+*.vspx
+*.sap
+
+# TFS 2012 Local Workspace
+$tf/
+
+# Guidance Automation Toolkit
+*.gpState
+
+# ReSharper is a .NET coding add-in
+_ReSharper*/
+*.[Rr]e[Ss]harper
+*.DotSettings.user
+
+# JustCode is a .NET coding add-in
+.JustCode
+
+# TeamCity is a build add-in
+_TeamCity*
+
+# DotCover is a Code Coverage Tool
+*.dotCover
+
+# NCrunch
+_NCrunch_*
+.*crunch*.local.xml
+nCrunchTemp_*
+
+# MightyMoose
+*.mm.*
+AutoTest.Net/
+
+# Web workbench (sass)
+.sass-cache/
+
+# Installshield output folder
+[Ee]xpress/
+
+# DocProject is a documentation generator add-in
+DocProject/buildhelp/
+DocProject/Help/*.HxT
+DocProject/Help/*.HxC
+DocProject/Help/*.hhc
+DocProject/Help/*.hhk
+DocProject/Help/*.hhp
+DocProject/Help/Html2
+DocProject/Help/html
+
+# Click-Once directory
+publish/
+
+# Publish Web Output
+*.[Pp]ublish.xml
+*.azurePubxml
+# TODO: Comment the next line if you want to checkin your web deploy settings
+# but database connection strings (with potential passwords) will be unencrypted
+*.pubxml
+*.publishproj
+
+# NuGet Packages
+*.nupkg
+# The packages folder can be ignored because of Package Restore
+**/packages/*
+# except build/, which is used as an MSBuild target.
+!**/packages/build/
+# Uncomment if necessary however generally it will be regenerated when needed
+#!**/packages/repositories.config
+# NuGet v3's project.json files produces more ignoreable files
+*.nuget.props
+*.nuget.targets
+
+# Microsoft Azure Build Output
+csx/
+*.build.csdef
+
+# Microsoft Azure Emulator
+ecf/
+rcf/
+
+# Windows Store app package directories and files
+AppPackages/
+BundleArtifacts/
+Package.StoreAssociation.xml
+_pkginfo.txt
+
+# Visual Studio cache files
+# files ending in .cache can be ignored
+*.[Cc]ache
+# but keep track of directories ending in .cache
+!*.[Cc]ache/
+
+# Others
+ClientBin/
+~$*
+*~
+*.dbmdl
+*.dbproj.schemaview
+*.pfx
+*.publishsettings
+node_modules/
+orleans.codegen.cs
+
+# Since there are multiple workflows, uncomment next line to ignore bower_components
+# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
+#bower_components/
+
+# RIA/Silverlight projects
+Generated_Code/
+
+# Backup & report files from converting an old project file
+# to a newer Visual Studio version. Backup files are not needed,
+# because we have git ;-)
+_UpgradeReport_Files/
+Backup*/
+UpgradeLog*.XML
+UpgradeLog*.htm
+
+# SQL Server files
+*.mdf
+*.ldf
+
+# Business Intelligence projects
+*.rdl.data
+*.bim.layout
+*.bim_*.settings
+
+# Microsoft Fakes
+FakesAssemblies/
+
+# GhostDoc plugin setting file
+*.GhostDoc.xml
+
+# Node.js Tools for Visual Studio
+.ntvs_analysis.dat
+
+# Visual Studio 6 build log
+*.plg
+
+# Visual Studio 6 workspace options file
+*.opt
+
+# Visual Studio LightSwitch build output
+**/*.HTMLClient/GeneratedArtifacts
+**/*.DesktopClient/GeneratedArtifacts
+**/*.DesktopClient/ModelManifest.xml
+**/*.Server/GeneratedArtifacts
+**/*.Server/ModelManifest.xml
+_Pvt_Extensions
+
+# Paket dependency manager
+.paket/paket.exe
+paket-files/
+
+# FAKE - F# Make
+.fake/
+
+# JetBrains Rider
+.idea/
+*.sln.iml
\ No newline at end of file
diff --git a/project/dexter-cs/DexterCRC/App.config b/project/dexter-cs/DexterCRC/App.config
new file mode 100644
index 00000000..8584e733
--- /dev/null
+++ b/project/dexter-cs/DexterCRC/App.config
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/project/dexter-cs/DexterCRC/DexterCRC.csproj b/project/dexter-cs/DexterCRC/DexterCRC.csproj
new file mode 100644
index 00000000..40a23c86
--- /dev/null
+++ b/project/dexter-cs/DexterCRC/DexterCRC.csproj
@@ -0,0 +1,231 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {933D5E52-7521-4941-ACAC-B2DACA3AEDAC}
+ Library
+ Properties
+ DexterCRC
+ DexterCRC
+ v4.7.1
+ 512
+ true
+
+
+
+
+
+ AnyCPU
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ AnyCPU
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+
+
+
+ ..\packages\log4net.2.0.8\lib\net45-full\log4net.dll
+ True
+
+
+ ..\packages\Microsoft.CodeAnalysis.Common.1.1.0\lib\net45\Microsoft.CodeAnalysis.dll
+
+
+ ..\packages\Microsoft.CodeAnalysis.CSharp.1.1.0\lib\net45\Microsoft.CodeAnalysis.CSharp.dll
+
+
+ ..\packages\Microsoft.CodeAnalysis.CSharp.Workspaces.1.1.0\lib\net45\Microsoft.CodeAnalysis.CSharp.Workspaces.dll
+
+
+ ..\packages\Microsoft.CodeAnalysis.VisualBasic.1.1.0\lib\net45\Microsoft.CodeAnalysis.VisualBasic.dll
+
+
+ ..\packages\Microsoft.CodeAnalysis.VisualBasic.Workspaces.1.1.0\lib\net45\Microsoft.CodeAnalysis.VisualBasic.Workspaces.dll
+
+
+ ..\packages\Microsoft.CodeAnalysis.Workspaces.Common.1.1.0\lib\net45\Microsoft.CodeAnalysis.Workspaces.dll
+
+
+ ..\packages\Microsoft.CodeAnalysis.Workspaces.Common.1.1.0\lib\net45\Microsoft.CodeAnalysis.Workspaces.Desktop.dll
+
+
+ ..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.3\lib\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll
+ True
+
+
+ ..\packages\Newtonsoft.Json.4.5.11\lib\net40\Newtonsoft.Json.dll
+ True
+
+
+ ..\packages\OpenNLP.1.3.4\lib\net45\OpenNLP.dll
+
+
+ ..\packages\OpenNLP.1.3.4\lib\net45\SharpEntropy.dll
+
+
+
+ ..\packages\System.Collections.Immutable.1.1.37\lib\dotnet\System.Collections.Immutable.dll
+ True
+
+
+ ..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.AttributedModel.dll
+ True
+
+
+ ..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.Convention.dll
+ True
+
+
+ ..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.Hosting.dll
+ True
+
+
+ ..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.Runtime.dll
+ True
+
+
+ ..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.TypedParts.dll
+ True
+
+
+
+ ..\packages\System.Linq.4.3.0\lib\net463\System.Linq.dll
+ True
+
+
+
+ ..\packages\Microsoft.AspNet.WebApi.Client.5.2.0\lib\net45\System.Net.Http.Formatting.dll
+ True
+
+
+ ..\packages\System.Reflection.Metadata.1.2.0\lib\portable-net45+win8\System.Reflection.Metadata.dll
+ True
+
+
+ ..\packages\Microsoft.AspNet.WebApi.Core.5.2.0\lib\net45\System.Web.Http.dll
+ True
+
+
+ ..\packages\Microsoft.AspNet.WebApi.WebHost.5.2.0\lib\net45\System.Web.Http.WebHost.dll
+ True
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ True
+ True
+ Resources.resx
+
+
+
+
+
+
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+ Designer
+
+
+
+ Designer
+
+
+
+
+
+
+
+ {0fefcf8d-0a75-40f1-beec-21be6e483c48}
+ DexterCS
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 이 프로젝트는 이 컴퓨터에 없는 NuGet 패키지를 참조합니다. 해당 패키지를 다운로드하려면 NuGet 패키지 복원을 사용하십시오. 자세한 내용은 http://go.microsoft.com/fwlink/?LinkID=322105를 참조하십시오. 누락된 파일은 {0}입니다.
+
+
+
+
+
+
\ No newline at end of file
diff --git a/project/dexter-cs/DexterCRC/Properties/AssemblyInfo.cs b/project/dexter-cs/DexterCRC/Properties/AssemblyInfo.cs
new file mode 100644
index 00000000..9f090bd5
--- /dev/null
+++ b/project/dexter-cs/DexterCRC/Properties/AssemblyInfo.cs
@@ -0,0 +1,45 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using System.Reflection;
+using System.Runtime.InteropServices;
+
+[assembly: AssemblyTitle("DexterCRC")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("DexterCRC")]
+[assembly: AssemblyCopyright("")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+[assembly: ComVisible(false)]
+
+[assembly: Guid("933d5e52-7521-4941-acac-b2daca3aedac")]
+
+[assembly: AssemblyVersion("0.0.1.0")]
+[assembly: AssemblyFileVersion("0.0.1.0")]
diff --git a/project/dexter-cs/DexterCRC/Properties/Resources.Designer.cs b/project/dexter-cs/DexterCRC/Properties/Resources.Designer.cs
new file mode 100644
index 00000000..ed8525eb
--- /dev/null
+++ b/project/dexter-cs/DexterCRC/Properties/Resources.Designer.cs
@@ -0,0 +1,63 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.42000
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace DexterCRC.Properties {
+ using System;
+
+
+ ///
+ /// A strongly-typed resource class, for looking up localized strings, etc.
+ ///
+ // This class was auto-generated by the StronglyTypedResourceBuilder
+ // class via a tool like ResGen or Visual Studio.
+ // To add or remove a member, edit your .ResX file then rerun ResGen
+ // with the /str option, or rebuild your VS project.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resources {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources() {
+ }
+
+ ///
+ /// Returns the cached ResourceManager instance used by this class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("DexterCRC.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ ///
+ /// Overrides the current thread's CurrentUICulture property for all
+ /// resource lookups using this strongly typed resource class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+ }
+}
diff --git a/project/dexter-cs/DexterCRC/Properties/Resources.resx b/project/dexter-cs/DexterCRC/Properties/Resources.resx
new file mode 100644
index 00000000..1af7de15
--- /dev/null
+++ b/project/dexter-cs/DexterCRC/Properties/Resources.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/project/dexter-cs/DexterCRC/Resource/checker-config.json b/project/dexter-cs/DexterCRC/Resource/checker-config.json
new file mode 100644
index 00000000..b7937341
--- /dev/null
+++ b/project/dexter-cs/DexterCRC/Resource/checker-config.json
@@ -0,0 +1,210 @@
+{
+ "checkerList": [
+ {
+ "code": "InterfaceCRC",
+ "name": "Interface",
+ "type": "BOTH",
+ "categoryName": "CsharpCRC",
+ "severityCode": "CRI",
+ "version": "0.1.0",
+ "description": " for Interface.",
+ "isActive": true,
+ "properties": { "value": "" },
+ "cwe": 0
+ },
+ {
+ "code": "MethodCRC",
+ "name": "Method",
+ "type": "BOTH",
+ "categoryName": "CsharpCRC",
+ "severityCode": "CRI",
+ "version": "0.1.0",
+ "description": " for Method.",
+ "isActive": true,
+ "properties": { "value": "" },
+ "cwe": 0
+ },
+ {
+ "code": "ClassCRC",
+ "name": "Class",
+ "type": "BOTH",
+ "categoryName": "CsharpCRC",
+ "severityCode": "CRI",
+ "version": "0.1.0",
+ "description": " for Class.",
+ "isActive": true,
+ "properties": { "value": "" },
+ "cwe": 0
+ },
+ {
+ "code": "PropertyCRC",
+ "name": "Property",
+ "type": "BOTH",
+ "categoryName": "CsharpCRC",
+ "severityCode": "CRI",
+ "version": "0.1.0",
+ "description": " for Property.",
+ "isActive": true,
+ "properties": { "value": "" },
+ "cwe": 0
+ },
+ {
+ "code": "ParameterCRC",
+ "name": "Parameter",
+ "type": "BOTH",
+ "categoryName": "CsharpCRC",
+ "severityCode": "CRI",
+ "version": "0.1.0",
+ "description": " for Parameter.",
+ "isActive": true,
+ "properties": { "value": "" },
+ "cwe": 0
+ },
+ {
+ "code": "FieldCRC",
+ "name": "Field",
+ "type": "BOTH",
+ "categoryName": "CsharpCRC",
+ "severityCode": "CRI",
+ "version": "0.1.0",
+ "description": " for Static Public/ Protected Field.",
+ "isActive": true,
+ "properties": { "value": "" },
+ "cwe": 0
+ },
+ {
+ "code": "EnumerationCRC",
+ "name": "Enumeration",
+ "type": "BOTH",
+ "categoryName": "CsharpCRC",
+ "severityCode": "CRI",
+ "version": "0.1.0",
+ "description": " for Enumeration.",
+ "isActive": true,
+ "properties": { "value": "" },
+ "cwe": 0
+ },
+ {
+ "code": "NamespaceCRC",
+ "name": "Namespace",
+ "type": "BOTH",
+ "categoryName": "CsharpCRC",
+ "severityCode": "CRI",
+ "version": "0.1.0",
+ "description": " for Namespace.",
+ "isActive": true,
+ "properties": { "value": "" },
+ "cwe": 0
+ },
+ {
+ "code": "DelegateCRC",
+ "name": "Delegate",
+ "type": "BOTH",
+ "categoryName": "CsharpCRC",
+ "severityCode": "CRI",
+ "version": "0.1.0",
+ "description": " for Delegate.",
+ "isActive": true,
+ "properties": { "value": "" },
+ "cwe": 0
+ },
+ {
+ "code": "EventCRC",
+ "name": "Event",
+ "type": "BOTH",
+ "categoryName": "CsharpCRC",
+ "severityCode": "CRI",
+ "version": "0.1.0",
+ "description": " for Event.",
+ "isActive": true,
+ "properties": { "value": "" },
+ "cwe": 0
+ },
+ {
+ "code": "DoWhileStatementsCRC",
+ "name": "Do-While Loop",
+ "type": "BOTH",
+ "categoryName": "CsharpCRC",
+ "severityCode": "CRI",
+ "version": "0.1.0",
+ "description": "Do-While Loop",
+ "isActive": true,
+ "properties": { "value": "" },
+ "cwe": 0
+ },
+ {
+ "code": "ForStatementsCRC",
+ "name": "For",
+ "type": "BOTH",
+ "categoryName": "CsharpCRC",
+ "severityCode": "CRI",
+ "version": "0.1.0",
+ "description": " for For Statement.",
+ "isActive": true,
+ "properties": { "value": "" },
+ "cwe": 0
+ },
+ {
+ "code": "ForeachStatementsCRC",
+ "name": "Foreach",
+ "type": "BOTH",
+ "categoryName": "CsharpCRC",
+ "severityCode": "CRI",
+ "version": "0.1.0",
+ "description": " for Foreach Statement.",
+ "isActive": true,
+ "properties": { "value": "" },
+ "cwe": 0
+ },
+ {
+ "code": "IfStatementsCRC",
+ "name": "If",
+ "type": "BOTH",
+ "categoryName": "CsharpCRC",
+ "severityCode": "CRI",
+ "version": "0.1.0",
+ "description": " for If Statement.",
+ "isActive": true,
+ "properties": { "value": "" },
+ "cwe": 0
+ },
+ {
+ "code": "WhileStatementsCRC",
+ "name": "While",
+ "type": "BOTH",
+ "categoryName": "CsharpCRC",
+ "severityCode": "CRI",
+ "version": "0.1.0",
+ "description": " for While Statement.",
+ "isActive": true,
+ "properties": { "value": "" },
+ "cwe": 0
+ },
+ {
+ "code": "SpacingCRC",
+ "name": "Spacing",
+ "type": "BOTH",
+ "categoryName": "CsharpCRC",
+ "severityCode": "CRI",
+ "version": "0.1.0",
+ "description": " for Spacing.",
+ "isActive": true,
+ "properties": { "value": "" },
+ "cwe": 0
+ },
+ {
+ "code": "HeadingCRC",
+ "name": "Heading",
+ "type": "BOTH",
+ "categoryName": "CsharpCRC",
+ "severityCode": "CRI",
+ "version": "0.1.0",
+ "description": " for Heading.",
+ "isActive": true,
+ "properties": { "value": "" },
+ "cwe": 0
+ }
+ ],
+ "toolName": "dexter-cs-crc",
+ "language": "C_SHARP"
+}
\ No newline at end of file
diff --git a/project/dexter-cs/DexterCRC/Src/CheckerLogic/BooleanPropertyPrefixing.cs b/project/dexter-cs/DexterCRC/Src/CheckerLogic/BooleanPropertyPrefixing.cs
new file mode 100644
index 00000000..586f26b0
--- /dev/null
+++ b/project/dexter-cs/DexterCRC/Src/CheckerLogic/BooleanPropertyPrefixing.cs
@@ -0,0 +1,57 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using DexterCS;
+using Microsoft.CodeAnalysis.CSharp;
+
+namespace DexterCRC
+{
+ public class BooleanPropertyPrefixing : ICheckerLogic
+ {
+ public BooleanPropertyPrefixing()
+ {
+ CheckerName = this.GetType().Name;
+ Description = "Boolean Property Name uses the ‘Is’, ‘Has’, ‘Can’ as a prefix";
+ }
+
+ public string CheckerName { get; set; }
+ public string Description { get; set; }
+
+ public bool HasDefect(object value)
+ {
+ string booleanPropertyName = ((string)value).ToLower();
+ return !(booleanPropertyName.Contains("is") || booleanPropertyName.Contains("has") || booleanPropertyName.Contains("can"));
+ }
+
+ public PreOccurence MakeDefect(AnalysisConfig config, Checker checker, CSharpSyntaxNode raw)
+ {
+ var lineSpan = raw.GetLocation().GetLineSpan();
+ PreOccurence preOcc = DexterCRCUtil.MakePreOccurence(raw, lineSpan, checker, config, CheckerName, Description);
+ return preOcc;
+ }
+ }
+}
diff --git a/project/dexter-cs/DexterCRC/Src/CheckerLogic/CamelCasing.cs b/project/dexter-cs/DexterCRC/Src/CheckerLogic/CamelCasing.cs
new file mode 100644
index 00000000..7bb26e85
--- /dev/null
+++ b/project/dexter-cs/DexterCRC/Src/CheckerLogic/CamelCasing.cs
@@ -0,0 +1,61 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using DexterCS;
+using Microsoft.CodeAnalysis.CSharp;
+
+namespace DexterCRC
+{
+ public class CamelCasing : ICheckerLogic
+ {
+ public CamelCasing()
+ {
+ CheckerName = this.GetType().Name;
+ Description = "Use Camel Casing";
+ }
+
+ public string CheckerName { get; set; }
+ public string Description { get; set; }
+
+ public bool HasDefect(object value)
+ {
+ string name = value.ToString();
+ if (name.Equals("_"))
+ {
+ return false;
+ }
+ return !(name[0] >= 'a' && name[0] <= 'z');
+ }
+
+ public PreOccurence MakeDefect(AnalysisConfig config, Checker checker, CSharpSyntaxNode raw)
+ {
+ var lineSpan = raw.GetLocation().GetLineSpan();
+ PreOccurence preOcc = DexterCRCUtil.MakePreOccurence(raw, lineSpan, checker, config, CheckerName, Description);
+ return preOcc;
+ }
+ }
+}
diff --git a/project/dexter-cs/DexterCRC/Src/CheckerLogic/CommentRules.cs b/project/dexter-cs/DexterCRC/Src/CheckerLogic/CommentRules.cs
new file mode 100644
index 00000000..ace1ba8a
--- /dev/null
+++ b/project/dexter-cs/DexterCRC/Src/CheckerLogic/CommentRules.cs
@@ -0,0 +1,59 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using DexterCS;
+using Microsoft.CodeAnalysis.CSharp;
+using System;
+
+namespace DexterCRC
+{
+ public class CommentRules : ICheckerLogic
+ {
+ public CommentRules()
+ {
+ CheckerName = this.GetType().Name;
+ Description = "Class/Interface Comment begins with “///”, and use tag";
+ }
+
+ public string CheckerName { get; set; }
+ public string Description { get; set; }
+
+ public bool HasDefect(object value)
+ {
+ string statement = value.ToString();
+ return !(statement.Trim().StartsWith("///", StringComparison.Ordinal)
+ && statement.Contains(""));
+ }
+
+ public PreOccurence MakeDefect(AnalysisConfig config, Checker checker, CSharpSyntaxNode raw)
+ {
+ var lineSpan = raw.GetLocation().GetLineSpan();
+ PreOccurence preOcc = DexterCRCUtil.MakePreOccurence(raw, lineSpan, checker, config, CheckerName, Description);
+ return preOcc;
+ }
+ }
+}
diff --git a/project/dexter-cs/DexterCRC/Src/CheckerLogic/HeadingRule.cs b/project/dexter-cs/DexterCRC/Src/CheckerLogic/HeadingRule.cs
new file mode 100644
index 00000000..8bce27f8
--- /dev/null
+++ b/project/dexter-cs/DexterCRC/Src/CheckerLogic/HeadingRule.cs
@@ -0,0 +1,61 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using DexterCS;
+using Microsoft.CodeAnalysis;
+using Microsoft.CodeAnalysis.CSharp;
+using System.Linq;
+
+namespace DexterCRC
+{
+ public class HeadingRule : ICheckerLogic
+ {
+ public HeadingRule()
+ {
+ CheckerName = this.GetType().Name;
+ Description = "Describe brief information about the file under a heading comment block";
+ }
+
+ public string CheckerName { get; set; }
+ public string Description { get; set; }
+
+ public bool HasDefect(object value)
+ {
+ SyntaxTriviaList trivia = (SyntaxTriviaList)value;
+ return !(trivia.ToList().ToString().Contains("Copyright") && trivia.ToString().Contains("Samsung Electronics Co."));
+ }
+
+
+ public PreOccurence MakeDefect(AnalysisConfig config, Checker checker, CSharpSyntaxNode raw)
+ {
+ var lineSpan = raw.GetLocation().GetLineSpan();
+ PreOccurence preOcc = DexterCRCUtil.MakePreOccurence(raw, lineSpan, checker, config, CheckerName, Description);
+ return preOcc;
+ }
+
+ }
+}
diff --git a/project/dexter-cs/DexterCRC/Src/CheckerLogic/ICheckerLogic.cs b/project/dexter-cs/DexterCRC/Src/CheckerLogic/ICheckerLogic.cs
new file mode 100644
index 00000000..95d4dad7
--- /dev/null
+++ b/project/dexter-cs/DexterCRC/Src/CheckerLogic/ICheckerLogic.cs
@@ -0,0 +1,40 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using DexterCS;
+using Microsoft.CodeAnalysis.CSharp;
+
+namespace DexterCRC
+{
+ public interface ICheckerLogic
+ {
+ string CheckerName { get; set; }
+ string Description { get; set; }
+ bool HasDefect(object value);
+ PreOccurence MakeDefect(AnalysisConfig config, Checker checker, CSharpSyntaxNode raw);
+ }
+}
diff --git a/project/dexter-cs/DexterCRC/Src/CheckerLogic/MethodSpacing.cs b/project/dexter-cs/DexterCRC/Src/CheckerLogic/MethodSpacing.cs
new file mode 100644
index 00000000..c7a40172
--- /dev/null
+++ b/project/dexter-cs/DexterCRC/Src/CheckerLogic/MethodSpacing.cs
@@ -0,0 +1,70 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using DexterCS;
+using Microsoft.CodeAnalysis;
+using Microsoft.CodeAnalysis.CSharp;
+using System.Linq;
+
+namespace DexterCRC
+{
+ public class MethodSpacing : ICheckerLogic
+ {
+ public MethodSpacing()
+ {
+ CheckerName = this.GetType().Name;
+ Description = "Use single blank line between methods in class.";
+ }
+
+ public string CheckerName { get; set; }
+ public string Description { get; set; }
+
+ public bool HasDefect(object value)
+ {
+ SyntaxTriviaList trivia = (SyntaxTriviaList)value;
+ return !ContainsOneBlankLine(trivia);
+ }
+
+ public PreOccurence MakeDefect(AnalysisConfig config, Checker checker, CSharpSyntaxNode raw)
+ {
+
+ var lineSpan = raw.GetLocation().GetLineSpan();
+ PreOccurence preOcc = DexterCRCUtil.MakePreOccurence(raw, lineSpan, checker, config, CheckerName, Description);
+ return preOcc;
+ }
+
+ private bool ContainsOneBlankLine(SyntaxTriviaList syntaxTriviaList)
+ {
+ int endOfLineCount = syntaxTriviaList.Count(syntaxTrivia => syntaxTrivia.IsKind(SyntaxKind.EndOfLineTrivia));
+ int singleCommentLineCount = syntaxTriviaList.Count(syntaxTrivia => syntaxTrivia.IsKind(SyntaxKind.SingleLineCommentTrivia));
+ int multiCommentLineCount = syntaxTriviaList.Count(syntaxTrivia => syntaxTrivia.IsKind(SyntaxKind.MultiLineCommentTrivia));
+
+ // Counting only the "blank lines", so lines with comments do not count
+ return endOfLineCount - singleCommentLineCount - multiCommentLineCount == 1;
+ }
+ }
+}
diff --git a/project/dexter-cs/DexterCRC/Src/CheckerLogic/NamingSet.cs b/project/dexter-cs/DexterCRC/Src/CheckerLogic/NamingSet.cs
new file mode 100644
index 00000000..10db75c9
--- /dev/null
+++ b/project/dexter-cs/DexterCRC/Src/CheckerLogic/NamingSet.cs
@@ -0,0 +1,35 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+namespace DexterCRC
+{
+ public class NamingSet
+ {
+ public string currentName { get; set; }
+ public string basicWord { get; set; }
+ }
+}
diff --git a/project/dexter-cs/DexterCRC/Src/CheckerLogic/NounNaming.cs b/project/dexter-cs/DexterCRC/Src/CheckerLogic/NounNaming.cs
new file mode 100644
index 00000000..66834ad0
--- /dev/null
+++ b/project/dexter-cs/DexterCRC/Src/CheckerLogic/NounNaming.cs
@@ -0,0 +1,61 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using DexterCRC.Src.Util;
+using DexterCS;
+using Microsoft.CodeAnalysis.CSharp;
+
+namespace DexterCRC
+{
+ public class NounNaming : ICheckerLogic
+ {
+ public NounNaming()
+ {
+ CheckerName = this.GetType().Name;
+ Description = "Use Noun or Noun phrase for a Class Name";
+ }
+
+ public string CheckerName { get; set; }
+ public string Description { get; set; }
+
+ public bool HasDefect(object value)
+ {
+ string name = value.ToString();
+
+ string[] words = DexterUtil.Split(name);
+
+ return !OpenNLPUtil.AreNouns(words);
+ }
+
+ public PreOccurence MakeDefect(AnalysisConfig config, Checker checker, CSharpSyntaxNode raw)
+ {
+ var lineSpan = raw.GetLocation().GetLineSpan();
+ PreOccurence preOcc = DexterCRCUtil.MakePreOccurence(raw, lineSpan, checker, config, CheckerName, Description);
+ return preOcc;
+ }
+ }
+}
diff --git a/project/dexter-cs/DexterCRC/Src/CheckerLogic/PascalCasing.cs b/project/dexter-cs/DexterCRC/Src/CheckerLogic/PascalCasing.cs
new file mode 100644
index 00000000..67a43a4a
--- /dev/null
+++ b/project/dexter-cs/DexterCRC/Src/CheckerLogic/PascalCasing.cs
@@ -0,0 +1,56 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using DexterCS;
+using Microsoft.CodeAnalysis.CSharp;
+
+namespace DexterCRC
+{
+ public class PascalCasing : ICheckerLogic
+ {
+ public PascalCasing()
+ {
+ CheckerName = this.GetType().Name;
+ Description = "Use Pascal Casing";
+ }
+
+ public string CheckerName { get; set; }
+ public string Description { get; set; }
+ public bool HasDefect(object value)
+ {
+ string name = value.ToString();
+ return !(name[0] >= 'A' && name[0] <= 'Z');
+ }
+
+ public PreOccurence MakeDefect(AnalysisConfig config, Checker checker, CSharpSyntaxNode raw)
+ {
+ var lineSpan = raw.GetLocation().GetLineSpan();
+ PreOccurence preOcc = DexterCRCUtil.MakePreOccurence(raw, lineSpan, checker, config, CheckerName, Description);
+ return preOcc;
+ }
+ }
+}
diff --git a/project/dexter-cs/DexterCRC/Src/CheckerLogic/PrefixNaming.cs b/project/dexter-cs/DexterCRC/Src/CheckerLogic/PrefixNaming.cs
new file mode 100644
index 00000000..29127c86
--- /dev/null
+++ b/project/dexter-cs/DexterCRC/Src/CheckerLogic/PrefixNaming.cs
@@ -0,0 +1,56 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using DexterCS;
+using Microsoft.CodeAnalysis.CSharp;
+
+namespace DexterCRC
+{
+ public class PrefixNaming : ICheckerLogic
+ {
+ public PrefixNaming()
+ {
+ CheckerName = this.GetType().Name;
+ Description = "Check Prefix";
+ }
+ public string CheckerName { get; set; }
+ public string Description { get; set; }
+
+ public bool HasDefect(object value)
+ {
+ var namingSet = (NamingSet)value;
+ return !DexterCRCUtil.HasPrefix(namingSet.currentName, namingSet.basicWord);
+ }
+
+ public PreOccurence MakeDefect(AnalysisConfig config, Checker checker, CSharpSyntaxNode raw)
+ {
+ var lineSpan = raw.GetLocation().GetLineSpan();
+ PreOccurence preOcc = DexterCRCUtil.MakePreOccurence(raw, lineSpan, checker, config, CheckerName, Description);
+ return preOcc;
+ }
+ }
+}
diff --git a/project/dexter-cs/DexterCRC/Src/CheckerLogic/SuffixNaming.cs b/project/dexter-cs/DexterCRC/Src/CheckerLogic/SuffixNaming.cs
new file mode 100644
index 00000000..8d100e0b
--- /dev/null
+++ b/project/dexter-cs/DexterCRC/Src/CheckerLogic/SuffixNaming.cs
@@ -0,0 +1,56 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using DexterCS;
+using Microsoft.CodeAnalysis.CSharp;
+
+namespace DexterCRC
+{
+ public class SuffixNaming : ICheckerLogic
+ {
+ public SuffixNaming()
+ {
+ CheckerName = this.GetType().Name;
+ Description = "Check Suffix";
+ }
+ public string CheckerName { get; set; }
+ public string Description { get; set; }
+ public bool HasDefect(object value)
+ {
+ var namingSet = (NamingSet)value;
+ return !DexterCRCUtil.HasSuffix(namingSet.currentName, namingSet.basicWord);
+ }
+
+ public PreOccurence MakeDefect(AnalysisConfig config, Checker checker, CSharpSyntaxNode raw)
+ {
+ var lineSpan = raw.GetLocation().GetLineSpan();
+ var baseCheckerName = this.GetType().Name;
+ PreOccurence preOcc = DexterCRCUtil.MakePreOccurence(raw, lineSpan, checker, config, CheckerName, Description);
+ return preOcc;
+ }
+ }
+}
diff --git a/project/dexter-cs/DexterCRC/Src/CheckerLogic/VerbNaming.cs b/project/dexter-cs/DexterCRC/Src/CheckerLogic/VerbNaming.cs
new file mode 100644
index 00000000..ec8d1b02
--- /dev/null
+++ b/project/dexter-cs/DexterCRC/Src/CheckerLogic/VerbNaming.cs
@@ -0,0 +1,34 @@
+using DexterCRC.Src.Util;
+using DexterCS;
+using Microsoft.CodeAnalysis.CSharp;
+
+namespace DexterCRC
+{
+ public class VerbNaming : ICheckerLogic
+ {
+ public VerbNaming()
+ {
+ CheckerName = this.GetType().Name;
+ Description = "Use Verb or Verb phrase for a Method Name";
+ }
+
+ public string CheckerName { get; set; }
+ public string Description { get; set; }
+
+ public bool HasDefect(object value)
+ {
+ string name = value.ToString();
+
+ string[] words = DexterUtil.Split(name);
+
+ return !OpenNLPUtil.IsVerbPhrase(words);
+ }
+
+ public PreOccurence MakeDefect(AnalysisConfig config, Checker checker, CSharpSyntaxNode raw)
+ {
+ var lineSpan = raw.GetLocation().GetLineSpan();
+ PreOccurence preOcc = DexterCRCUtil.MakePreOccurence(raw, lineSpan, checker, config, CheckerName, Description);
+ return preOcc;
+ }
+ }
+}
diff --git a/project/dexter-cs/DexterCRC/Src/CheckerLogic/WithBrace.cs b/project/dexter-cs/DexterCRC/Src/CheckerLogic/WithBrace.cs
new file mode 100644
index 00000000..0a6d639b
--- /dev/null
+++ b/project/dexter-cs/DexterCRC/Src/CheckerLogic/WithBrace.cs
@@ -0,0 +1,59 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using DexterCS;
+using Microsoft.CodeAnalysis.CSharp;
+using System;
+
+namespace DexterCRC
+{
+ public class WithBrace : ICheckerLogic
+ {
+ public WithBrace()
+ {
+ CheckerName = this.GetType().Name;
+ Description = "Even though statement are a single line, brace should be used";
+ }
+
+ public string CheckerName { get; set; }
+ public string Description { get; set; }
+
+ public bool HasDefect(object value)
+ {
+ string statement = value.ToString();
+ return !statement.StartsWith("{", StringComparison.Ordinal)
+ && !statement.EndsWith("}", StringComparison.Ordinal);
+ }
+
+ public PreOccurence MakeDefect(AnalysisConfig config, Checker checker, CSharpSyntaxNode raw)
+ {
+ var lineSpan = raw.GetLocation().GetLineSpan();
+ PreOccurence preOcc = DexterCRCUtil.MakePreOccurence(raw, lineSpan, checker, config, CheckerName, Description);
+ return preOcc;
+ }
+ }
+}
diff --git a/project/dexter-cs/DexterCRC/Src/CheckerLogic/WithoutUnderscore.cs b/project/dexter-cs/DexterCRC/Src/CheckerLogic/WithoutUnderscore.cs
new file mode 100644
index 00000000..65f5d329
--- /dev/null
+++ b/project/dexter-cs/DexterCRC/Src/CheckerLogic/WithoutUnderscore.cs
@@ -0,0 +1,56 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using DexterCS;
+using Microsoft.CodeAnalysis.CSharp;
+
+namespace DexterCRC
+{
+ public class WithoutUnderscore : ICheckerLogic
+ {
+ public WithoutUnderscore()
+ {
+ CheckerName = this.GetType().Name;
+ Description = "Without Underscore";
+ }
+ public string CheckerName { get; set; }
+ public string Description { get; set; }
+
+ public bool HasDefect(object value)
+ {
+ string name = value.ToString();
+ return !string.IsNullOrEmpty(name) && name.Contains("_");
+ }
+
+ public PreOccurence MakeDefect(AnalysisConfig config, Checker checker, CSharpSyntaxNode raw)
+ {
+ var lineSpan = raw.GetLocation().GetLineSpan();
+ PreOccurence preOcc = DexterCRCUtil.MakePreOccurence(raw, lineSpan, checker, config, CheckerName, Description);
+ return preOcc;
+ }
+ }
+}
diff --git a/project/dexter-cs/DexterCRC/Src/Crc/ClassCRC.cs b/project/dexter-cs/DexterCRC/Src/Crc/ClassCRC.cs
new file mode 100644
index 00000000..0731b06b
--- /dev/null
+++ b/project/dexter-cs/DexterCRC/Src/Crc/ClassCRC.cs
@@ -0,0 +1,120 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using DexterCS;
+using Microsoft.CodeAnalysis;
+using Microsoft.CodeAnalysis.CSharp.Symbols;
+using Microsoft.CodeAnalysis.CSharp.Syntax;
+using System.Linq;
+
+namespace DexterCRC
+{
+ public class ClassCRC : ICRCLogic
+ {
+ WithoutUnderscore underscore;
+ PascalCasing pascalCasing;
+ SuffixNaming suffixNaming;
+ NounNaming nounNaming;
+
+ public ClassCRC()
+ {
+ underscore = new WithoutUnderscore();
+ pascalCasing = new PascalCasing();
+ suffixNaming = new SuffixNaming();
+ nounNaming = new NounNaming();
+ }
+
+ public void Analyze(AnalysisConfig config, AnalysisResult result, Checker checker, SyntaxNode syntaxRoot)
+ {
+ var classRaws = syntaxRoot.DescendantNodes().OfType();
+ if (!classRaws.Any())
+ {
+ return;
+ }
+
+ foreach (var classRaw in classRaws)
+ {
+ string className = classRaw.Identifier.ToString();
+ if (underscore.HasDefect(className))
+ {
+ PreOccurence preOcc = underscore.MakeDefect(config, checker, classRaw);
+ result.AddDefectWithPreOccurence(preOcc);
+ }
+ if (pascalCasing.HasDefect(className))
+ {
+ PreOccurence preOcc = pascalCasing.MakeDefect(config, checker, classRaw);
+ result.AddDefectWithPreOccurence(preOcc);
+ }
+ if (nounNaming.HasDefect(className))
+ {
+ PreOccurence preOcc = nounNaming.MakeDefect(config, checker, classRaw);
+ result.AddDefectWithPreOccurence(preOcc);
+ }
+
+ if (classRaw.BaseList == null)
+ {
+ continue;
+ }
+ else if (HasBaseTypeNamingDefect(className, classRaw.BaseList.Types))
+ {
+ PreOccurence preOcc = suffixNaming.MakeDefect(config, checker, classRaw);
+ result.AddDefectWithPreOccurence(preOcc);
+ }
+ }
+ }
+
+ private bool HasBaseTypeNamingDefect(string className, SeparatedSyntaxList baseTypes)
+ {
+ foreach (var baseType in baseTypes)
+ {
+ if (CheckEventNaming(className, baseType.Type.ToString()))
+ {
+ return true;
+ }
+ if (CheckAttributeNaming(className, baseType.Type.ToString()))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public bool CheckAttributeNaming(string className, string baseName)
+ {
+ return (DexterCRCUtil.HasSuffix(baseName, DexterCRCUtil.ATTRIBUTE_CLASS_SUFFIX)
+ && !DexterCRCUtil.HasSuffix(className, DexterCRCUtil.ATTRIBUTE_CLASS_SUFFIX));
+ }
+
+ public bool CheckEventNaming(string className, string baseName)
+ {
+ return (DexterCRCUtil.HasSuffix(baseName, DexterCRCUtil.EVENT_CLASS_SUFFIX)
+ && !DexterCRCUtil.HasSuffix(className, DexterCRCUtil.EVENT_CLASS_SUFFIX));
+ }
+ }
+}
+
+
diff --git a/project/dexter-cs/DexterCRC/Src/Crc/CommentCRC.cs b/project/dexter-cs/DexterCRC/Src/Crc/CommentCRC.cs
new file mode 100644
index 00000000..4261a21c
--- /dev/null
+++ b/project/dexter-cs/DexterCRC/Src/Crc/CommentCRC.cs
@@ -0,0 +1,66 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using DexterCS;
+using Microsoft.CodeAnalysis;
+using Microsoft.CodeAnalysis.CSharp.Syntax;
+using System;
+using System.Linq;
+
+namespace DexterCRC.Src.Crc
+{
+ public class CommentCRC : ICRCLogic
+ {
+ CommentRules commentRules;
+
+ public CommentCRC()
+ {
+ commentRules = new CommentRules();
+ }
+
+
+ public void Analyze(AnalysisConfig config, AnalysisResult result, Checker checker, SyntaxNode syntaxRoot)
+ {
+ var commentRaws = syntaxRoot.DescendantNodes().OfType();
+ if (!commentRaws.Any())
+ {
+ return;
+ }
+
+
+ foreach (var commentRaw in commentRaws)
+ {
+ if (commentRules.HasDefect(commentRaws))
+ {
+ PreOccurence preOcc = commentRules.MakeDefect(config, checker, commentRaw);
+ result.AddDefectWithPreOccurence(preOcc);
+ }
+ }
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/project/dexter-cs/DexterCRC/Src/Crc/DelegateCRC.cs b/project/dexter-cs/DexterCRC/Src/Crc/DelegateCRC.cs
new file mode 100644
index 00000000..01b6c072
--- /dev/null
+++ b/project/dexter-cs/DexterCRC/Src/Crc/DelegateCRC.cs
@@ -0,0 +1,70 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using DexterCS;
+using Microsoft.CodeAnalysis;
+using Microsoft.CodeAnalysis.CSharp.Syntax;
+using System.Linq;
+
+namespace DexterCRC
+{
+ public class DelegateCRC : ICRCLogic
+ {
+ PascalCasing pascalCasing;
+ SuffixNaming suffixNaming;
+
+ public DelegateCRC()
+ {
+ pascalCasing = new PascalCasing();
+ suffixNaming = new SuffixNaming();
+ }
+ public void Analyze(AnalysisConfig config, AnalysisResult result, Checker checker, SyntaxNode syntaxRoot)
+ {
+ var delegateRaws = syntaxRoot.DescendantNodes().OfType();
+ foreach (var delegateRaw in delegateRaws)
+ {
+ var delegateName = delegateRaw.Identifier.ToString();
+
+ if (pascalCasing.HasDefect(delegateName))
+ {
+ PreOccurence preOcc = pascalCasing.MakeDefect(config, checker, delegateRaw);
+ result.AddDefectWithPreOccurence(preOcc);
+ }
+
+ if (!suffixNaming.HasDefect(new NamingSet
+ {
+ currentName = delegateName,
+ basicWord = DexterCRCUtil.DELEGATE_SUFFIX
+ }))
+ {
+ PreOccurence preOcc = suffixNaming.MakeDefect(config, checker, delegateRaw);
+ result.AddDefectWithPreOccurence(preOcc);
+ }
+ }
+ }
+ }
+}
diff --git a/project/dexter-cs/DexterCRC/Src/Crc/DoWhileStatementsCRC.cs b/project/dexter-cs/DexterCRC/Src/Crc/DoWhileStatementsCRC.cs
new file mode 100644
index 00000000..08ee96db
--- /dev/null
+++ b/project/dexter-cs/DexterCRC/Src/Crc/DoWhileStatementsCRC.cs
@@ -0,0 +1,63 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using DexterCS;
+using Microsoft.CodeAnalysis;
+using Microsoft.CodeAnalysis.CSharp.Symbols;
+using Microsoft.CodeAnalysis.CSharp.Syntax;
+using System.Linq;
+
+namespace DexterCRC
+{
+ class DoWhileStatementsCRC : ICRCLogic
+ {
+ WithBrace bracket;
+
+ public DoWhileStatementsCRC()
+ {
+ bracket = new WithBrace();
+ }
+
+ public void Analyze(AnalysisConfig config, AnalysisResult result, Checker checker, SyntaxNode syntaxRoot)
+ {
+ var doStatementRaws = syntaxRoot.DescendantNodes().OfType();
+ if (!doStatementRaws.Any())
+ {
+ return;
+ }
+
+ foreach (var doStatementRaw in doStatementRaws)
+ {
+ if (bracket.HasDefect(doStatementRaw.Statement.ToString()))
+ {
+ PreOccurence preOcc = bracket.MakeDefect(config, checker, doStatementRaw);
+ result.AddDefectWithPreOccurence(preOcc);
+ }
+ }
+ }
+ }
+}
diff --git a/project/dexter-cs/DexterCRC/Src/Crc/EnumerationCRC.cs b/project/dexter-cs/DexterCRC/Src/Crc/EnumerationCRC.cs
new file mode 100644
index 00000000..9b0ae887
--- /dev/null
+++ b/project/dexter-cs/DexterCRC/Src/Crc/EnumerationCRC.cs
@@ -0,0 +1,58 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using DexterCS;
+using Microsoft.CodeAnalysis;
+using Microsoft.CodeAnalysis.CSharp.Syntax;
+using System.Linq;
+
+namespace DexterCRC
+{
+ class EnumerationCRC : ICRCLogic
+ {
+ PascalCasing pascalCasing;
+
+ public EnumerationCRC()
+ {
+ pascalCasing = new PascalCasing();
+ }
+ public void Analyze(AnalysisConfig config, AnalysisResult result, Checker checker, SyntaxNode syntaxRoot)
+ {
+
+ var enumRaws = syntaxRoot.DescendantNodes().OfType();
+ foreach (var enumRaw in enumRaws)
+ {
+ var enumName = enumRaw.Identifier.ToString();
+ if (pascalCasing.HasDefect(enumName))
+ {
+ PreOccurence preOcc = pascalCasing.MakeDefect(config, checker, enumRaw);
+ result.AddDefectWithPreOccurence(preOcc);
+ }
+ }
+ }
+ }
+}
diff --git a/project/dexter-cs/DexterCRC/Src/Crc/EventCRC.cs b/project/dexter-cs/DexterCRC/Src/Crc/EventCRC.cs
new file mode 100644
index 00000000..66820a9f
--- /dev/null
+++ b/project/dexter-cs/DexterCRC/Src/Crc/EventCRC.cs
@@ -0,0 +1,84 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using DexterCS;
+using Microsoft.CodeAnalysis;
+using Microsoft.CodeAnalysis.CSharp.Syntax;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace DexterCRC
+{
+ public class EventCRC : ICRCLogic
+ {
+ SuffixNaming suffixNaming;
+ PascalCasing pascalCasing;
+
+ public EventCRC()
+ {
+ suffixNaming = new SuffixNaming();
+ pascalCasing = new PascalCasing();
+ }
+ public void Analyze(AnalysisConfig config, AnalysisResult result, Checker checker, SyntaxNode syntaxRoot)
+ {
+ var eventRaws = syntaxRoot.DescendantNodes().OfType();
+ foreach (var eventRaw in eventRaws)
+ {
+ string eventTypeName = eventRaw.Declaration.Type.ToString();
+ if (suffixNaming.HasDefect(new NamingSet
+ {
+ currentName = eventTypeName,
+ basicWord = DexterCRCUtil.EVENT_TYPE_SUFFIX
+ }))
+ {
+ PreOccurence preOcc = suffixNaming.MakeDefect(config, checker, eventRaw);
+ result.AddDefectWithPreOccurence(preOcc);
+ }
+
+ List variables = GetCamelCasingVariables(eventRaw.Declaration.Variables);
+ foreach (string variable in variables)
+ {
+ PreOccurence preOcc = pascalCasing.MakeDefect(config, checker, eventRaw);
+ result.AddDefectWithPreOccurence(preOcc);
+ }
+ }
+ }
+
+ private List GetCamelCasingVariables(SeparatedSyntaxList variables)
+ {
+ List tempVariables = new List();
+ foreach (var variable in variables)
+ {
+ if (pascalCasing.HasDefect(variable.Identifier.ToString()))
+ {
+ tempVariables.Add(variable.Identifier.ToString());
+ }
+ }
+ return tempVariables;
+ }
+ }
+}
diff --git a/project/dexter-cs/DexterCRC/Src/Crc/FieldCRC.cs b/project/dexter-cs/DexterCRC/Src/Crc/FieldCRC.cs
new file mode 100644
index 00000000..78e2d3d0
--- /dev/null
+++ b/project/dexter-cs/DexterCRC/Src/Crc/FieldCRC.cs
@@ -0,0 +1,89 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using DexterCS;
+using Microsoft.CodeAnalysis;
+using Microsoft.CodeAnalysis.CSharp.Syntax;
+using System.Linq;
+
+namespace DexterCRC
+{
+ public class FieldCRC : ICRCLogic
+ {
+ PascalCasing pascalCasing;
+
+ public FieldCRC()
+ {
+ pascalCasing = new PascalCasing();
+ }
+ public void Analyze(AnalysisConfig config, AnalysisResult result, Checker checker, SyntaxNode syntaxRoot)
+ {
+ var baseFieldRaws = syntaxRoot.DescendantNodes().OfType();
+ foreach (var fieldRaw in baseFieldRaws)
+ {
+ if (HasFieldModifier(fieldRaw.Modifiers)
+ && HasCamelCasingDefect(fieldRaw.Declaration.Variables))
+ {
+ PreOccurence preOcc = pascalCasing.MakeDefect(config, checker, fieldRaw);
+ result.AddDefectWithPreOccurence(preOcc);
+ }
+ }
+ }
+
+ private bool HasCamelCasingDefect(SeparatedSyntaxList variables)
+ {
+ foreach (var variable in variables)
+ {
+ if (pascalCasing.HasDefect(variable.Identifier.ToString()))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private bool HasFieldModifier(SyntaxTokenList modifiers)
+ {
+ foreach (var modifier in modifiers)
+ {
+ if (HasInvalidModifier(modifier.ToString()))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public bool HasInvalidModifier(string modifier)
+ {
+ modifier = modifier.Trim();
+ return ("protected static".Equals(modifier) || "public static".Equals(modifier)
+ || "static protected".Equals(modifier) || "static public".Equals(modifier));
+ }
+ }
+}
+
diff --git a/project/dexter-cs/DexterCRC/Src/Crc/ForStatementsCRC.cs b/project/dexter-cs/DexterCRC/Src/Crc/ForStatementsCRC.cs
new file mode 100644
index 00000000..17ff8db2
--- /dev/null
+++ b/project/dexter-cs/DexterCRC/Src/Crc/ForStatementsCRC.cs
@@ -0,0 +1,57 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using DexterCS;
+using Microsoft.CodeAnalysis;
+using Microsoft.CodeAnalysis.CSharp.Symbols;
+using Microsoft.CodeAnalysis.CSharp.Syntax;
+using System.Linq;
+
+namespace DexterCRC
+{
+ public class ForStatementsCRC : ICRCLogic
+ {
+ WithBrace bracket = new WithBrace();
+ public ForStatementsCRC() { }
+ public void Analyze(AnalysisConfig config, AnalysisResult result, Checker checker, SyntaxNode syntaxRoot)
+ {
+ var forRaws = syntaxRoot.DescendantNodes().OfType();
+ if (!forRaws.Any())
+ {
+ return;
+ }
+ foreach (var forRaw in forRaws)
+ {
+ if (bracket.HasDefect(forRaw.Statement.ToString()))
+ {
+ PreOccurence preOcc = bracket.MakeDefect(config, checker, forRaw);
+ result.AddDefectWithPreOccurence(preOcc);
+ }
+ }
+ }
+ }
+}
diff --git a/project/dexter-cs/DexterCRC/Src/Crc/ForeachStatementsCRC.cs b/project/dexter-cs/DexterCRC/Src/Crc/ForeachStatementsCRC.cs
new file mode 100644
index 00000000..2c750e2b
--- /dev/null
+++ b/project/dexter-cs/DexterCRC/Src/Crc/ForeachStatementsCRC.cs
@@ -0,0 +1,52 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using DexterCS;
+using Microsoft.CodeAnalysis;
+using Microsoft.CodeAnalysis.CSharp.Syntax;
+using System.Linq;
+
+namespace DexterCRC
+{
+ class ForeachStatementsCRC : ICRCLogic
+ {
+ WithBrace bracket = new WithBrace();
+ public ForeachStatementsCRC() { }
+ public void Analyze(AnalysisConfig config, AnalysisResult result, Checker checker, SyntaxNode syntaxRoot)
+ {
+ var foreachRaws = syntaxRoot.DescendantNodes().OfType();
+ foreach (var foreachRaw in foreachRaws)
+ {
+ if (bracket.HasDefect(foreachRaw.Statement.ToString()))
+ {
+ PreOccurence preOcc = bracket.MakeDefect(config, checker, foreachRaw);
+ result.AddDefectWithPreOccurence(preOcc);
+ }
+ }
+ }
+ }
+}
diff --git a/project/dexter-cs/DexterCRC/Src/Crc/HeadingCRC.cs b/project/dexter-cs/DexterCRC/Src/Crc/HeadingCRC.cs
new file mode 100644
index 00000000..1c7e098f
--- /dev/null
+++ b/project/dexter-cs/DexterCRC/Src/Crc/HeadingCRC.cs
@@ -0,0 +1,74 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using DexterCS;
+using Microsoft.CodeAnalysis;
+using Microsoft.CodeAnalysis.CSharp.Syntax;
+using System.Linq;
+
+namespace DexterCRC
+{
+ class HeadingCRC : ICRCLogic
+ {
+ HeadingRule headingRule;
+
+ public HeadingCRC()
+ {
+ headingRule = new HeadingRule();
+ }
+
+ public void Analyze(AnalysisConfig config, AnalysisResult result, Checker checker, SyntaxNode syntaxRoot)
+ {
+
+ var classRaws = syntaxRoot.DescendantNodes().OfType();
+ if (!classRaws.Any())
+ {
+ return;
+ }
+
+ int count = 0;
+
+ foreach (var classRaw in classRaws)
+ {
+ SyntaxTriviaList syntaxTriviaList = classRaw.GetLeadingTrivia();
+
+ if (!headingRule.HasDefect(syntaxTriviaList))
+ {
+ count = count++;
+ }
+ }
+
+ if (count == 0)
+ {
+ PreOccurence preOcc = headingRule.MakeDefect(config, checker, classRaws.ToList()[0]);
+ result.AddDefectWithPreOccurence(preOcc);
+ }
+
+ }
+ }
+}
+
diff --git a/project/dexter-cs/DexterCRC/Src/Crc/ICRCLogic.cs b/project/dexter-cs/DexterCRC/Src/Crc/ICRCLogic.cs
new file mode 100644
index 00000000..33d11469
--- /dev/null
+++ b/project/dexter-cs/DexterCRC/Src/Crc/ICRCLogic.cs
@@ -0,0 +1,37 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using DexterCS;
+using Microsoft.CodeAnalysis;
+
+namespace DexterCRC
+{
+ public interface ICRCLogic
+ {
+ void Analyze(AnalysisConfig config, AnalysisResult result, Checker checker, SyntaxNode syntaxRoot);
+ }
+}
\ No newline at end of file
diff --git a/project/dexter-cs/DexterCRC/Src/Crc/IfStatementsCRC.cs b/project/dexter-cs/DexterCRC/Src/Crc/IfStatementsCRC.cs
new file mode 100644
index 00000000..efe3b44c
--- /dev/null
+++ b/project/dexter-cs/DexterCRC/Src/Crc/IfStatementsCRC.cs
@@ -0,0 +1,60 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using DexterCS;
+using Microsoft.CodeAnalysis;
+using Microsoft.CodeAnalysis.CSharp.Symbols;
+using Microsoft.CodeAnalysis.CSharp.Syntax;
+using System.Linq;
+
+namespace DexterCRC
+{
+ public class IfStatementsCRC : ICRCLogic
+ {
+ WithBrace bracket = new WithBrace();
+ public IfStatementsCRC() { }
+ public void Analyze(AnalysisConfig config, AnalysisResult result, Checker checker, SyntaxNode syntaxRoot)
+ {
+ var ifRaws = syntaxRoot.DescendantNodes().OfType();
+
+ if (!ifRaws.Any())
+ {
+ return;
+ }
+
+ foreach (var ifRaw in ifRaws)
+ {
+ if (bracket.HasDefect(ifRaw.Statement.ToString()))
+ {
+ PreOccurence preOcc = bracket.MakeDefect(config, checker, ifRaw);
+ result.AddDefectWithPreOccurence(preOcc);
+ }
+ }
+
+ }
+ }
+}
diff --git a/project/dexter-cs/DexterCRC/Src/Crc/InterfaceCRC.cs b/project/dexter-cs/DexterCRC/Src/Crc/InterfaceCRC.cs
new file mode 100644
index 00000000..7e9b6b41
--- /dev/null
+++ b/project/dexter-cs/DexterCRC/Src/Crc/InterfaceCRC.cs
@@ -0,0 +1,86 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using DexterCS;
+using Microsoft.CodeAnalysis;
+using Microsoft.CodeAnalysis.CSharp.Symbols;
+using Microsoft.CodeAnalysis.CSharp.Syntax;
+using System.Linq;
+
+namespace DexterCRC
+{
+ public class InterfaceCRC : ICRCLogic
+ {
+ PascalCasing pascalCasing;
+ WithoutUnderscore underscore;
+ PrefixNaming prefixNaming;
+
+ public InterfaceCRC()
+ {
+ pascalCasing = new PascalCasing();
+ underscore = new WithoutUnderscore();
+ //naming = new Naming();
+ prefixNaming = new PrefixNaming();
+
+ }
+ public void Analyze(AnalysisConfig config, AnalysisResult result, Checker checker, SyntaxNode syntaxRoot)
+ {
+ var interfaceRaws = syntaxRoot.DescendantNodes().OfType();
+ if (!interfaceRaws.Any())
+ {
+ return;
+ }
+ foreach (var interfaceRaw in interfaceRaws)
+ {
+ string interfaceName = interfaceRaw.Identifier.ToString();
+
+ if (prefixNaming.HasDefect(new NamingSet
+ {
+ currentName = interfaceName,
+ basicWord = "I"
+ }))
+ {
+ PreOccurence preOcc = prefixNaming.MakeDefect(config, checker, interfaceRaw);
+ result.AddDefectWithPreOccurence(preOcc);
+ }
+
+ if (underscore.HasDefect(interfaceName)) // Underscore Naming
+ {
+ PreOccurence preOcc = underscore.MakeDefect(config, checker, interfaceRaw);
+ result.AddDefectWithPreOccurence(preOcc);
+ }
+
+ if (pascalCasing.HasDefect(interfaceName))
+ {
+ PreOccurence preOcc = pascalCasing.MakeDefect(config, checker, interfaceRaw);
+ result.AddDefectWithPreOccurence(preOcc);
+ }
+ }
+ }
+
+ }
+}
diff --git a/project/dexter-cs/DexterCRC/Src/Crc/MethodCRC.cs b/project/dexter-cs/DexterCRC/Src/Crc/MethodCRC.cs
new file mode 100644
index 00000000..4a0f3631
--- /dev/null
+++ b/project/dexter-cs/DexterCRC/Src/Crc/MethodCRC.cs
@@ -0,0 +1,78 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using DexterCS;
+using Microsoft.CodeAnalysis;
+using Microsoft.CodeAnalysis.CSharp.Syntax;
+using System.Linq;
+
+namespace DexterCRC
+{
+ class MethodCRC : ICRCLogic
+ {
+ PascalCasing pascalCasing;
+ WithoutUnderscore withoutUnderscore;
+ VerbNaming verbNaming;
+
+ public MethodCRC()
+ {
+ pascalCasing = new PascalCasing();
+ withoutUnderscore = new WithoutUnderscore();
+ verbNaming = new VerbNaming();
+ }
+
+ public void Analyze(AnalysisConfig config, AnalysisResult result, Checker checker, SyntaxNode syntaxRoot)
+ {
+ var methodRaws = syntaxRoot.DescendantNodes().OfType();
+ if (!methodRaws.Any())
+ {
+ return;
+ }
+
+ foreach (var methodRaw in methodRaws)
+ {
+ string methodName = methodRaw.Identifier.ToString();
+
+ if (withoutUnderscore.HasDefect(methodName))
+ {
+ PreOccurence preOcc = withoutUnderscore.MakeDefect(config, checker, methodRaw);
+ result.AddDefectWithPreOccurence(preOcc);
+ }
+ if (pascalCasing.HasDefect(methodName))
+ {
+ PreOccurence preOcc = pascalCasing.MakeDefect(config, checker, methodRaw);
+ result.AddDefectWithPreOccurence(preOcc);
+ }
+ if (verbNaming.HasDefect(methodName))
+ {
+ PreOccurence preOcc = verbNaming.MakeDefect(config, checker, methodRaw);
+ result.AddDefectWithPreOccurence(preOcc);
+ }
+ }
+ }
+ }
+}
diff --git a/project/dexter-cs/DexterCRC/Src/Crc/NamespaceCRC.cs b/project/dexter-cs/DexterCRC/Src/Crc/NamespaceCRC.cs
new file mode 100644
index 00000000..24be3616
--- /dev/null
+++ b/project/dexter-cs/DexterCRC/Src/Crc/NamespaceCRC.cs
@@ -0,0 +1,53 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using DexterCS;
+using Microsoft.CodeAnalysis;
+using Microsoft.CodeAnalysis.CSharp.Syntax;
+using System.Linq;
+
+namespace DexterCRC
+{
+ class NamespaceCRC : ICRCLogic
+ {
+ PascalCasing pascalCasing;
+ public NamespaceCRC() { pascalCasing = new PascalCasing(); }
+ public void Analyze(AnalysisConfig config, AnalysisResult result, Checker checker, SyntaxNode syntaxRoot)
+ {
+ var namespaceRaws = syntaxRoot.DescendantNodes().OfType();
+ foreach (var namespaceRaw in namespaceRaws)
+ {
+ string namespaceName = namespaceRaw.Name.ToString();
+ if (pascalCasing.HasDefect(namespaceName))
+ {
+ PreOccurence preOcc = pascalCasing.MakeDefect(config, checker, namespaceRaw);
+ result.AddDefectWithPreOccurence(preOcc);
+ }
+ }
+ }
+ }
+}
diff --git a/project/dexter-cs/DexterCRC/Src/Crc/ParameterCRC.cs b/project/dexter-cs/DexterCRC/Src/Crc/ParameterCRC.cs
new file mode 100644
index 00000000..4c82e633
--- /dev/null
+++ b/project/dexter-cs/DexterCRC/Src/Crc/ParameterCRC.cs
@@ -0,0 +1,57 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using DexterCS;
+using Microsoft.CodeAnalysis;
+using Microsoft.CodeAnalysis.CSharp.Syntax;
+using System.Linq;
+
+namespace DexterCRC
+{
+ public class ParameterCRC : ICRCLogic
+ {
+ CamelCasing camelCasing = new CamelCasing();
+ public ParameterCRC() { }
+ public void Analyze(AnalysisConfig config, AnalysisResult result, Checker checker, SyntaxNode syntaxRoot)
+ {
+ var parameterRaws = syntaxRoot.DescendantNodes().OfType();
+ if (!parameterRaws.Any())
+ {
+ return;
+ }
+ foreach (var parameterRaw in parameterRaws)
+ {
+ string parameterName = parameterRaw.Identifier.ValueText;
+ if (camelCasing.HasDefect(parameterName))
+ {
+ PreOccurence preOcc = camelCasing.MakeDefect(config, checker, parameterRaw);
+ result.AddDefectWithPreOccurence(preOcc);
+ }
+ }
+ }
+ }
+}
diff --git a/project/dexter-cs/DexterCRC/Src/Crc/PropertyCRC.cs b/project/dexter-cs/DexterCRC/Src/Crc/PropertyCRC.cs
new file mode 100644
index 00000000..ef92946e
--- /dev/null
+++ b/project/dexter-cs/DexterCRC/Src/Crc/PropertyCRC.cs
@@ -0,0 +1,72 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using DexterCS;
+using Microsoft.CodeAnalysis;
+using Microsoft.CodeAnalysis.CSharp.Syntax;
+using System.Linq;
+
+namespace DexterCRC
+{
+ public class PropertyCRC : ICRCLogic
+ {
+ PascalCasing pascalCasing;
+ BooleanPropertyPrefixing booleanPropertyPrefixing;
+
+ public PropertyCRC()
+ {
+ pascalCasing = new PascalCasing();
+ booleanPropertyPrefixing = new BooleanPropertyPrefixing();
+ }
+ public void Analyze(AnalysisConfig config, AnalysisResult result, Checker checker, SyntaxNode syntaxRoot)
+ {
+ var propertyRaws = syntaxRoot.DescendantNodes().OfType();
+ if (!propertyRaws.Any())
+ {
+ return;
+ }
+ foreach (var propertyRaw in propertyRaws)
+ {
+ string propertyName = propertyRaw.Identifier.ToString();
+ if (pascalCasing.HasDefect(propertyName))
+ {
+ PreOccurence preOcc = pascalCasing.MakeDefect(config, checker, propertyRaw);
+ result.AddDefectWithPreOccurence(preOcc);
+ }
+ if (DexterUtil.IsPropertyDeclarationBoolean(propertyRaw))
+ {
+ if (booleanPropertyPrefixing.HasDefect(propertyName))
+ {
+ PreOccurence preOcc = booleanPropertyPrefixing.MakeDefect(config, checker, propertyRaw);
+ result.AddDefectWithPreOccurence(preOcc);
+ }
+ }
+ }
+
+ }
+ }
+}
diff --git a/project/dexter-cs/DexterCRC/Src/Crc/SpacingCRC.cs b/project/dexter-cs/DexterCRC/Src/Crc/SpacingCRC.cs
new file mode 100644
index 00000000..92ca4451
--- /dev/null
+++ b/project/dexter-cs/DexterCRC/Src/Crc/SpacingCRC.cs
@@ -0,0 +1,64 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using DexterCS;
+using Microsoft.CodeAnalysis;
+using Microsoft.CodeAnalysis.CSharp.Syntax;
+using System.Linq;
+
+namespace DexterCRC
+{
+ class SpacingCRC : ICRCLogic
+ {
+ MethodSpacing methodSpacing;
+
+ public SpacingCRC()
+ {
+ methodSpacing = new MethodSpacing();
+ }
+
+ public void Analyze(AnalysisConfig config, AnalysisResult result, Checker checker, SyntaxNode syntaxRoot)
+ {
+ var methodRaws = syntaxRoot.DescendantNodes().OfType();
+ if (!methodRaws.Any())
+ {
+ return;
+ }
+
+ foreach (var methodRaw in methodRaws)
+ {
+ SyntaxTriviaList syntaxTriviaList = methodRaw.GetLeadingTrivia();
+
+ if (methodSpacing.HasDefect(syntaxTriviaList))
+ {
+ PreOccurence preOcc = methodSpacing.MakeDefect(config, checker, methodRaw);
+ result.AddDefectWithPreOccurence(preOcc);
+ }
+ }
+ }
+ }
+}
diff --git a/project/dexter-cs/DexterCRC/Src/Crc/WhileStatementsCRC.cs b/project/dexter-cs/DexterCRC/Src/Crc/WhileStatementsCRC.cs
new file mode 100644
index 00000000..f72438a9
--- /dev/null
+++ b/project/dexter-cs/DexterCRC/Src/Crc/WhileStatementsCRC.cs
@@ -0,0 +1,56 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using DexterCS;
+using Microsoft.CodeAnalysis;
+using Microsoft.CodeAnalysis.CSharp.Symbols;
+using Microsoft.CodeAnalysis.CSharp.Syntax;
+using System.Linq;
+namespace DexterCRC
+{
+ class WhileStatementsCRC : ICRCLogic
+ {
+ WithBrace bracket = new WithBrace();
+ public WhileStatementsCRC() { }
+ public void Analyze(AnalysisConfig config, AnalysisResult result, Checker checker, SyntaxNode syntaxRoot)
+ {
+ var whileRaws = syntaxRoot.DescendantNodes().OfType();
+ if (!whileRaws.Any())
+ {
+ return;
+ }
+ foreach (var whileRaw in whileRaws)
+ {
+ if (bracket.HasDefect(whileRaw.Statement.ToString()))
+ {
+ PreOccurence preOcc = bracket.MakeDefect(config, checker, whileRaw);
+ result.AddDefectWithPreOccurence(preOcc);
+ }
+ }
+ }
+ }
+}
diff --git a/project/dexter-cs/DexterCRC/Src/DexterCRCPlugin.cs b/project/dexter-cs/DexterCRC/Src/DexterCRCPlugin.cs
new file mode 100644
index 00000000..6f7f334e
--- /dev/null
+++ b/project/dexter-cs/DexterCRC/Src/DexterCRCPlugin.cs
@@ -0,0 +1,179 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using DexterCS;
+using log4net;
+using Microsoft.CodeAnalysis;
+using Microsoft.CodeAnalysis.CSharp;
+using Newtonsoft.Json;
+using System;
+using System.IO;
+using System.Reflection;
+using System.Text;
+
+namespace DexterCRC
+{
+ public class DexterCRCPlugin : IDexterPlugin
+ {
+ private const string DEFAULT_CHECKER_CONFIG_PATH = ".Resource.checker-config.json";
+ private static ILog CliLog = LogManager.GetLogger(typeof(DexterCRCPlugin));
+
+ static Assembly assem = Assembly.GetExecutingAssembly();
+ static AssemblyName assemName = assem.GetName();
+ static Version version = assemName.Version;
+ private static string pluginName = assemName.Name;
+ public string PLUGIN_NAME
+ {
+ get
+ {
+ return pluginName;
+ }
+ }
+
+ private BaseCheckerConfig baseCheckerConfig;
+ private ICheckerConfig checkerConfig = new CheckerConfig(pluginName, DexterConfig.LANGUAGE.C_SHARP);
+ public ICheckerConfig CheckerConfig { get { return checkerConfig; } set { checkerConfig = value; } }
+ public DexterCRCPlugin() { }
+ public string[] SupportingFileExtensions
+ {
+ get { return new String[] { "cs" }; }
+ }
+
+ public string PLUGIN_DESCRIPTION
+ {
+ get { return "Dexter CSharp CRC Checker Plug-in"; }
+ }
+
+ public string PLUGIN_AUTHOR
+ {
+ get { return "Samsung Electronics"; }
+ }
+
+ public Version VERSION
+ {
+ get { return version; }
+ }
+
+ public void Init()
+ {
+ InitCheckerConfig();
+ MakeCheckerConfig();
+ }
+
+ protected void InitCheckerConfig()
+ {
+ string dexterConfig;
+ try
+ {
+ var assembly = Assembly.GetExecutingAssembly();
+ var resourceName = pluginName + DEFAULT_CHECKER_CONFIG_PATH;
+ using (Stream stream = assembly.GetManifestResourceStream(resourceName))
+ using (StreamReader reader = new StreamReader(stream))
+ {
+ dexterConfig = reader.ReadToEnd();
+ }
+
+ baseCheckerConfig = JsonConvert.DeserializeObject(dexterConfig
+ , new JsonSerializerSettings
+ {
+ NullValueHandling = NullValueHandling.Ignore
+ });
+ }
+ catch (Exception e)
+ {
+ CliLog.Error("There is no plug-in in directory.");
+ CliLog.Error(e.StackTrace);
+ Environment.Exit(0);
+ }
+ }
+
+ protected void MakeCheckerConfig()
+ {
+ CheckerConfig.ToolName = baseCheckerConfig.ToolName;
+ CheckerConfig.Language = baseCheckerConfig.Language;
+ foreach (Checker checker in baseCheckerConfig.CheckerList)
+ {
+ CheckerConfig.AddCheckerList(checker);
+ }
+ }
+
+ public bool SupportLanguage(DexterConfig.LANGUAGE language)
+ {
+ if (language.Equals(DexterConfig.LANGUAGE.C_SHARP))
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ private string GetFileContents(string fileName)
+ {
+ string fileContent;
+ var fileStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
+ using (var streamReader = new StreamReader(fileStream, Encoding.UTF8))
+ {
+ fileContent = streamReader.ReadToEnd();
+ }
+ return fileContent;
+ }
+
+ public AnalysisResult Analyze(AnalysisConfig config)
+ {
+ IAnalysisEntityFactory factory = new AnalysisEntityFactory();
+ AnalysisResult result = factory.CreateAnalysisResult(config);
+
+ var tree = CSharpSyntaxTree.ParseText(GetFileContents(config.SourceFileFullPath));
+ DexterCRCUtil.ToolName = checkerConfig.ToolName;
+ SyntaxNode syntaxRoot = tree.GetRoot();
+
+ foreach (Checker checker in CheckerConfig.CheckerList)
+ {
+ if (!checker.IsActive)
+ {
+ continue;
+ }
+ ICRCLogic logic = GetCheckerLogic(checker.Code);
+
+ logic.Analyze(config, result, checker, syntaxRoot);
+ }
+ return result;
+ }
+
+ private ICRCLogic GetCheckerLogic(string code)
+ {
+ return (ICRCLogic)Activator.CreateInstance(Type.GetType(PLUGIN_NAME + "." + code, true));
+ }
+
+ public void Dispose()
+ {
+ //TODO:
+ }
+ }
+}
diff --git a/project/dexter-cs/DexterCRC/Src/Util/DexterCRCUtil.cs b/project/dexter-cs/DexterCRC/Src/Util/DexterCRCUtil.cs
new file mode 100644
index 00000000..85336955
--- /dev/null
+++ b/project/dexter-cs/DexterCRC/Src/Util/DexterCRCUtil.cs
@@ -0,0 +1,114 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using DexterCS;
+using Microsoft.CodeAnalysis;
+using Microsoft.CodeAnalysis.CSharp;
+using Microsoft.CodeAnalysis.CSharp.Syntax;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace DexterCRC
+{
+ public class DexterCRCUtil
+ {
+ public const string DELEGATE_SUFFIX = "Delegate";
+ public const string EVENT_CLASS_SUFFIX = "EventArgs";
+ public const string EVENT_TYPE_SUFFIX = "EventHandler";
+ public const string ATTRIBUTE_CLASS_SUFFIX = "Attribute";
+ public static string ToolName { get; set; }
+
+ internal static string GetClassName(IEnumerable typeEnumerable)
+ {
+ string className = null;
+ try
+ {
+ className = typeEnumerable.First().Identifier.ToString();
+ }
+ catch (InvalidOperationException)
+ {
+ className = "";
+ }
+ return className;
+ }
+
+ private static string GetMethodName(IEnumerable methodEnumrable)
+ {
+ string methodName = null;
+ try
+ {
+ methodName = methodEnumrable.First().Identifier.ToString();
+ }
+ catch (InvalidOperationException)
+ {
+ methodName = "";
+ }
+ return methodName;
+ }
+
+ internal static PreOccurence MakePreOccurence(CSharpSyntaxNode raw, FileLinePositionSpan lineSpan,
+ Checker checker, AnalysisConfig config, string baseCheckerName, string baseDescription)
+ {
+ PreOccurence preOcc = new PreOccurence();
+ preOcc.CheckerCode = checker.Code + baseCheckerName;
+ preOcc.FileName = config.FileName;
+ preOcc.ModulePath = config.ModulePath;
+ preOcc.ClassName = GetClassName(raw.AncestorsAndSelf().OfType());
+ preOcc.MethodName = GetMethodName(raw.AncestorsAndSelf().OfType());
+ preOcc.Language = config.GetLanguageEnum().ToString();
+ preOcc.SeverityCode = checker.SeverityCode;
+ preOcc.CategoryName = checker.CategoryName;
+ preOcc.Message = GetOccurenceMessage(baseDescription, checker.Description);
+ preOcc.ToolName = ToolName;
+ preOcc.StartLine = lineSpan.StartLinePosition.Line + 1;
+ preOcc.EndLine = lineSpan.EndLinePosition.Line + 1;
+ preOcc.CharStart = lineSpan.StartLinePosition.Character;
+ preOcc.CharEnd = lineSpan.EndLinePosition.Character;
+ preOcc.VariableName = "";
+ preOcc.StringValue = "";
+ return preOcc;
+ }
+
+ private static string GetOccurenceMessage(string baseName, string description)
+ {
+ return baseName + description;
+ }
+
+ public static bool HasPrefix(string name, string prefix)
+ {
+ return (!string.IsNullOrEmpty(name) &&
+ name.StartsWith(prefix, StringComparison.CurrentCulture));
+ }
+
+ public static bool HasSuffix(string name, string suffix)
+ {
+ return (!string.IsNullOrEmpty(name) &&
+ name.EndsWith(suffix, StringComparison.CurrentCulture));
+ }
+ }
+}
diff --git a/project/dexter-cs/DexterCRC/Src/Util/OpenNLPUtil.cs b/project/dexter-cs/DexterCRC/Src/Util/OpenNLPUtil.cs
new file mode 100644
index 00000000..5338c20c
--- /dev/null
+++ b/project/dexter-cs/DexterCRC/Src/Util/OpenNLPUtil.cs
@@ -0,0 +1,138 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using DexterCS;
+using log4net;
+using OpenNLP.Tools.PosTagger;
+using System;
+using System.IO;
+
+namespace DexterCRC.Src.Util
+{
+ public static class OpenNLPUtil
+ {
+ private static ILog CliLog = LogManager.GetLogger(typeof(DexterUtil));
+
+ public static string ENGLISH_POS_DICTIONARY
+ {
+ get
+ {
+ return DexterConfig.Instance.DexterHome
+ + DexterUtil.FILE_SEPARATOR + "bin"
+ + DexterUtil.FILE_SEPARATOR + "dexterCS"
+ + DexterUtil.FILE_SEPARATOR + "EnglishPOS.nbin";
+ }
+ }
+
+ // Source of tags https://www.ling.upenn.edu/courses/Fall_2003/ling001/penn_treebank_pos.html
+
+ public static string[] NounTags = { "NN", "NNP", "NNPS", "NNS" };
+
+ public static string[] VerbTags = { "MD", "VB", "VBD", "VBG", "VBN", "VBP", "VBZ" };
+
+ public static string[] AdjectiveTags = { "JJ", "JJR", "JJS" };
+
+ public static string[] AdverbTags = { "RB", "RBR", "RBS", "WRB" };
+
+ public static string[] OtherTags = { "CC", "CD", "DT", "EX", "FW", "IN", "LS", "PDT", "POS", "PRP", "PRP$", "RP", "SYM", "TO", "UH", "WDT", "WP", "WP$" };
+
+ private static EnglishMaximumEntropyPosTagger englishMaximumEntropyPosTagger;
+
+ private static bool DoesWordMatchAnyOfTags(string word, string[] tags)
+ {
+ string wordTag;
+ try
+ {
+ wordTag = GetTagger().Tag(new string[] { word })[0];
+
+ }
+ catch (Exception e)
+ {
+ CliLog.Error(e.Message);
+ return true;
+ }
+
+ foreach (string tag in tags)
+ {
+ if (wordTag == tag)
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ private static bool IsNoun(string word)
+ {
+ return DoesWordMatchAnyOfTags(word, NounTags);
+ }
+
+ private static bool IsVerb(string word)
+ {
+ return DoesWordMatchAnyOfTags(word, VerbTags);
+ }
+
+ public static bool AreNouns(string[] words)
+ {
+ foreach (string word in words)
+ {
+ if (!IsNoun(word))
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public static bool IsVerbPhrase(string[] words)
+ {
+ foreach (string word in words)
+ {
+ if (IsVerb(word))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private static EnglishMaximumEntropyPosTagger GetTagger()
+ {
+ if (englishMaximumEntropyPosTagger == null)
+ {
+ if (!File.Exists(ENGLISH_POS_DICTIONARY))
+ {
+ throw new DexterRuntimeException("Cannot perform naming analysis. Dictionary not found in directory: " +
+ ENGLISH_POS_DICTIONARY);
+ }
+ englishMaximumEntropyPosTagger = new EnglishMaximumEntropyPosTagger(ENGLISH_POS_DICTIONARY);
+ }
+ return englishMaximumEntropyPosTagger;
+ }
+ }
+}
diff --git a/project/dexter-cs/DexterCRC/packages.config b/project/dexter-cs/DexterCRC/packages.config
new file mode 100644
index 00000000..70a7ee31
--- /dev/null
+++ b/project/dexter-cs/DexterCRC/packages.config
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/project/dexter-cs/DexterCS.sln b/project/dexter-cs/DexterCS.sln
new file mode 100644
index 00000000..7f6aadf5
--- /dev/null
+++ b/project/dexter-cs/DexterCS.sln
@@ -0,0 +1,46 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 15
+VisualStudioVersion = 15.0.27130.2010
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DexterCS", "DexterCS\DexterCS.csproj", "{0FEFCF8D-0A75-40F1-BEEC-21BE6E483C48}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DexterCSTest", "DexterCSTest\DexterCSTest.csproj", "{2468EF67-FA29-463E-942C-2BC2C20FDAD1}"
+ ProjectSection(ProjectDependencies) = postProject
+ {0FEFCF8D-0A75-40F1-BEEC-21BE6E483C48} = {0FEFCF8D-0A75-40F1-BEEC-21BE6E483C48}
+ EndProjectSection
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DexterDepend", "DexterDepend\DexterDepend.csproj", "{83B7B942-BE00-4CC8-98E8-4A19C50F38CD}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DexterCRC", "DexterCRC\DexterCRC.csproj", "{933D5E52-7521-4941-ACAC-B2DACA3AEDAC}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {0FEFCF8D-0A75-40F1-BEEC-21BE6E483C48}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {0FEFCF8D-0A75-40F1-BEEC-21BE6E483C48}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {0FEFCF8D-0A75-40F1-BEEC-21BE6E483C48}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {0FEFCF8D-0A75-40F1-BEEC-21BE6E483C48}.Release|Any CPU.Build.0 = Release|Any CPU
+ {2468EF67-FA29-463E-942C-2BC2C20FDAD1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {2468EF67-FA29-463E-942C-2BC2C20FDAD1}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {2468EF67-FA29-463E-942C-2BC2C20FDAD1}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {2468EF67-FA29-463E-942C-2BC2C20FDAD1}.Release|Any CPU.Build.0 = Release|Any CPU
+ {83B7B942-BE00-4CC8-98E8-4A19C50F38CD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {83B7B942-BE00-4CC8-98E8-4A19C50F38CD}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {83B7B942-BE00-4CC8-98E8-4A19C50F38CD}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {83B7B942-BE00-4CC8-98E8-4A19C50F38CD}.Release|Any CPU.Build.0 = Release|Any CPU
+ {933D5E52-7521-4941-ACAC-B2DACA3AEDAC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {933D5E52-7521-4941-ACAC-B2DACA3AEDAC}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {933D5E52-7521-4941-ACAC-B2DACA3AEDAC}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {933D5E52-7521-4941-ACAC-B2DACA3AEDAC}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {BBFC4DB5-D3E1-4D4F-8BB8-01834F42B3FF}
+ EndGlobalSection
+EndGlobal
diff --git a/project/dexter-cs/DexterCS.sln.licenseheader b/project/dexter-cs/DexterCS.sln.licenseheader
new file mode 100644
index 00000000..e1a6a266
--- /dev/null
+++ b/project/dexter-cs/DexterCS.sln.licenseheader
@@ -0,0 +1,29 @@
+extensions: .Designer.cs
+extensions: .cs
+#region Copyright notice
+/**
+ * Copyright (c) %CurrentYear% Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
\ No newline at end of file
diff --git a/project/dexter-cs/DexterCS/App.config b/project/dexter-cs/DexterCS/App.config
new file mode 100644
index 00000000..9eb12e9a
--- /dev/null
+++ b/project/dexter-cs/DexterCS/App.config
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/project/dexter-cs/DexterCS/DexterCS.csproj b/project/dexter-cs/DexterCS/DexterCS.csproj
new file mode 100644
index 00000000..b788c249
--- /dev/null
+++ b/project/dexter-cs/DexterCS/DexterCS.csproj
@@ -0,0 +1,212 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {0FEFCF8D-0A75-40F1-BEEC-21BE6E483C48}
+ Exe
+ Properties
+ DexterCS
+ DexterCS
+ v4.7.1
+ 512
+ true
+
+
+
+
+
+ AnyCPU
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+ false
+ true
+
+
+ AnyCPU
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+ DexterCS.DexterCSMain
+
+
+
+ ..\packages\CommandLineParser.2.0.61-alpha\lib\net45\CommandLine.dll
+ True
+
+
+ ..\packages\log4net.2.0.8\lib\net45-full\log4net.dll
+ True
+
+
+ ..\packages\Microsoft.CodeAnalysis.Common.1.1.0\lib\net45\Microsoft.CodeAnalysis.dll
+
+
+ ..\packages\Microsoft.CodeAnalysis.CSharp.1.1.0\lib\net45\Microsoft.CodeAnalysis.CSharp.dll
+
+
+ ..\packages\Microsoft.CodeAnalysis.CSharp.Workspaces.1.1.0\lib\net45\Microsoft.CodeAnalysis.CSharp.Workspaces.dll
+
+
+ ..\packages\Microsoft.CodeAnalysis.VisualBasic.1.1.0\lib\net45\Microsoft.CodeAnalysis.VisualBasic.dll
+
+
+ ..\packages\Microsoft.CodeAnalysis.VisualBasic.Workspaces.1.1.0\lib\net45\Microsoft.CodeAnalysis.VisualBasic.Workspaces.dll
+
+
+ ..\packages\Microsoft.CodeAnalysis.Workspaces.Common.1.1.0\lib\net45\Microsoft.CodeAnalysis.Workspaces.dll
+
+
+ ..\packages\Microsoft.CodeAnalysis.Workspaces.Common.1.1.0\lib\net45\Microsoft.CodeAnalysis.Workspaces.Desktop.dll
+
+
+ ..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.3\lib\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll
+ True
+
+
+ ..\packages\Newtonsoft.Json.4.5.11\lib\net40\Newtonsoft.Json.dll
+ True
+
+
+ ..\packages\OpenNLP.1.3.4\lib\net45\OpenNLP.dll
+
+
+ ..\packages\OpenNLP.1.3.4\lib\net45\SharpEntropy.dll
+
+
+
+ ..\packages\System.Collections.Immutable.1.1.37\lib\dotnet\System.Collections.Immutable.dll
+
+
+ ..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.AttributedModel.dll
+
+
+ ..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.Convention.dll
+
+
+ ..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.Hosting.dll
+
+
+ ..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.Runtime.dll
+
+
+ ..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.TypedParts.dll
+
+
+
+
+ ..\packages\Microsoft.AspNet.WebApi.Client.5.2.0\lib\net45\System.Net.Http.Formatting.dll
+ True
+
+
+
+ ..\packages\System.Reflection.Metadata.1.1.0\lib\dotnet5.2\System.Reflection.Metadata.dll
+
+
+ ..\packages\Microsoft.AspNet.WebApi.Core.5.2.0\lib\net45\System.Web.Http.dll
+ True
+
+
+ ..\packages\Microsoft.AspNet.WebApi.WebHost.5.2.0\lib\net45\System.Web.Http.WebHost.dll
+ True
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Designer
+
+
+
+
+
+
+
+
+
+
+ 이 프로젝트는 이 컴퓨터에 없는 NuGet 패키지를 참조합니다. 해당 패키지를 다운로드하려면 NuGet 패키지 복원을 사용하십시오. 자세한 내용은 http://go.microsoft.com/fwlink/?LinkID=322105를 참조하십시오. 누락된 파일은 {0}입니다.
+
+
+
+
+
\ No newline at end of file
diff --git a/project/dexter-cs/DexterCS/DexterCS.csproj.user b/project/dexter-cs/DexterCS/DexterCS.csproj.user
new file mode 100644
index 00000000..d24c827f
--- /dev/null
+++ b/project/dexter-cs/DexterCS/DexterCS.csproj.user
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/project/dexter-cs/DexterCS/Properties/AssemblyInfo.cs b/project/dexter-cs/DexterCS/Properties/AssemblyInfo.cs
new file mode 100644
index 00000000..c86e687d
--- /dev/null
+++ b/project/dexter-cs/DexterCS/Properties/AssemblyInfo.cs
@@ -0,0 +1,45 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using System.Reflection;
+using System.Runtime.InteropServices;
+
+[assembly: AssemblyTitle("DexterCS")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("DexterCS")]
+[assembly: AssemblyCopyright("")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+[assembly: ComVisible(false)]
+
+[assembly: Guid("0fefcf8d-0a75-40f1-beec-21be6e483c48")]
+
+[assembly: AssemblyVersion("0.0.1.0")]
+[assembly: AssemblyFileVersion("0.0.1.0")]
diff --git a/project/dexter-cs/DexterCS/Src/AnalysisConfig.cs b/project/dexter-cs/DexterCS/Src/AnalysisConfig.cs
new file mode 100644
index 00000000..916dd12d
--- /dev/null
+++ b/project/dexter-cs/DexterCS/Src/AnalysisConfig.cs
@@ -0,0 +1,195 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using log4net;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.IO;
+
+namespace DexterCS
+{
+ public class AnalysisConfig : BaseAnalysisEntity
+ {
+ private static ILog CliLog = LogManager.GetLogger(typeof(AnalysisConfig));
+
+ private string Sourcecode { get; set; }
+ private List sourceBaseDirList = new List(0);
+ private List headerBaseDirList = new List(0);
+ internal long GroupId { get { return -1; } }
+ private string outputDir = "";
+
+ public IList SourceBaseDirList { get; set; }
+ public IList HeaderBaseDirList { get; set; }
+ private string OutputDir
+ {
+ get { return outputDir; }
+ set
+ {
+ value = value.Replace("\\", "/").Replace("(\r\n|\n)", "/");
+ if (value.EndsWith("\\", StringComparison.CurrentCulture)
+ || value.EndsWith("/", StringComparison.CurrentCulture))
+ {
+ value = value.Substring(0, value.Length - 1);
+ }
+ this.outputDir = value;
+ }
+ }
+
+ [DefaultValue(false)]
+ private Boolean ShouldSendSourceCode { get; set; }
+
+ public AnalysisConfig()
+ {
+ InitAllListTypeField();
+ }
+
+ public DexterConfig.AnalysisType AnalysisConfigType { get; set; }
+ public AnalysisConfig(AnalysisConfig other) : base(other)
+ {
+ ShouldSendSourceCode = other.ShouldSendSourceCode;
+ SourceBaseDirList = other.SourceBaseDirList;
+ HeaderBaseDirList = other.HeaderBaseDirList;
+ OutputDir = other.OutputDir;
+ Sourcecode = other.Sourcecode;
+ AnalysisConfigType = other.AnalysisConfigType;
+ }
+ public string SourcecodeFromFile
+ {
+ get { return DexterUtil.GetSourcecodeFromFile(SourceFileFullPath); }
+ }
+
+ public IAnalysisResultHandler ResultHandler { get; set; }
+
+ public void AddHeaderAndSourceConfiguration(List projectAnalysisConfigurationList)
+ {
+ foreach (var param in projectAnalysisConfigurationList)
+ {
+ if (param.ProjectName.Equals(ProjectName) &&
+ DexterUtil.RefinePath(param.ProjectFullPath).Equals(ProjectFullPath))
+ {
+ foreach (string dir in param.SourceDirs)
+ {
+ AddSourceBaseDirList(dir);
+ }
+ foreach (string dir in param.HeaderDirs)
+ {
+ AddHeaderBaseDirList(dir);
+ }
+ }
+ }
+ }
+
+ private void AddHeaderBaseDirList(string dir)
+ {
+ if (string.IsNullOrEmpty(dir) || this.headerBaseDirList.Contains(dir))
+ {
+ return;
+ }
+
+ dir = dir.Replace("\\", "/").Replace(DexterUtil.FILE_SEPARATOR, "/");
+
+ if (dir.EndsWith("\\", StringComparison.CurrentCulture)
+ || dir.EndsWith("/", StringComparison.CurrentCulture)
+ || dir.EndsWith(DexterUtil.FILE_SEPARATOR, StringComparison.CurrentCulture))
+ {
+ dir = dir.Substring(0, dir.Length - 1);
+ }
+ this.headerBaseDirList.Add(dir);
+ }
+
+ private void AddSourceBaseDirList(string dir)
+ {
+ if (string.IsNullOrEmpty(dir) || this.sourceBaseDirList.Contains(dir))
+ {
+ return;
+ }
+
+ dir = dir.Replace("\\", "/").Replace(DexterUtil.FILE_SEPARATOR, "/");
+
+ if (dir.EndsWith("\\", StringComparison.CurrentCulture)
+ || dir.EndsWith("/", StringComparison.CurrentCulture)
+ || dir.EndsWith(DexterUtil.FILE_SEPARATOR, StringComparison.CurrentCulture))
+ {
+ dir = dir.Substring(0, dir.Length - 1);
+ }
+ this.sourceBaseDirList.Add(dir);
+ }
+
+
+ private void InitAllListTypeField()
+ {
+ SourceBaseDirList = new List();
+ HeaderBaseDirList = new List();
+ }
+
+ public void GenerateFileNameWithSourceFileFullPath()
+ {
+ FileName = (new FileInfo(SourceFileFullPath)).Name;
+ }
+
+ internal void GenerateModulePath()
+ {
+ foreach (string sourceDir in SourceBaseDirList)
+ {
+ if (HandleGeneratingModulePath(sourceDir))
+ {
+ break;
+ }
+ }
+ }
+
+ private bool HandleGeneratingModulePath(string sourceDir)
+ {
+ try
+ {
+ if (SourceFileFullPath.StartsWith(sourceDir, StringComparison.CurrentCulture))
+ {
+ int baseIndex = sourceDir.Length + 1;
+ int endIndex = SourceFileFullPath.IndexOf(FileName, StringComparison.CurrentCulture);
+ if (baseIndex > endIndex || baseIndex < 0 || endIndex < 0)
+ {
+ throw new Exception("cannot calculate the positions of module path:"
+ + " sourceDir:" + sourceDir
+ + " sourceFileFullPath:" + SourceFileFullPath
+ + " fileName:" + FileName);
+ }
+ int length = endIndex - baseIndex;
+ ModulePath = SourceFileFullPath.Substring(baseIndex, length);
+ return true;
+ }
+ }
+ catch (Exception e)
+ {
+ CliLog.Error(e.Message);
+ CliLog.Error(e.StackTrace);
+ return false;
+ }
+ return false;
+ }
+ }
+}
\ No newline at end of file
diff --git a/project/dexter-cs/DexterCS/Src/AnalysisEntityFactory.cs b/project/dexter-cs/DexterCS/Src/AnalysisEntityFactory.cs
new file mode 100644
index 00000000..9e987bfd
--- /dev/null
+++ b/project/dexter-cs/DexterCS/Src/AnalysisEntityFactory.cs
@@ -0,0 +1,78 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using System.Collections.Generic;
+
+namespace DexterCS
+{
+ public class AnalysisEntityFactory : IAnalysisEntityFactory
+ {
+ public AnalysisConfig CreateAnalysisConfig()
+ {
+ return new AnalysisConfig();
+ }
+
+ public AnalysisConfig CopyAnalysisConfigWithoutSourcecode(AnalysisConfig baseAnalysisConfig)
+ {
+ return new AnalysisConfig(baseAnalysisConfig);
+ }
+
+ public AnalysisResult CreateAnalysisResult(AnalysisConfig config)
+ {
+ AnalysisResult result = new AnalysisResult();
+ result.FileName = config.FileName;
+ result.ModulePath = config.ModulePath;
+ result.ProjectName = config.ProjectName;
+ result.ProjectFullPath = config.ProjectFullPath;
+ result.SnapshotId = config.SnapshotId;
+ result.SourceFileFullPath = config.SourceFileFullPath;
+ result.ResultFileFullPath = config.ResultFileFullPath;
+ result.AnalysisType = config.AnalysisConfigType;
+ return result;
+ }
+ public AnalysisResult CreateAnalysisResultList(List resultList)
+ {
+ AnalysisResult result = new AnalysisResult();
+ AnalysisResult baseResult = resultList[0];
+
+ result.FileName = baseResult.FileName;
+ result.ModulePath = baseResult.ModulePath;
+ result.ProjectFullPath = baseResult.ProjectFullPath;
+ result.ProjectName = baseResult.ProjectName;
+ result.SnapshotId = baseResult.SnapshotId;
+ result.SourceFileFullPath = baseResult.SourceFileFullPath;
+ result.ResultFileFullPath = baseResult.ResultFileFullPath;
+
+ foreach (var temp in resultList)
+ {
+ result.DefectList.AddRange(temp.DefectList);
+ }
+ return result;
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/project/dexter-cs/DexterCS/Src/AnalysisResult.cs b/project/dexter-cs/DexterCS/Src/AnalysisResult.cs
new file mode 100644
index 00000000..f199a18d
--- /dev/null
+++ b/project/dexter-cs/DexterCS/Src/AnalysisResult.cs
@@ -0,0 +1,88 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using System.Collections.Generic;
+
+namespace DexterCS
+{
+ public class AnalysisResult : BaseAnalysisEntity
+ {
+ public AnalysisResult() { }
+
+ private List defectList = new List();
+ public List DefectList { get { return defectList; } }
+
+ public void AddDefect(Defect defect)
+ {
+ if (defectList.Contains(defect))
+ {
+ return;
+ }
+ defectList.Add(defect);
+ }
+
+ public void AddDefectWithPreOccurence(PreOccurence preOcc)
+ {
+ if (preOcc.StartLine == -1)
+ {
+ return;
+ }
+ bool isNewDefect = true;
+ foreach (var defect in DefectList)
+ {
+ defect.AnalysisType = AnalysisType;
+
+ if (defect.Equals(preOcc))
+ {
+ bool IsDifferentOcc = true;
+ foreach (var occ in defect.Occurences)
+ {
+ if (occ.Equals(preOcc))
+ {
+ IsDifferentOcc = false;
+ break;
+ }
+ }
+ if (IsDifferentOcc)
+ {
+ defect.AddOccurence(preOcc.ToOccurence());
+ }
+ isNewDefect = false;
+ break;
+ }
+ }
+
+ if (isNewDefect)
+ {
+ Defect defect = preOcc.ToDefect();
+ defect.AnalysisType = AnalysisType;
+ defect.AddOccurence(preOcc.ToOccurence());
+ defectList.Add(defect);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/project/dexter-cs/DexterCS/Src/AnalysisResultFileManager.cs b/project/dexter-cs/DexterCS/Src/AnalysisResultFileManager.cs
new file mode 100644
index 00000000..90800de7
--- /dev/null
+++ b/project/dexter-cs/DexterCS/Src/AnalysisResultFileManager.cs
@@ -0,0 +1,166 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using log4net;
+using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Text;
+
+namespace DexterCS
+{
+ public class AnalysisResultFileManager
+ {
+ private static ILog CliLog = LogManager.GetLogger(typeof(AnalysisResultFileManager));
+ private static AnalysisResultFileManager instance = null;
+ private static readonly object padlock = new object();
+
+ public static AnalysisResultFileManager Instance
+ {
+ get
+ {
+ lock (padlock)
+ {
+ if (instance == null)
+ {
+ instance = new AnalysisResultFileManager();
+ }
+ return instance;
+ }
+ }
+ }
+
+ internal void WriteJson(List resultList)
+ {
+ if (resultList.Count == 0)
+ {
+ return;
+ }
+
+ string resultFolderStr = DexterConfig.Instance.DexterHome + "/" + DexterConfig.RESULT_FOLDER_NAME;
+ DexterUtil.CreateFolderIfNotExist(resultFolderStr);
+
+ IAnalysisEntityFactory factory = new AnalysisEntityFactory();
+ AnalysisResult baseResult = factory.CreateAnalysisResultList(resultList);
+ RemoveOldResultFile(baseResult, resultFolderStr);
+ WriteJsonResult(baseResult, resultFolderStr);
+
+ }
+
+ private void RemoveOldResultFile(AnalysisResult result, string resultFolderStr)
+ {
+ DirectoryInfo di = new DirectoryInfo(resultFolderStr);
+ string resultFileName = GetResultFilePrefixName(result.ModulePath, result.FileName) + "_";
+ FileInfo[] fiList = di.GetFiles(resultFileName + "*");
+ foreach (var fi in fiList)
+ {
+ try
+ {
+ fi.Delete();
+ }
+ catch (Exception e)
+ {
+ CliLog.Error(e.StackTrace);
+ }
+
+ }
+ }
+
+ private void WriteJsonResult(AnalysisResult result, string resultFolderStr)
+ {
+ StringBuilder contents = CreateJsonFormat(result);
+ FileInfo resultFile = GetResultFilePath(result, resultFolderStr);
+ DexterUtil.WriteFilecontents(contents.ToString(), resultFile);
+ }
+
+ private FileInfo GetResultFilePath(AnalysisResult result, string resultFolderStr)
+ {
+ string path = resultFolderStr + "/" + GetResultFilePrefixName(result.ModulePath, result.FileName) +
+ "_" + DexterUtil.GetCurrentDateTimeMillis() + ResultFileConstant.RESULT_FILE_EXTENSION;
+ FileInfo resultFile = DexterUtil.CreateEmptyFileIfDoesNotExist(path);
+ return resultFile;
+ }
+
+ public string GetResultFilePrefixName(string modulePath, string fileName)
+ {
+ return ResultFileConstant.RESULT_FILE_PREFIX + fileName + "_" + modulePath.GetHashCode();
+ }
+
+ private StringBuilder CreateJsonFormat(AnalysisResult result)
+ {
+ StringBuilder contents = new StringBuilder(1024);
+
+ AddGeneralContent(result, contents);
+ AddDefectContent(result, contents);
+ contents.Append(Environment.NewLine).Remove(contents.Length - 1, 1);
+
+ return contents;
+ }
+
+ private void AddDefectContent(AnalysisResult result, StringBuilder contents)
+ {
+ contents.Append(",\"").Append(ResultFileConstant.DEFECT_LIST).Append("\":[");
+ int i = 0;
+ foreach (var defect in result.DefectList)
+ {
+ if (i != 0)
+ {
+ contents.Append(",");
+ }
+
+ contents.Append(JsonConvert.SerializeObject(defect));
+ i++;
+ }
+ contents.Append("]}");
+ }
+
+ private void AddGeneralContent(AnalysisResult result, StringBuilder contents)
+ {
+ contents.Append("{\"").Append(ResultFileConstant.SNAPSHOT_ID).Append("\":\"").Append(result.SnapshotId).Append("\"");
+
+ AddOptionalContent(contents, ResultFileConstant.MODULE_PATH, result.ModulePath);
+ AddOptionalContent(contents, ResultFileConstant.FILE_NAME, result.FileName);
+ AddOptionalContent(contents, ResultFileConstant.FULL_FILE_PATH, result.SourceFileFullPath);
+ AddOptionalContent(contents, ResultFileConstant.PROJECT_NAME, result.ProjectName);
+
+ contents.Append(",\"").Append(ResultFileConstant.GROUP_ID).Append("\":\"").Append(ResultFileConstant.DEFAULT_GROUPT_IP)
+ .Append("\"").Append(",\"").Append(ResultFileConstant.DEFECT_COUNT).Append("\":\"")
+ .Append(result.DefectList.Count).Append("\"");
+ }
+
+ private void AddOptionalContent(StringBuilder contents, string key, string value)
+ {
+
+ if (String.IsNullOrEmpty(value))
+ {
+ return;
+ }
+ contents.Append(",\"").Append(key).Append("\":\"").Append(value).Append("\"");
+ }
+ }
+}
diff --git a/project/dexter-cs/DexterCS/Src/AvailablePlugin.cs b/project/dexter-cs/DexterCS/Src/AvailablePlugin.cs
new file mode 100644
index 00000000..834f515b
--- /dev/null
+++ b/project/dexter-cs/DexterCS/Src/AvailablePlugin.cs
@@ -0,0 +1,34 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+namespace DexterCS
+{
+ public class AvailablePlugin
+ {
+ public IDexterPlugin Instance { get; set; }
+ }
+}
diff --git a/project/dexter-cs/DexterCS/Src/AvailablePlugins.cs b/project/dexter-cs/DexterCS/Src/AvailablePlugins.cs
new file mode 100644
index 00000000..bc0f6fe7
--- /dev/null
+++ b/project/dexter-cs/DexterCS/Src/AvailablePlugins.cs
@@ -0,0 +1,76 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using System.Collections;
+
+namespace DexterCS
+{
+ class AvailablePlugins : CollectionBase
+ {
+ //A Simple Home-brew class to hold some info about our Available Plugins
+
+ ///
+ /// Add a Plugin to the collection of Available plugins
+ ///
+ /// The Plugin to Add
+ public void Add(AvailablePlugin pluginToAdd)
+ {
+ this.List.Add(pluginToAdd);
+ }
+
+ ///
+ /// Remove a Plugin to the collection of Available plugins
+ ///
+ /// The Plugin to Remove
+ public void Remove(AvailablePlugin pluginToRemove)
+ {
+ this.List.Remove(pluginToRemove);
+ }
+
+ ///
+ /// Finds a plugin in the available Plugins
+ ///
+ /// The name or File path of the plugin to find
+ /// Available Plugin, or null if the plugin is not found
+ public AvailablePlugin Find(string pluginNameOrPath)
+ {
+ AvailablePlugin toReturn = null;
+
+ //Loop through all the plugins
+ foreach (AvailablePlugin pluginOn in this.List)
+ {
+ //Find the one with the matching name or filename
+ if ((pluginOn.Instance.PLUGIN_NAME.Equals(pluginNameOrPath)))
+ {
+ toReturn = pluginOn;
+ break;
+ }
+ }
+ return toReturn;
+ }
+ }
+}
diff --git a/project/dexter-cs/DexterCS/Src/BaseAnalysisEntity.cs b/project/dexter-cs/DexterCS/Src/BaseAnalysisEntity.cs
new file mode 100644
index 00000000..6f1bd07c
--- /dev/null
+++ b/project/dexter-cs/DexterCS/Src/BaseAnalysisEntity.cs
@@ -0,0 +1,49 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+namespace DexterCS
+{
+ public class BaseAnalysisEntity : TargetFile
+ {
+ public string ProjectName { get; set; }
+ public string ProjectFullPath { get; set; }
+ public string SourceFileFullPath { get; set; }
+ public string ResultFileFullPath { get; set; }
+ public long SnapshotId { get; set; }
+ public DexterConfig.AnalysisType AnalysisType { get; set; }
+
+ protected BaseAnalysisEntity() { }
+ protected BaseAnalysisEntity(BaseAnalysisEntity entitiy) : base(entitiy)
+ {
+ ProjectName = entitiy.ProjectName;
+ ProjectFullPath = entitiy.ProjectFullPath;
+ SnapshotId = entitiy.SnapshotId;
+ SourceFileFullPath = entitiy.SourceFileFullPath;
+ ResultFileFullPath = entitiy.ResultFileFullPath;
+ }
+ }
+}
\ No newline at end of file
diff --git a/project/dexter-cs/DexterCS/Src/BaseCheckerConfig.cs b/project/dexter-cs/DexterCS/Src/BaseCheckerConfig.cs
new file mode 100644
index 00000000..5b2303e9
--- /dev/null
+++ b/project/dexter-cs/DexterCS/Src/BaseCheckerConfig.cs
@@ -0,0 +1,43 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using Newtonsoft.Json;
+using System.Collections.Generic;
+
+namespace DexterCS
+{
+ [JsonObject(MemberSerialization.OptIn)]
+ public class BaseCheckerConfig
+ {
+ [JsonProperty("checkerList")]
+ public List CheckerList { get; set; }
+ [JsonProperty("toolName")]
+ public string ToolName { get; set; }
+ [JsonProperty("language")]
+ public DexterConfig.LANGUAGE Language { get; set; }
+ }
+}
diff --git a/project/dexter-cs/DexterCS/Src/BaseDefect.cs b/project/dexter-cs/DexterCS/Src/BaseDefect.cs
new file mode 100644
index 00000000..c2343234
--- /dev/null
+++ b/project/dexter-cs/DexterCS/Src/BaseDefect.cs
@@ -0,0 +1,96 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using Newtonsoft.Json;
+using System;
+
+namespace DexterCS
+{
+ public class BaseDefect : TargetFile
+ {
+ [JsonProperty("checkerCode")]
+ public string CheckerCode { get; set; }
+ [JsonProperty("className")]
+ public string ClassName { get; set; }
+ [JsonProperty("methodName")]
+ public string MethodName { get; set; }
+ [JsonProperty("toolName")]
+ public string ToolName { get; set; }
+ [JsonProperty("language")]
+ public string Language { get; set; }
+
+
+ public override int GetHashCode()
+ {
+ return base.GetHashCode();
+ }
+
+ public override bool Equals(object obj)
+ {
+ if (obj == null)
+ {
+ return false;
+ }
+
+ BaseDefect other = obj as BaseDefect;
+ if ((object)other == null)
+ {
+ return false;
+ }
+
+ if (!Object.Equals(CheckerCode, other.CheckerCode))
+ {
+ return false;
+ }
+ if (!string.IsNullOrEmpty(MethodName) && !Object.Equals(MethodName, other.MethodName))
+ {
+ return false;
+ }
+ if (!string.IsNullOrEmpty(ClassName) && !Object.Equals(ClassName, other.ClassName))
+ {
+ return false;
+ }
+ if (!string.IsNullOrEmpty(FileName) && !Object.Equals(FileName, other.FileName))
+ {
+ return false;
+ }
+ if (!string.IsNullOrEmpty(ModulePath) && !Object.Equals(ModulePath, other.ModulePath))
+ {
+ return false;
+ }
+ if (!string.IsNullOrEmpty(ToolName) && !Object.Equals(ToolName, other.ToolName))
+ {
+ return false;
+ }
+ if (Language != null && !Object.Equals(Language, other.Language))
+ {
+ return false;
+ }
+ return true;
+ }
+ }
+}
diff --git a/project/dexter-cs/DexterCS/Src/BaseDexterPluginManager.cs b/project/dexter-cs/DexterCS/Src/BaseDexterPluginManager.cs
new file mode 100644
index 00000000..cb08a4ac
--- /dev/null
+++ b/project/dexter-cs/DexterCS/Src/BaseDexterPluginManager.cs
@@ -0,0 +1,87 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using DexterCS.Client;
+using log4net;
+using System;
+using System.Collections.Generic;
+
+namespace DexterCS
+{
+ public class BaseDexterPluginManager : IDexterPluginManager
+ {
+ private static ILog CliLog = LogManager.GetLogger(typeof(BaseDexterPluginManager));
+
+ protected List pluginList = new List(0);
+ protected IDexterPluginInitializer initializer;
+ protected IDexterClient client;
+
+ public BaseDexterPluginManager(IDexterPluginInitializer initializer, IDexterClient client)
+ {
+ this.client = client;
+ this.initializer = initializer;
+ }
+
+ public void InitDexterPlugins()
+ {
+ initializer.Init(pluginList);
+ InitSupportingFileExtensions();
+ CliLog.Info("Dexter plug-ins initialized successfully!");
+ }
+
+ private void InitSupportingFileExtensions()
+ {
+ DexterConfig.Instance.RemoveAllSupportingFileExtensions();
+ foreach (IDexterPlugin plugin in pluginList)
+ {
+ DexterConfig.Instance.AddSupportedFileExtensions(plugin.SupportingFileExtensions);
+ }
+ }
+
+ public List Analyze(AnalysisConfig config)
+ {
+ List resultList = new List();
+
+ foreach (IDexterPlugin plugin in pluginList)
+ {
+ if (plugin.SupportLanguage(config.GetLanguageEnum()))
+ {
+ try
+ {
+ var result = plugin.Analyze(config);
+ resultList.Add(result);
+ }
+ catch (Exception e)
+ {
+ CliLog.Error("Analysis Exception:" + config.SourceFileFullPath + "\n" + e.Message);
+ }
+ }
+ }
+ return resultList;
+ }
+ }
+}
\ No newline at end of file
diff --git a/project/dexter-cs/DexterCS/Src/CLIAnalysisResultHandler.cs b/project/dexter-cs/DexterCS/Src/CLIAnalysisResultHandler.cs
new file mode 100644
index 00000000..cfc7662f
--- /dev/null
+++ b/project/dexter-cs/DexterCS/Src/CLIAnalysisResultHandler.cs
@@ -0,0 +1,228 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using DexterCS.Client;
+using DexterCS.Job;
+using log4net;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+
+namespace DexterCS
+{
+ public class CLIAnalysisResultHandler : IAnalysisResultHandler
+ {
+ private ILog cliLog;
+ private IDexterCLIOption cliOption;
+ private string dexterWebUrl;
+
+ private ICLIResultFile cliResultFile = new CLIResultFile();
+
+ private int totalCnt = 0;
+ private int totalOccurenceCnt = 0;
+ private int criticalCnt = 0;
+ private int majorCnt = 0;
+ private int minorCnt = 0;
+ private int etcCnt = 0;
+ private int crcCnt = 0;
+
+ public CLIAnalysisResultHandler(string dexterWebUrl, IDexterCLIOption cliOption, ILog cliLog)
+ {
+ this.dexterWebUrl = dexterWebUrl;
+ this.cliOption = cliOption;
+ this.cliLog = cliLog;
+ }
+
+ public void HandleBeginningOfResultFile()
+ {
+ try
+ {
+ if (cliOption.IsJsonResultFile)
+ {
+ cliResultFile.WriteJsonResultFilePrefix(cliOption.JsonResultFile);
+ }
+ if (cliOption.IsXmlResultFile)
+ {
+ cliResultFile.WriteXmlResultFilePrefix(cliOption.XmlResultFile);
+ }
+ if (cliOption.IsXml2ResultFile)
+ {
+ cliResultFile.WriteXml2ResultFilePrefix(cliOption.Xml2ResultFile);
+ }
+ }
+ catch (IOException e)
+ {
+ cliLog.Error(e.Message, e);
+ }
+ }
+
+ public void HandleEndOfResultFile()
+ {
+ try
+ {
+ if (cliOption.IsXmlResultFile)
+ {
+ cliResultFile.WriteXmlResultFilePostfix(cliOption.XmlResultFile);
+ }
+ else if (cliOption.IsJsonResultFile)
+ {
+ cliResultFile.WriteJsonResultFilePostfix(cliOption.JsonResultFile);
+ }
+ }
+ catch (Exception e)
+ {
+ cliLog.Error(e.StackTrace);
+ }
+ }
+
+ public void PrintLogAfterAnalyze()
+ {
+ cliLog.Info("");
+ cliLog.Info("====================================================");
+ cliLog.Info("- Total Defects: " + totalCnt);
+ cliLog.Info("- Critical Defects: " + criticalCnt);
+ cliLog.Info("- Major Defects: " + majorCnt);
+ cliLog.Info("- Minor Defects: " + minorCnt);
+ cliLog.Info("- CRC Defects: " + crcCnt);
+ cliLog.Info("- Etc. Defects: " + etcCnt);
+ cliLog.Info("- Total Occurences: " + totalOccurenceCnt);
+ cliLog.Info("====================================================");
+ cliLog.Info("");
+ }
+
+ public void HandleAnalysisResult(List resultList, IDexterClient client)
+ {
+ if (resultList.Count == 0)
+ {
+ cliLog.Warn("No defect result");
+ return;
+ }
+
+ List allDefectList = DexterAnalyzer.AllDefectList(resultList);
+ AnalysisResult firstAnalysisResult = resultList[0];
+ string sourceFileFullPath = firstAnalysisResult.SourceFileFullPath;
+
+ try
+ {
+ WriteResultFile(allDefectList, sourceFileFullPath);
+ string resultFilePrefixName = AnalysisResultFileManager.Instance.
+ GetResultFilePrefixName(firstAnalysisResult.ModulePath, firstAnalysisResult.FileName);
+ SendResultJob.SendResultFileThenDelete(client, resultFilePrefixName);
+ }
+ catch (IOException e)
+ {
+ cliLog.Error(e.StackTrace);
+ }
+
+ cliLog.Info(" - " + sourceFileFullPath);
+ if (allDefectList.Count == 0)
+ {
+ cliLog.Info(" > No Defect");
+ return;
+ }
+ else
+ {
+ cliLog.Info(" > Total Defects: " + allDefectList.Count);
+ }
+ PrintDefect(allDefectList);
+ }
+
+ private void PrintDefect(List allDefectList)
+ {
+ foreach (var defect in allDefectList)
+ {
+ switch (defect.SeverityCode)
+ {
+ case "CRI":
+ criticalCnt++;
+ break;
+ case "MAJ":
+ majorCnt++;
+ break;
+ case "MIN":
+ minorCnt++;
+ break;
+ case "CRC":
+ crcCnt++;
+ break;
+ case "ETC":
+ etcCnt++;
+ break;
+ default:
+ defect.SeverityCode = "ETC";
+ etcCnt++;
+ break;
+ }
+ totalCnt++;
+ totalOccurenceCnt += defect.Occurences.Count;
+
+ cliLog.Info(" > " + defect.CheckerCode + " / " + defect.SeverityCode + " / "
+ + defect.Occurences.Count + " / " + defect.MethodName + " / " + defect.ClassName);
+
+ PrintOccurences(defect.Occurences.ToArray());
+ }
+ }
+
+ private void PrintOccurences(Occurence[] occurence)
+ {
+ int i = 0;
+ foreach (var occ in occurence)
+ {
+ i += 1;
+ if (i == occurence.Count())
+ {
+ cliLog.Info(" + " + occ.StartLine + " " + occ.Message + " / " +
+ occ.VariableName + " / " + occ.StringValue);
+ }
+ else
+ {
+ cliLog.Info(" + " + occ.StartLine + " " + occ.Message + " / " +
+ occ.VariableName + " / " + occ.StringValue);
+ }
+ }
+ }
+
+ private void WriteResultFile(List allDefectList, string sourceFileFullPath)
+ {
+ if (cliOption.IsJsonResultFile)
+ {
+ cliResultFile.WriteJsonResultFileBody(cliOption.JsonResultFile, allDefectList);
+ }
+
+ if (cliOption.IsXmlResultFile)
+ {
+ cliResultFile.WriteXmlResultFileBody(cliOption.XmlResultFile, allDefectList, sourceFileFullPath);
+ }
+
+ if (cliOption.IsXml2ResultFile)
+ {
+ cliResultFile.WriteXml2ResultFileBody(cliOption.Xml2ResultFile, allDefectList, sourceFileFullPath);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/project/dexter-cs/DexterCS/Src/CLIDexterPluginManager.cs b/project/dexter-cs/DexterCS/Src/CLIDexterPluginManager.cs
new file mode 100644
index 00000000..0b5455d4
--- /dev/null
+++ b/project/dexter-cs/DexterCS/Src/CLIDexterPluginManager.cs
@@ -0,0 +1,53 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using DexterCS.Client;
+using log4net;
+using System.Collections.Generic;
+
+namespace DexterCS
+{
+ public class CLIDexterPluginManager : BaseDexterPluginManager
+ {
+ private ILog cliLog;
+ private IDexterCLIOption cliOption;
+
+ public CLIDexterPluginManager(IDexterPluginInitializer initializer, IDexterClient client,
+ ILog cliLog, IDexterCLIOption cliOption)
+ : base(initializer, client)
+ {
+ this.cliLog = cliLog;
+ this.cliOption = cliOption;
+ }
+
+ public new void InitDexterPlugins()
+ {
+ pluginList = new List(0);
+ initializer.Init(pluginList);
+ }
+ }
+}
\ No newline at end of file
diff --git a/project/dexter-cs/DexterCS/Src/CLIPluginInitializer.cs b/project/dexter-cs/DexterCS/Src/CLIPluginInitializer.cs
new file mode 100644
index 00000000..25f7b61c
--- /dev/null
+++ b/project/dexter-cs/DexterCS/Src/CLIPluginInitializer.cs
@@ -0,0 +1,108 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using log4net;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Reflection;
+
+namespace DexterCS
+{
+ public class CLIPluginInitializer : IDexterPluginInitializer
+ {
+ private ILog CliLog { get; set; }
+
+ public CLIPluginInitializer(ILog cliLog)
+ {
+ CliLog = cliLog;
+ }
+
+ public void Init(List pluginHandlerList)
+ {
+ string pluginBasePath = DexterConfig.Instance.DexterHome + "/plugin";
+ DirectoryInfo pluginBaseDir = new DirectoryInfo(pluginBasePath);
+ if (pluginBaseDir.Exists == false)
+ {
+ throw new Exception("Dexter Home does not exist");
+ }
+ foreach (string fileOn in Directory.GetFiles(pluginBasePath))
+ {
+ FileInfo file = new FileInfo(fileOn);
+ if (file.Extension.Equals(".dll"))
+ {
+ AddPlugin(pluginHandlerList, fileOn);
+ }
+ }
+
+ InitAllHandler(pluginHandlerList);
+ }
+
+ private void InitAllHandler(List pluginHandlerList)
+ {
+ //FEEDBACK 역할
+ if (pluginHandlerList.Count == 0)
+ {
+ throw new Exception("There are no Dexter plug-ins to load");
+ }
+
+ foreach (var plugin in pluginHandlerList)
+ {
+ plugin.Init();
+ CliLog.Info(plugin.PLUGIN_DESCRIPTION + " :v" + plugin.VERSION + " loaded.");
+ }
+ }
+
+ private void AddPlugin(List pluginHandlerList, string dllFileName)
+ {
+ try
+ {
+ Assembly pluginAssembly = Assembly.LoadFrom(dllFileName);
+ foreach (Type pluginType in pluginAssembly.GetTypes())
+ {
+ if (pluginType.IsPublic)
+ {
+ if (!pluginType.IsAbstract)
+ {
+ Type typeInterface = pluginType.GetInterface("IDexterPlugin", true);
+ if (typeInterface != null)
+ {
+ AvailablePlugin newPlugin = new AvailablePlugin();
+ newPlugin.Instance = (IDexterPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
+ pluginHandlerList.Add(newPlugin.Instance);
+ }
+ }
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ CliLog.Error("Plugin Loading failed:" + e.StackTrace);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/project/dexter-cs/DexterCS/Src/CLIResultFile.cs b/project/dexter-cs/DexterCS/Src/CLIResultFile.cs
new file mode 100644
index 00000000..b2c50ed9
--- /dev/null
+++ b/project/dexter-cs/DexterCS/Src/CLIResultFile.cs
@@ -0,0 +1,191 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Text;
+
+namespace DexterCS
+{
+ public class CLIResultFile : ICLIResultFile
+ {
+ public CLIResultFile() { }
+
+ public void WriteJsonResultFileBody(FileInfo file, List allDefectList)
+ {
+ foreach (var defect in allDefectList)
+ {
+ using (StreamWriter sw = file.AppendText())
+ {
+ sw.Write(JsonConvert.SerializeObject(defect));
+ sw.WriteLine(",");
+ }
+ }
+ }
+
+ public void WriteJsonResultFilePostfix(FileInfo file)
+ {
+ try
+ {
+ using (StreamWriter sw = file.AppendText())
+ {
+ sw.Write("]");
+ }
+ }
+ catch (IOException)
+ {
+ throw new DexterRuntimeException("Exception in method " + DexterUtil.GetCurrentMethodName());
+ }
+ }
+
+ public void WriteJsonResultFilePrefix(FileInfo file)
+ {
+ try
+ {
+ using (StreamWriter sw = file.AppendText())
+ {
+ sw.Write("[");
+ }
+ }
+ catch (IOException)
+ {
+ throw new DexterRuntimeException("Exception in method " + DexterUtil.GetCurrentMethodName());
+ }
+ }
+
+ public void WriteXmlResultFileBody(FileInfo xmlResultFile, List allDefectList, string sourceFileFullPath)
+ {
+ int size = allDefectList.Count * 1024;
+ StringBuilder m;
+ if (size < Int32.MaxValue)
+ m = new StringBuilder(size);
+ else
+ m = new StringBuilder(Int32.MaxValue);
+
+ m.Append("\t\n");
+
+ foreach (Defect defect in allDefectList)
+ {
+ m.Append("\t\t\n");
+ foreach (Occurence o in defect.Occurences)
+ {
+ m.Append("\t\t\t\n");
+ }
+ m.Append("\t\t\n");
+ }
+
+ m.Append("\t\n");
+
+ try
+ {
+ using (StreamWriter sw = xmlResultFile.AppendText())
+ {
+ sw.Write(m.ToString());
+ }
+ }
+ catch (IOException)
+ {
+ throw new DexterRuntimeException("Exception in method " + DexterUtil.GetCurrentMethodName());
+ }
+ }
+
+ public void WriteXmlResultFilePostfix(FileInfo file)
+ {
+ try
+ {
+ using (StreamWriter sw = file.AppendText())
+ {
+ sw.Write("");
+ }
+ }
+ catch (IOException)
+ {
+ throw new DexterRuntimeException("Exception in method " + DexterUtil.GetCurrentMethodName());
+ }
+ }
+
+ public void WriteXmlResultFilePrefix(FileInfo file)
+ {
+ try
+ {
+ using (StreamWriter sw = file.AppendText())
+ {
+ sw.Write("\n");
+ }
+ }
+ catch (IOException)
+ {
+ throw new DexterRuntimeException("Exception in method " + DexterUtil.GetCurrentMethodName());
+ }
+ }
+
+ public void WriteXml2ResultFileBody(FileInfo file, List allDefectList, string sourceFileFullPath)
+ {
+ foreach (var defect in allDefectList)
+ {
+ using (StreamWriter sw = file.AppendText())
+ {
+ sw.WriteLine(",");
+ }
+ }
+ }
+
+ public void WriteXml2ResultFilePostfix(FileInfo file)
+ {
+ try
+ {
+ using (StreamWriter sw = file.AppendText())
+ {
+ sw.Write("");
+ }
+ }
+ catch (IOException)
+ {
+ throw new DexterRuntimeException("Exception in method " + DexterUtil.GetCurrentMethodName());
+ }
+ }
+
+ public void WriteXml2ResultFilePrefix(FileInfo file)
+ {
+ try
+ {
+ using (StreamWriter sw = file.AppendText())
+ {
+ sw.WriteLine("");
+ }
+ }
+ catch (IOException)
+ {
+ throw new DexterRuntimeException("Exception in method " + DexterUtil.GetCurrentMethodName());
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/project/dexter-cs/DexterCS/Src/Checker.cs b/project/dexter-cs/DexterCS/Src/Checker.cs
new file mode 100644
index 00000000..87b20c84
--- /dev/null
+++ b/project/dexter-cs/DexterCS/Src/Checker.cs
@@ -0,0 +1,90 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using Newtonsoft.Json;
+using System;
+
+namespace DexterCS
+{
+
+ [JsonObject(MemberSerialization.OptIn)]
+ public class Checker : IChecker
+ {
+ [JsonProperty("code")]
+ public string Code { get; set; }
+ [JsonProperty("name")]
+ public string Name { get; set; }
+ [JsonProperty("type")]
+ public string Type { get; set; }
+ [JsonProperty("categoryName")]
+ public string CategoryName { get; set; }
+ [JsonProperty("severityCode")]
+ public string SeverityCode { get; set; }
+ [JsonProperty("version")]
+ public string Version { get; set; }
+ [JsonProperty("description")]
+ public string Description { get; set; }
+ [JsonProperty("isActive")]
+ public bool IsActive { get; set; }
+ [JsonProperty("properties")]
+ public Properties Properties { get; set; }
+ [JsonProperty("cwe")]
+ public string Cwe { get; set; }
+
+ public IProperties GetProperties(string key)
+ {
+ if (string.IsNullOrEmpty(key))
+ {
+ return new EmptyProperties();
+ }
+ return Properties;
+ }
+
+ public Checker() { }
+
+ public Checker(string code, string name, string version, Boolean isActive)
+ {
+ Name = name;
+ Code = code;
+ Version = version;
+ IsActive = isActive;
+ }
+
+ public Checker(string code, string name, string type,
+ string version, string description, Boolean isActive, Properties properties, string cwe)
+ {
+ Code = code;
+ Name = name;
+ Type = type;
+ Version = version;
+ Description = description;
+ IsActive = isActive;
+ Properties = properties;
+ Cwe = cwe;
+ }
+ }
+}
diff --git a/project/dexter-cs/DexterCS/Src/CheckerConfig.cs b/project/dexter-cs/DexterCS/Src/CheckerConfig.cs
new file mode 100644
index 00000000..ba40b568
--- /dev/null
+++ b/project/dexter-cs/DexterCS/Src/CheckerConfig.cs
@@ -0,0 +1,67 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using System.Collections.Generic;
+
+namespace DexterCS
+{
+ public class CheckerConfig : ICheckerConfig
+ {
+ public DexterConfig.LANGUAGE Language { get; set; }
+
+ public string ToolName { get; set; }
+
+
+ public Dictionary properties = new Dictionary();
+ public Dictionary Properties { get; set; }
+
+ private List checkerList = new List();
+ public List CheckerList { get { return checkerList; } }
+ public void AddCheckerList(Checker checker)
+ {
+ checkerList.Add(checker);
+ }
+
+ public CheckerConfig(string toolName, DexterConfig.LANGUAGE language)
+ {
+ ToolName = toolName;
+ Language = language;
+ }
+
+ public bool IsActiveChecker(string checkerCode)
+ {
+ IChecker checker = GetChecker(checkerCode);
+ return checker.IsActive;
+ }
+
+ public IChecker GetChecker(string checkerCode)
+ {
+ IChecker checker = CheckerList.Find(c => c.Code == checkerCode);
+ return checker == null ? new EmptyChecker() : checker;
+ }
+ }
+}
\ No newline at end of file
diff --git a/project/dexter-cs/DexterCS/Src/Client/DexterClient.cs b/project/dexter-cs/DexterCS/Src/Client/DexterClient.cs
new file mode 100644
index 00000000..f8589276
--- /dev/null
+++ b/project/dexter-cs/DexterCS/Src/Client/DexterClient.cs
@@ -0,0 +1,131 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using log4net;
+using Newtonsoft.Json;
+using System;
+using System.Net.Http;
+using System.Threading.Tasks;
+
+namespace DexterCS.Client
+{
+ public class DexterClient : IDexterClient
+ {
+ private static readonly ILog CliLog = LogManager.GetLogger(typeof(DexterClient));
+ private IHttpClient httpClient;
+
+ public string ServerAddress { get; set; }
+
+ public DexterClient(IHttpClient httpClient)
+ {
+ this.httpClient = httpClient;
+ }
+
+ public void InitHttpClient(string serverUri)
+ {
+ ServerAddress = serverUri;
+ httpClient.Init(ServerAddress);
+ }
+
+ public string DexterWebUrl { get; set; }
+
+ public string ServerHost { get; set; }
+
+ public int ServerPort { get; set; }
+
+ public string SourceCode(string modulePath, string fileName)
+ {
+ return @"";
+ }
+
+ public async Task SendAnalysisResult(string resultJson)
+ {
+ if (string.IsNullOrEmpty(resultJson))
+ {
+ throw new DexterRuntimeException("The result file has no content to send");
+ }
+
+ if (DexterConfig.Run_Mode.CLI == DexterConfig.Instance.RunMode)
+ {
+ try
+ {
+ HttpResponseMessage response = await httpClient.PostAsJsonAsync(DexterConfig.POST_ANALYSIS_RESULT_V3,
+ new ResultJsonFormat { Result = JsonConvert.DeserializeObject(resultJson) });
+
+ response.EnsureSuccessStatusCode();
+ }
+ catch (Exception e)
+ {
+ CliLog.Error(e.Message);
+ CliLog.Error(e.StackTrace);
+ }
+ }
+ }
+
+ public async Task StoreSourceCodeCharSequence(long snapshotId, long groupId, string modulePath, string fileName, string sourcecode)
+ {
+ try
+ {
+ HttpResponseMessage response = await httpClient.PostAsJsonAsync(DexterConfig.POST_SNAPSHOT_SOURCECODE,
+ new SourceCodeJsonFormat
+ {
+ SnapshotId = snapshotId,
+ GroupId = groupId,
+ ModulePath = modulePath,
+ FileName = fileName,
+ SourceCode = DexterUtil.GetBase64CharSequence(sourcecode)
+ });
+
+ response.EnsureSuccessStatusCode();
+ }
+ catch (Exception e)
+ {
+ CliLog.Error(e.StackTrace);
+ }
+ }
+ }
+
+ public class ResultJsonFormat
+ {
+ [JsonProperty("result")]
+ public ResultJsonParsing Result { get; set; }
+ }
+ public class SourceCodeJsonFormat
+ {
+ [JsonProperty("snapshotId")]
+ public long SnapshotId { get; set; }
+ [JsonProperty("gouprId")]
+ public long GroupId { get; set; }
+ [JsonProperty("modulePath")]
+ public string ModulePath { get; set; }
+ [JsonProperty("fileName")]
+ public string FileName { get; set; }
+ [JsonProperty("sourceCode")]
+ public string SourceCode { get; set; }
+ }
+}
+
diff --git a/project/dexter-cs/DexterCS/Src/Client/DexterHttpClientWrapper.cs b/project/dexter-cs/DexterCS/Src/Client/DexterHttpClientWrapper.cs
new file mode 100644
index 00000000..c1dbebf6
--- /dev/null
+++ b/project/dexter-cs/DexterCS/Src/Client/DexterHttpClientWrapper.cs
@@ -0,0 +1,81 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using System;
+using System.Net.Http;
+using System.Net.Http.Headers;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DexterCS.Client
+{
+ public interface IHttpClient
+ {
+ void Init(string serverAddress);
+ Task GetAsync(string requestUri);
+ Task PostAsJsonAsync(string requestUri, T value);
+ }
+
+ public class DexterHttpClientWrapper : IHttpClient
+ {
+ private static string APPLICATION_TYPE_JSON = "application/json";
+ private DexterServerConfig dexterServerConfig;
+ private HttpClient httpClient;
+
+ public DexterHttpClientWrapper()
+ {
+ httpClient = new HttpClient();
+ }
+
+ public DexterHttpClientWrapper(DexterServerConfig dexterServerConfig)
+ {
+ httpClient = new HttpClient();
+ this.dexterServerConfig = dexterServerConfig;
+ Init(dexterServerConfig.BaseUrl);
+ }
+
+ public Task GetAsync(string requestUri)
+ {
+ return httpClient.GetAsync(requestUri);
+ }
+
+ public void Init(string serverAddress)
+ {
+ httpClient.BaseAddress = new Uri(serverAddress);
+ httpClient.DefaultRequestHeaders.Accept.Clear();
+ var credentials = Convert.ToBase64String(Encoding.ASCII.GetBytes(
+ string.Format("{0}:{1}", dexterServerConfig.UserId, dexterServerConfig.UserPassword)));
+ httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", credentials);
+ httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue(APPLICATION_TYPE_JSON));
+ }
+
+ public Task PostAsJsonAsync(string requestUri, T value)
+ {
+ return httpClient.PostAsJsonAsync(requestUri, value);
+ }
+ }
+}
diff --git a/project/dexter-cs/DexterCS/Src/Client/IDexterClient.cs b/project/dexter-cs/DexterCS/Src/Client/IDexterClient.cs
new file mode 100644
index 00000000..a071d939
--- /dev/null
+++ b/project/dexter-cs/DexterCS/Src/Client/IDexterClient.cs
@@ -0,0 +1,42 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using System.Threading.Tasks;
+
+namespace DexterCS.Client
+{
+ public interface IDexterClient
+ {
+ int ServerPort { get; set; }
+ string ServerHost { get; set; }
+ string DexterWebUrl { get; set; }
+ string SourceCode(string modulePath, string fileName);
+ Task SendAnalysisResult(string result);
+ Task StoreSourceCodeCharSequence(long snapshotId, long groupId, string modulePath, string fileName, string sourcecode);
+ void InitHttpClient(string serverUrl);
+ }
+}
diff --git a/project/dexter-cs/DexterCS/Src/CommandLineAssert.cs b/project/dexter-cs/DexterCS/Src/CommandLineAssert.cs
new file mode 100644
index 00000000..3e657868
--- /dev/null
+++ b/project/dexter-cs/DexterCS/Src/CommandLineAssert.cs
@@ -0,0 +1,43 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using System;
+
+namespace DexterCS
+{
+ public class CommandLineAssert
+ {
+ public static void AssertExclusiveOptions(object firstOption, object secondOption)
+ {
+ if (DexterUtil.HasOption(firstOption) &&
+ DexterUtil.HasOption(secondOption))
+ {
+ throw new Exception("Cannot use option -" + firstOption + " with option -" + secondOption);
+ }
+ }
+ }
+}
diff --git a/project/dexter-cs/DexterCS/Src/Config/DexterConfig.cs b/project/dexter-cs/DexterCS/Src/Config/DexterConfig.cs
new file mode 100644
index 00000000..bb271248
--- /dev/null
+++ b/project/dexter-cs/DexterCS/Src/Config/DexterConfig.cs
@@ -0,0 +1,205 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using log4net;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Text;
+
+namespace DexterCS
+{
+ public sealed class DexterConfig
+ {
+ private static ILog CliLog = LogManager.GetLogger(typeof(DexterConfig));
+
+ private List dexterHomeListenerList = new List(3);
+
+ public enum Run_Mode
+ {
+ CLI, ECLIPSE, DAEMON, INTELLIJ, NETBEANS, SOURCE_INSIGHT
+ }
+
+ public void AddDexterHomeListener(IDexterHomeListener listener)
+ {
+ if (dexterHomeListenerList.Contains(listener))
+ {
+ dexterHomeListenerList.Add(listener);
+ }
+ }
+
+ public enum LANGUAGE
+ {
+ JAVA, JAVASCRIPT, C, CPP, C_SHARP, UNKNOWN, ALL
+ };
+ public enum AnalysisType
+ {
+ SAVE, FILE, FOLDER, PROJECT, SNAPSHOT, UNKNOWN
+ };
+
+ public bool IsSpecifiedCheckerOptionEnabledByCli { get; set; }
+
+ public readonly String DEXTER_HOME_KEY = "dexterHome";
+ private readonly string PLUGIN_FOLDER_NAME = "plugin";
+
+ private static HashSet supportingFileExtensions = new HashSet();
+ public void AddSupportedFileExtensions(string[] fileExtensions)
+ {
+ foreach (string extension in fileExtensions)
+ {
+ if (supportingFileExtensions.Contains(extension.ToLowerInvariant()) == false)
+ {
+ supportingFileExtensions.Add(extension.ToLowerInvariant());
+ }
+ }
+ }
+
+ public static readonly string RESULT_FOLDER_NAME = "result";
+ public static readonly string OLD_FOLDER_NAME = "old";
+ public static readonly string TEMP_FOLDER_NAME = "temp";
+ public static readonly string LOG_FOLDER_NAME = "log";
+ public static readonly string FILTER_FOLDER_NAME = "filter";
+ public static readonly string POST_ANALYSIS_RESULT_V3 = "/api/v3/analysis/result";
+ public static readonly string POST_SNAPSHOT_SOURCECODE = "/api/v1/analysis/snapshot/source";
+
+ public Run_Mode RunMode { get; set; }
+
+ private string HomePath { get; set; }
+ private string dexterHome;
+ public string DexterHome
+ {
+ get
+ {
+ return dexterHome;
+ }
+ set
+ {
+ HomePath = DexterUtil.RefinePath(value);
+ dexterHome = HomePath;
+ }
+ }
+
+ public static HashSet SupportingFileExtensions
+ {
+ get
+ {
+ return supportingFileExtensions;
+ }
+ set
+ {
+ foreach (string extension in value)
+ {
+ if (supportingFileExtensions.Contains(extension.ToLowerInvariant()) == false)
+ {
+ supportingFileExtensions.Add(extension.Replace(".", "").ToLowerInvariant());
+ }
+ }
+ }
+ }
+
+ public void RemoveAllSupportingFileExtensions()
+ {
+ supportingFileExtensions.Clear();
+ }
+
+ private static DexterConfig instance = null;
+ private static readonly object padlock = new object();
+ public Encoding SourceEncoding = new UTF8Encoding(true);
+
+ public static DexterConfig Instance
+ {
+ get
+ {
+ lock (padlock)
+ {
+ if (instance == null)
+ {
+ instance = new DexterConfig();
+ }
+ return instance;
+ }
+ }
+ }
+
+ public static readonly int SOURCE_FILE_SIZE_LIMIT = 1024 * 2 * 1024;
+ public static readonly string DEXTER_CFG_FILENAME = "dexter_cfg.json";
+ public string OldFilePath
+ {
+ get
+ {
+ return this.DexterHome + "/" + DexterConfig.RESULT_FOLDER_NAME + "/" + OLD_FOLDER_NAME;
+ }
+ }
+
+ public void CreateInitialFolderAndFiles()
+ {
+ if (string.IsNullOrEmpty(DexterHome))
+ {
+ return;
+ }
+ try
+ {
+ DexterUtil.CreateFolderIfDoesNotExist(DexterHome);
+
+ string bin = DexterHome + "/bin";
+ DexterUtil.CreateFolderIfDoesNotExist(bin);
+ DexterUtil.CreateFolderIfDoesNotExist(bin + "/cppcheck");
+ DexterUtil.CreateFolderIfDoesNotExist(bin + "/cppcheck/cfg");
+ DexterUtil.CreateFolderIfDoesNotExist(bin + "/dexterCS");
+
+ string plugin = DexterHome + "/" + PLUGIN_FOLDER_NAME;
+ DexterUtil.CreateFolderIfDoesNotExist(plugin);
+
+ string result = DexterHome + "/" + RESULT_FOLDER_NAME;
+ DexterUtil.CreateFolderIfDoesNotExist(result);
+ DexterUtil.CreateFolderIfDoesNotExist(result + "/" + OLD_FOLDER_NAME);
+
+ DexterUtil.CreateFolderIfDoesNotExist(DexterHome + "/" + TEMP_FOLDER_NAME);
+ DexterUtil.CreateFolderIfDoesNotExist(DexterHome + "/" + LOG_FOLDER_NAME);
+
+ string filter = DexterHome + "/" + FILTER_FOLDER_NAME;
+ DexterUtil.CreateFolderIfDoesNotExist(filter);
+ }
+ catch (IOException)
+ {
+ CliLog.Error("IOException in DexterConfig");
+ }
+ }
+
+ public void ChangeDexterHome(string homePath)
+ {
+ HomePath = DexterUtil.RefinePath(homePath);
+ dexterHome = HomePath;
+ }
+
+ public bool IsFileSupportedForAnalysis(string fileName)
+ {
+ string extension = Path.GetExtension(fileName).ToLowerInvariant().Replace(".", "");
+ return SupportingFileExtensions.Contains(extension);
+ }
+ }
+}
diff --git a/project/dexter-cs/DexterCS/Src/Defect.cs b/project/dexter-cs/DexterCS/Src/Defect.cs
new file mode 100644
index 00000000..34ff1a01
--- /dev/null
+++ b/project/dexter-cs/DexterCS/Src/Defect.cs
@@ -0,0 +1,81 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+
+namespace DexterCS
+{
+ public class Defect : BaseDefect
+ {
+ [JsonProperty("message")]
+ public string Message { get; set; }
+ [JsonProperty("severityCode")]
+ public string SeverityCode { get; set; }
+ [JsonProperty("categoryName")]
+ public string CategoryName { get; set; }
+ [JsonProperty("analysisType")]
+ public DexterConfig.AnalysisType AnalysisType { get; set; }
+
+ private List occurences = new List();
+
+ [JsonProperty("occurences")]
+ public List Occurences
+ {
+ get
+ {
+ return occurences;
+ }
+ set
+ {
+ occurences = value;
+ }
+ }
+
+ public void AddOccurence(Occurence occ)
+ {
+ string key = @"[#" + (Occurences.Count + 1) + "@" + occ.StartLine + "]";
+ Message += key + occ.Message + " ";
+ Occurences.Add(occ);
+ }
+
+ public override int GetHashCode()
+ {
+ return base.GetHashCode();
+ }
+
+ public override bool Equals(Object obj)
+ {
+ if (obj == null)
+ {
+ return false;
+ }
+ return base.Equals(obj);
+ }
+ }
+}
diff --git a/project/dexter-cs/DexterCS/Src/DexterAnalyzer.cs b/project/dexter-cs/DexterCS/Src/DexterAnalyzer.cs
new file mode 100644
index 00000000..2dc8d60b
--- /dev/null
+++ b/project/dexter-cs/DexterCS/Src/DexterAnalyzer.cs
@@ -0,0 +1,119 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using DexterCS.Client;
+using System;
+using System.Collections.Generic;
+
+namespace DexterCS
+{
+ public class DexterAnalyzer : IDexterHomeListener
+ {
+ private static String CFG_PARM_JSON_FILE = "/cfg/dexter-config-parameter.json";
+ private DexterAnalyzerThread dexterAnalyzerSync = new DexterAnalyzerThread();
+ private List listenerList = new List(1);
+ public List ProjectAnalysisConfigurationList { get; set; }
+
+ private DexterAnalyzer()
+ {
+ DexterConfig.Instance.AddDexterHomeListener(this);
+ LoadProjectAnalysisConfiguration();
+ }
+
+ private void LoadProjectAnalysisConfiguration()
+ {
+ ProjectAnalysisConfigurationList = new List();
+
+ string cfgFilePath = DexterConfig.Instance.DexterHome + CFG_PARM_JSON_FILE;
+ DexterUtil.CreateEmptyFileIfNotExist(cfgFilePath);
+
+ string content = DexterUtil.GetContentsFromFile(cfgFilePath);
+ }
+
+ internal void PreSendSourceCode(AnalysisConfig config)
+ {
+ foreach (var listener in listenerList)
+ {
+ listener.HandlePreSendSourceCode(config);
+ }
+ }
+
+ private static DexterAnalyzer instance = null;
+
+ internal void PostRunStaticAnalysis(AnalysisConfig config, List resultList)
+ {
+ foreach (var listener in listenerList)
+ {
+ listener.HandlePostRunStaticAnalysis(config, resultList);
+ }
+ }
+
+ private static readonly object padlock = new object();
+ public static DexterAnalyzer Instance
+ {
+ get
+ {
+ lock (padlock)
+ {
+ if (instance == null)
+ {
+ instance = new DexterAnalyzer();
+ }
+ return instance;
+ }
+ }
+ }
+
+ public void RunSync(AnalysisConfig analysisConfig, IDexterPluginManager pluginManager, IDexterClient client)
+ {
+ dexterAnalyzerSync.Analyze(analysisConfig, pluginManager, client);
+ }
+
+ public void PreRunStaticAnalysis(AnalysisConfig config)
+ {
+ foreach (IDexterAnalyzerListener listener in listenerList)
+ {
+ listener.HandlePreRunStaticAnalysis(config);
+ }
+ }
+
+ public void HandleDexterHomeChanged(string oldPath, string newPath)
+ {
+ //TODO:
+ }
+
+ internal static List AllDefectList(List resultList)
+ {
+ List allDefectList = new List();
+ foreach (AnalysisResult result in resultList)
+ {
+ allDefectList.AddRange(result.DefectList);
+ }
+ return allDefectList;
+ }
+ }
+}
\ No newline at end of file
diff --git a/project/dexter-cs/DexterCS/Src/DexterAnalyzerAdapter.cs b/project/dexter-cs/DexterCS/Src/DexterAnalyzerAdapter.cs
new file mode 100644
index 00000000..0204c567
--- /dev/null
+++ b/project/dexter-cs/DexterCS/Src/DexterAnalyzerAdapter.cs
@@ -0,0 +1,46 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using System.Collections.Generic;
+
+namespace DexterCS
+{
+ class DexterAnalyzerAdapter : IDexterAnalyzerListener
+ {
+ public void HandlePostRunStaticAnalysis(AnalysisConfig config, List resultList)
+ {
+ }
+
+ public void HandlePreRunStaticAnalysis(AnalysisConfig config)
+ {
+ }
+
+ public void HandlePreSendSourceCode(AnalysisConfig config)
+ {
+ }
+ }
+}
diff --git a/project/dexter-cs/DexterCS/Src/DexterAnalyzerThread.cs b/project/dexter-cs/DexterCS/Src/DexterAnalyzerThread.cs
new file mode 100644
index 00000000..50df7aea
--- /dev/null
+++ b/project/dexter-cs/DexterCS/Src/DexterAnalyzerThread.cs
@@ -0,0 +1,108 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using DexterCS.Client;
+using log4net;
+using System;
+using System.Collections.Generic;
+using System.IO;
+
+namespace DexterCS
+{
+ public sealed class DexterAnalyzerThread
+ {
+ private static ILog CliLog = LogManager.GetLogger(typeof(DexterAnalyzerThread));
+
+ private AnalysisConfig config;
+ private IDexterPluginManager pluginManager;
+ private IDexterClient client;
+
+ public void SetFields(AnalysisConfig config, IDexterPluginManager pluginManager, IDexterClient client)
+ {
+ this.config = config;
+ this.pluginManager = pluginManager;
+ this.client = client;
+ }
+
+ public void Analyze(AnalysisConfig analysisConfig, IDexterPluginManager pluginManager, IDexterClient client)
+ {
+ try
+ {
+ DexterAnalyzer analyzer = DexterAnalyzer.Instance;
+ CheckAnalysisConfig(analysisConfig);
+ //analysisConfig.AddHeaderAndSourceConfiguration(analyzer.ProjectAnalysisConfigurationList);
+
+ analyzer.PreSendSourceCode(analysisConfig);
+
+ analyzer.PreRunStaticAnalysis(analysisConfig);
+ List resultList = RunStaticAnalysis(analysisConfig, pluginManager, client);
+ analyzer.PostRunStaticAnalysis(analysisConfig, resultList);
+
+ }
+ catch (Exception e)
+ {
+ CliLog.Error(e.StackTrace);
+ }
+ }
+
+ public void SendSourceCode(AnalysisConfig config, IDexterClient client)
+ {
+ try
+ {
+ client.StoreSourceCodeCharSequence(config.SnapshotId, config.GroupId,
+ config.ModulePath, config.FileName, config.SourcecodeFromFile).Wait();
+ }
+ catch (Exception e)
+ {
+ CliLog.Error(e.StackTrace);
+ }
+ }
+
+ private List RunStaticAnalysis(AnalysisConfig analysisConfig, IDexterPluginManager pluginManager, IDexterClient client)
+ {
+ List resultList = pluginManager.Analyze(analysisConfig);
+ AnalysisResultFileManager.Instance.WriteJson(resultList);
+ analysisConfig.ResultHandler.HandleAnalysisResult(resultList, client);
+ SendSourceCode(analysisConfig, client);
+
+ return resultList;
+ }
+
+ private void CheckAnalysisConfig(AnalysisConfig analysisConfig)
+ {
+ if (string.IsNullOrEmpty(analysisConfig.SourceFileFullPath) || string.IsNullOrEmpty(analysisConfig.FileName))
+ {
+ throw new DexterRuntimeException("Invalid Analysis Config: SourceFileFullPath or FileName is null or empty");
+ }
+
+ if (!File.Exists(analysisConfig.SourceFileFullPath))
+ {
+ throw new DexterRuntimeException("Invalid Analysis Config: SourceFileFullPath does not exist: " + analysisConfig.SourceFileFullPath);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/project/dexter-cs/DexterCS/Src/DexterCLIOption.cs b/project/dexter-cs/DexterCS/Src/DexterCLIOption.cs
new file mode 100644
index 00000000..cbedb6fc
--- /dev/null
+++ b/project/dexter-cs/DexterCS/Src/DexterCLIOption.cs
@@ -0,0 +1,222 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using CommandLine;
+using log4net;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.IO;
+using System.Text;
+
+namespace DexterCS
+{
+ public class DexterCLIOption : IDexterCLIOption
+ {
+ private static ILog CliLog = LogManager.GetLogger(typeof(DexterCLIOption));
+
+ [DefaultValue(false)]
+ public Boolean IsAsynchronous { get; set; }
+
+ public DexterCLIOption(string[] args)
+ {
+ CreateCliOptionFromArguments(args);
+ }
+
+ public int ServerPort { get; set; }
+ public string UserId { get; set; }
+ public string UserPassword { get; set; }
+ public string ServerHostIp { get; set; }
+ private string configFilePath;
+ public string ConfigFilePath
+ {
+ get
+ {
+ return this.configFilePath;
+ }
+ set
+ {
+ try
+ {
+ if (string.IsNullOrEmpty(value))
+ {
+ throw new DexterRuntimeException("Invalid CommandLine option for configFilePath (null or empty)");
+ }
+ }
+ catch (DexterRuntimeException e)
+ {
+ CliLog.Error(e.StackTrace);
+ Environment.Exit(0);
+ }
+ this.configFilePath = value;
+ }
+ }
+ public bool IsSpisSpecifiedCheckerEnabledMode { get; set; }
+ public bool IsTargetFileOptionEnabled { get; set; }
+
+ public FileInfo JsonResultFile { get; set; }
+ public FileInfo XmlResultFile { get; set; }
+ public FileInfo Xml2ResultFile { get; set; }
+
+ public List enabledCheckerList = new List();
+
+ public bool IsJsonResultFile { get; set; }
+ public bool IsXmlResultFile { get; set; }
+ public bool IsXml2ResultFile { get; set; }
+ public List TargetFileFullPathList
+ {
+ get
+ {
+ if (IsTargetFileOptionEnabled == false)
+ {
+ return new List(0);
+ }
+ return new List((string[])TargetFiles);
+ }
+ set { }
+ }
+
+ public string[] TargetFiles { get; set; }
+
+ private void CreateCliOptionFromArguments(string[] args)
+ {
+ try
+ {
+ var command = Parser.Default.ParseArguments(args);
+ DexterUtil.STATUS_CODE exitCode = command
+ .Return(opts =>
+ {
+ var parsed = (Parsed)command;
+ var options = parsed.Value;
+ SetFieldsByCommandLine(options);
+ return DexterUtil.STATUS_CODE.SUCCESS;
+ }, code => DexterUtil.STATUS_CODE.ERROR // means NOT OK
+ );
+
+ if (exitCode != DexterUtil.STATUS_CODE.SUCCESS)
+ {
+ throw new Exception("Command parsing error");
+ }
+ }
+ catch (Exception e)
+ {
+ CliLog.Error("Invalid CLI Option");
+ CliLog.Error(e.StackTrace);
+ Environment.Exit(0);
+ }
+ }
+
+ public void SetFieldsByCommandLine(DexterCLIOptionSet options)
+ {
+ String ResultFileName = "." + DexterUtil.FILE_SEPARATOR + "dexter-result";
+ SetHostAndPort(options.ServerIp, options.ServerPort);
+ this.ServerHostIp = options.ServerIp;
+ this.ServerPort = options.ServerPort;
+ this.UserId = options.UserId;
+ this.UserPassword = options.UserPassword;
+
+ if (DexterUtil.HasOption(options.SpecifiedDexterConfigFile))
+ {
+ this.ConfigFilePath = options.SpecifiedDexterConfigFile;
+ }
+ else
+ {
+ this.ConfigFilePath = "./" + DexterConfig.DEXTER_CFG_FILENAME;
+ }
+
+ DexterUtil.LogErrorAndExitIfFileDoesNotExist(ConfigFilePath);
+
+ if (DexterUtil.HasOption(options.ResultFormat))
+ {
+ switch (options.ResultFormat)
+ {
+ case "xml":
+ this.IsXmlResultFile = true;
+ CreateXmlResultFile(ResultFileName);
+ break;
+ case "xml2":
+ this.IsXml2ResultFile = true;
+ break;
+ case "json":
+ this.IsJsonResultFile = true;
+ CreateJsonResultFile(ResultFileName);
+ break;
+ }
+ }
+ }
+
+ private void SetHostAndPort(string host, int port)
+ {
+ try
+ {
+ if (string.IsNullOrEmpty(host))
+ {
+ throw new DexterRuntimeException(
+ "You have to use both -h dexter_server_host_ip and -o dexter_server_port_number options");
+ }
+ }
+ catch (DexterRuntimeException e)
+ {
+ CliLog.Error(e.Message);
+ Environment.Exit(0);
+ }
+ ServerHostIp = host;
+ ServerPort = port;
+ }
+
+ private void CreateXmlResultFile(string fileName)
+ {
+ try
+ {
+ XmlResultFile = new FileInfo(fileName + ".xml");
+ File.WriteAllText(XmlResultFile.FullName, "", Encoding.UTF8);
+ }
+ catch (IOException e)
+ {
+ throw new DexterRuntimeException(e.Message);
+ }
+ }
+
+ private void CreateJsonResultFile(string fileName)
+ {
+ try
+ {
+ JsonResultFile = new FileInfo(fileName + ".json");
+ File.WriteAllText(JsonResultFile.FullName, "", Encoding.UTF8);
+ }
+ catch (IOException e)
+ {
+ throw new DexterRuntimeException(e.Message);
+ }
+ }
+
+ public static void CheckValidationOfOptionCombination(DexterCLIOptionSet command)
+ {
+ // Method intentionally left empty.
+ }
+ }
+}
\ No newline at end of file
diff --git a/project/dexter-cs/DexterCS/Src/DexterCLIOptionSet.cs b/project/dexter-cs/DexterCS/Src/DexterCLIOptionSet.cs
new file mode 100644
index 00000000..236cef79
--- /dev/null
+++ b/project/dexter-cs/DexterCS/Src/DexterCLIOptionSet.cs
@@ -0,0 +1,60 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using CommandLine;
+
+namespace DexterCS
+{
+ public class DexterCLIOptionSet
+ {
+ [Option('f', "", Required = false,
+ HelpText = "Analysis Configuration File. e.g. -f C:/dexter/dexter_cfg.json")]
+ public string SpecifiedDexterConfigFile { get; set; }
+
+ [Option('h', "Dexter Server IP", Required = false, HelpText = "Dexter Server IP address. e.g. -h 123.123.123.123")]
+ public string ServerIp { get; set; }
+
+ [Option('o', "Dexter Server Port", Required = false, HelpText = "Dexter Server Port. e.g. -p 1234")]
+ public int ServerPort { get; set; }
+
+ [Option('u', "Dexter User Id", Required = true, HelpText = "Dexter User Id. e.g. -u j.smith")]
+ public string UserId { get; set; }
+
+ [Option('p', "Dexter User Password", Required = true, HelpText = "Dexter User Password. e.g. -p password")]
+ public string UserPassword { get; set; }
+
+ [Option('x', "XML Result File", Required = false, HelpText = "Create XML result file - dexter-result.xml. eg -x")]
+ public bool XMLResultFile { get; set; }
+
+ [Option('X', "XML Result File with TimeStamp", Required = false,
+ HelpText = "Create XML result file with timestamp - dexter-result_yyyyMMddhh:mm:ss.xml. e.g. -X")]
+ public bool XML2ResultFile { get; set; }
+
+ [Option('F', Required = true, HelpText = "-F json/ -F xml / -F xml2, default: json")]
+ public string ResultFormat { get; set; }
+ }
+}
diff --git a/project/dexter-cs/DexterCS/Src/DexterCSMain.cs b/project/dexter-cs/DexterCS/Src/DexterCSMain.cs
new file mode 100644
index 00000000..2d92e88a
--- /dev/null
+++ b/project/dexter-cs/DexterCS/Src/DexterCSMain.cs
@@ -0,0 +1,143 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using DexterCS.Client;
+using log4net;
+using System.Collections.Generic;
+using System.IO;
+using System.Text;
+
+[assembly: log4net.Config.XmlConfigurator(Watch = true)]
+namespace DexterCS
+{
+ public class DexterCSMain
+ {
+ private static ILog CliLog = LogManager.GetLogger(typeof(DexterCSMain));
+ private DexterConfig config = DexterConfig.Instance;
+
+ public List sourceFileFullPathList = new List();
+
+ static void Main(string[] args)
+ {
+ DexterCSMain cliMain = new DexterCSMain();
+ IDexterCLIOption cliOption = new DexterCLIOption(args);
+ IDexterConfigFile configFile = cliMain.CreateDexterConfigFile(cliOption);
+ IDexterClient client = cliMain.CreateDexterClient(cliOption);
+ cliMain.Analyze(cliOption, configFile, client);
+ }
+
+ private static IDexterPluginManager LoadDexterPlugin(IDexterClient client, IDexterCLIOption cliOption)
+ {
+ IDexterPluginInitializer initializer = new CLIPluginInitializer(CliLog);
+ IDexterPluginManager pluginManager = new CLIDexterPluginManager(initializer, client, CliLog, cliOption);
+ pluginManager.InitDexterPlugins();
+
+ return pluginManager;
+ }
+
+ private void Analyze(IDexterCLIOption cliOption, IDexterConfigFile configFile, IDexterClient client)
+ {
+ CliLog.Info(DexterLogConstant.GetStartingAnalysisMessage());
+
+ AnalysisConfig baseAnalysisConfig = CreateBaseAnalysisConfig(cliOption, configFile);
+ IAnalysisResultHandler cliAnalysisResultHandler = CreateCLIAnalysisResultHandler(client, cliOption);
+ IDexterPluginManager pluginManager = LoadDexterPlugin(client, cliOption);
+ InitSourceFileFullPathList(configFile, cliOption);
+ AnalyzeSynchronously(pluginManager, cliAnalysisResultHandler, baseAnalysisConfig, client);
+ }
+
+ private void AnalyzeSynchronously(IDexterPluginManager pluginManager, IAnalysisResultHandler cliAnalysisResultHandler, AnalysisConfig baseAnalysisConfig, IDexterClient client)
+ {
+ cliAnalysisResultHandler.HandleBeginningOfResultFile();
+ foreach (string fileFullPath in sourceFileFullPathList)
+ {
+ AnalysisConfig analysisConfig = CreateAnalysisConfig(fileFullPath, cliAnalysisResultHandler, baseAnalysisConfig);
+ DexterAnalyzer.Instance.RunSync(analysisConfig, pluginManager, client);
+ }
+ cliAnalysisResultHandler.HandleEndOfResultFile();
+ cliAnalysisResultHandler.PrintLogAfterAnalyze();
+ }
+
+ private AnalysisConfig CreateAnalysisConfig(string fileFullPath, IAnalysisResultHandler cliAnalysisResultHandler, AnalysisConfig baseAnalysisConfig)
+ {
+ AnalysisConfig _config = new AnalysisEntityFactory().CopyAnalysisConfigWithoutSourcecode(baseAnalysisConfig);
+ _config.ResultHandler = cliAnalysisResultHandler;
+ _config.SourceFileFullPath = fileFullPath;
+ _config.GenerateFileNameWithSourceFileFullPath();
+ _config.GenerateModulePath();
+
+ return _config;
+ }
+
+ private void InitSourceFileFullPathList(IDexterConfigFile configFile, IDexterCLIOption cliOption)
+ {
+ if (cliOption.IsTargetFileOptionEnabled)
+ {
+ this.sourceFileFullPathList = cliOption.TargetFileFullPathList;
+ }
+ else
+ {
+ this.sourceFileFullPathList = configFile.GenerateSourceFileFullPathList();
+ }
+ }
+
+ private IAnalysisResultHandler CreateCLIAnalysisResultHandler(IDexterClient client, IDexterCLIOption cliOption)
+ {
+ return new CLIAnalysisResultHandler(client.DexterWebUrl, cliOption, CliLog);
+ }
+
+ private AnalysisConfig CreateBaseAnalysisConfig(IDexterCLIOption cliOption, IDexterConfigFile configFile)
+ {
+ InitDexterConfig(cliOption, configFile);
+ AnalysisConfig baseAnalysisConfig = configFile.ToAnalysisConfig();
+ return baseAnalysisConfig;
+ }
+
+ private void InitDexterConfig(IDexterCLIOption cliOption, IDexterConfigFile configFile)
+ {
+ config.IsSpecifiedCheckerOptionEnabledByCli = cliOption.IsSpisSpecifiedCheckerEnabledMode;
+ config.DexterHome = configFile.DexterHome;
+ config.CreateInitialFolderAndFiles();
+ }
+
+ public IDexterClient CreateDexterClient(IDexterCLIOption cliOption)
+ {
+ IHttpClient httpWrapper = new DexterHttpClientWrapper(
+ new DexterServerConfig(cliOption.ServerHostIp, cliOption.ServerPort, cliOption.UserId, cliOption.UserPassword));
+
+ return new DexterClient(httpWrapper);
+ }
+
+ private IDexterConfigFile CreateDexterConfigFile(IDexterCLIOption cliOption)
+ {
+ IDexterConfigFile configFile = new DexterConfigFile();
+ configFile.LoadFromFile(File.ReadAllText(cliOption.ConfigFilePath, Encoding.UTF8));
+
+ return configFile;
+ }
+ }
+}
diff --git a/project/dexter-cs/DexterCS/Src/DexterConfigFile.cs b/project/dexter-cs/DexterCS/Src/DexterConfigFile.cs
new file mode 100644
index 00000000..d3c995aa
--- /dev/null
+++ b/project/dexter-cs/DexterCS/Src/DexterConfigFile.cs
@@ -0,0 +1,347 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using log4net;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using System;
+using System.Collections.Generic;
+using System.IO;
+
+namespace DexterCS
+{
+ public class DexterConfigFile : IDexterConfigFile
+ {
+ private static ILog CliLog = LogManager.GetLogger(typeof(DexterConfigFile));
+
+ public enum Type
+ {
+ FILE, FOLDER, PROJECT, SNAPSHOT
+ }
+
+ public string DexterHome { get; set; }
+ public string DexterServerIp { get; set; }
+ public int DexterServerPort { get; set; }
+ public string ProjectName { get; set; }
+ public string ProjectFullPath { get; set; }
+ public string SourceEncoding { get; set; }
+ public string ConfigType { get; set; }
+ public long SnapshotId { get; set; }
+ private string modulePath = "";
+ public string ModulePath
+ {
+ get { return modulePath; }
+ set { modulePath = value ?? ""; }
+ }
+ public bool IsSpecifiedCheckerEnabled { get; set; }
+ public bool IsSpecifiedCheckerOptionEnabledByCli { get; set; }
+
+ //private bool hasOneSourceDir = false;
+ //private string firstSourceDir = "";
+ private List SourceDirList { get; set; }
+ private List HeaderDirList { get; set; }
+ private string BinDir { get; set; }
+ private string Language { get; set; }
+
+
+ private IList fileNameList = new List();
+ public IList FileNameList { get; set; }
+ public void AddFileNameList(string fileName)
+ {
+ if (fileNameList.Contains(fileName))
+ {
+ return;
+ }
+ fileNameList.Add(fileName);
+ }
+
+ private string ResultFileFullPath { get; set; }
+
+ public void LoadFromFile(String dexterConfig)
+ {
+ try
+ {
+ dexterConfig = dexterConfig.Replace("\\", "/").Replace("//", "/");
+ JObject configMetadata = JObject.Parse(dexterConfig);
+ SetFields(configMetadata);
+ }
+ catch (JsonException e)
+ {
+ CliLog.Error("Json Exception");
+ CliLog.Error(e.StackTrace);
+ }
+ catch (NullReferenceException e)
+ {
+ CliLog.Error("Null Exeption");
+ CliLog.Error(e.StackTrace);
+ }
+ }
+
+ private void SetFields(JObject configMetadata)
+ {
+ CheckDexterConfigMatadata(configMetadata);
+
+ DexterHome = ((string)configMetadata["dexterHome"]);
+ DexterServerIp = ((string)configMetadata["dexterServerIp"]);
+ DexterServerPort = (Int32.Parse((string)configMetadata["dexterServerPort"]));
+ ProjectName = ((string)configMetadata["projectName"]);
+ ProjectFullPath = ((string)configMetadata["projectFullPath"] + " / ");
+ SourceDirList = GetListFromDictionary(configMetadata["sourceDir"]);
+ HeaderDirList = GetListFromDictionary(configMetadata["headerDir"]);
+ SourceEncoding = ((string)configMetadata["sourceEncoding"]);
+ ConfigType = ((string)configMetadata["type"]);
+ ModulePath = (string)configMetadata["modulePath"];
+
+ FileNameList = GetListFromDictionary(configMetadata["fileName"]);
+ try
+ {
+ SnapshotId = (long.Parse((string)configMetadata["snapshotId"]));
+ }
+ catch (Exception)
+ {
+ SnapshotId = -1;
+ }
+ }
+
+ public List GetListFromDictionary(JToken dirs)
+ {
+ List tempDirs = new List();
+ if (dirs == null)
+ {
+ return tempDirs;
+ }
+
+ foreach (var dir in dirs)
+ {
+ tempDirs.Add(dir.ToString());
+ }
+ return tempDirs;
+ }
+
+ private void CheckDexterConfigMatadata(dynamic configMetadata)
+ {
+ CheckNullOfMap(configMetadata);
+ CheckFieldExistence(configMetadata);
+ CheckFolderExistence(configMetadata);
+ CheckTypeAndFollowingFields(configMetadata);
+ }
+
+ private void CheckTypeAndFollowingFields(dynamic configMetadata)
+ {
+ string _type = (string)configMetadata.type;
+ if (string.Compare(ResultFileConstant.FILE_TYPE, _type, StringComparison.OrdinalIgnoreCase) != 0 &&
+ string.Compare(ResultFileConstant.FOLDER_TYPE, _type, StringComparison.OrdinalIgnoreCase) != 0 &&
+ string.Compare(ResultFileConstant.PROJECT_TYPE, _type, StringComparison.OrdinalIgnoreCase) != 0 &&
+ string.Compare(ResultFileConstant.SNAPSHOT_TYPE, _type, StringComparison.OrdinalIgnoreCase) != 0)
+ {
+ throw new DexterRuntimeException("'type' field can be {FILE, FOLDER, PROJECT, SNAPSHOT}. Your input: " + _type);
+ }
+
+ if (string.Compare(ResultFileConstant.FILE_TYPE, _type, StringComparison.OrdinalIgnoreCase) == 0)
+ {
+ CheckFieldEmptyInDexterConfiguration(configMetadata, ResultFileConstant.FILE_NAME);
+ }
+ }
+
+ private void CheckFolderExistence(dynamic configMetadata)
+ {
+ DexterUtil.CheckFolderExistence(configMetadata.projectFullPath);
+ }
+
+ private void CheckFieldExistence(dynamic configMetadata)
+ {
+ CheckFieldEmptyInDexterConfiguration(configMetadata.projectName, ResultFileConstant.PROJECT_NAME);
+ CheckFieldEmptyInDexterConfiguration(configMetadata.projectFullPath, "projectFullPath");
+ CheckFieldEmptyInDexterConfiguration(configMetadata.sourceEncoding, "sourceEncoding");
+ CheckFieldEmptyInDexterConfiguration(configMetadata.type, "type");
+ }
+
+ private void CheckFieldEmptyInDexterConfiguration(dynamic fieldValue, string key)
+ {
+ if (object.ReferenceEquals(null, fieldValue))
+ {
+ throw new DexterRuntimeException("Dexter Configuration Error: '" + key + "' field is empty");
+ }
+ }
+
+ private void CheckNullOfMap(dynamic configMetadata)
+ {
+ if (configMetadata == null || configMetadata.Count < 1)
+ {
+ throw new DexterRuntimeException("Dexter Configuration Error: Empty configMetadata");
+ }
+ }
+
+ public AnalysisConfig ToAnalysisConfig()
+ {
+ AnalysisEntityFactory configFactory = new AnalysisEntityFactory();
+ AnalysisConfig analysisConfig = configFactory.CreateAnalysisConfig();
+
+ analysisConfig.ProjectName = ProjectName;
+ analysisConfig.ProjectFullPath = ProjectFullPath + "/";
+ analysisConfig.ModulePath = ModulePath;
+ analysisConfig.SourceBaseDirList = SourceDirList;
+ analysisConfig.HeaderBaseDirList = HeaderDirList;
+ analysisConfig.SnapshotId = SnapshotId;
+ analysisConfig.ResultFileFullPath = ResultFileFullPath;
+
+ string type = ConfigType;
+ switch (type)
+ {
+ case "PROJECT":
+ analysisConfig.AnalysisConfigType = DexterConfig.AnalysisType.PROJECT;
+ break;
+ case "SNAPSHOT":
+ analysisConfig.AnalysisConfigType = DexterConfig.AnalysisType.SNAPSHOT;
+ break;
+ case "FOLDER":
+ analysisConfig.AnalysisConfigType = DexterConfig.AnalysisType.FOLDER;
+ break;
+ case "FILE":
+ analysisConfig.AnalysisConfigType = DexterConfig.AnalysisType.FILE;
+ break;
+ default:
+ analysisConfig.AnalysisConfigType = DexterConfig.AnalysisType.UNKNOWN;
+ break;
+ }
+
+ return analysisConfig;
+ }
+
+ public List GenerateSourceFileFullPathList()
+ {
+ List sourceFileFullPathList = new List(0);
+ if (this.FileNameList == null)
+ {
+ return sourceFileFullPathList;
+ }
+ if (this.ConfigType == Type.FILE.ToString())
+ {
+ sourceFileFullPathList = GenerateSourceFileFullPathListAsFileType();
+ }
+ else if (this.ConfigType == Type.FOLDER.ToString())
+ {
+ sourceFileFullPathList = GenerateSourceFileFullPathListAsFolderType();
+ }
+ else
+ {
+ sourceFileFullPathList = GenerateSourceFileFullPathListAsProjectType();
+ }
+ return sourceFileFullPathList;
+ }
+
+ private List GenerateSourceFileFullPathListAsProjectType()
+ {
+ List sourceFileFullPathList = new List(50);
+
+ foreach (var srcDir in SourceDirList)
+ {
+ AddSourceFileFullPathHierachy(srcDir, sourceFileFullPathList);
+ }
+ return sourceFileFullPathList;
+ }
+
+ private void AddSourceFileFullPathHierachy(string basePath, List sourceFileFullPathList)
+ {
+ try
+ {
+ FileAttributes attr = File.GetAttributes(basePath);
+ if (attr.HasFlag(FileAttributes.Directory)) // IsDirectory
+ {
+ foreach (string subFile in DexterUtil.GetAllFilesAndDirectoriesInDirectory(basePath))
+ {
+ if (hasValidDirectoryName(subFile))
+ {
+ AddSourceFileFullPathHierachy(subFile, sourceFileFullPathList);
+ }
+ else
+ {
+ continue;
+ }
+ }
+ }
+ else
+ {
+ if (DexterConfig.Instance.IsFileSupportedForAnalysis(basePath) == false)
+ {
+ return;
+ }
+ sourceFileFullPathList.Add(DexterUtil.RefinePath(basePath));
+ }
+ }
+ catch (Exception e)
+ {
+ CliLog.Error("There is no file :" + e.Message);
+ Environment.Exit(0);
+ }
+ }
+
+ private List GenerateSourceFileFullPathListAsFileType()
+ {
+ return new List();
+ }
+
+ private bool hasValidDirectoryName(string path)
+ {
+ if (path.Contains("\\Properties") || path.Contains("\\Interop") || path.Contains(".Tests"))
+ {
+ return false;
+ }
+
+ return true;
+ }
+ private List GenerateSourceFileFullPathListAsFolderType()
+ {
+ string moduleFullPath = GetExistingModuleFullPathWithSourceDirList();
+ if (string.IsNullOrEmpty(moduleFullPath))
+ {
+ return new List(0);
+ }
+ List sourceFileFullPathList = new List(10);
+
+ foreach (string filePath in (DexterUtil.getSubFileNames(moduleFullPath)))
+ {
+ sourceFileFullPathList.Add(filePath);
+ }
+
+ return sourceFileFullPathList;
+ }
+
+ private string GetExistingModuleFullPathWithSourceDirList()
+ {
+ foreach (string srcDir in SourceDirList)
+ {
+ string moduleFullPath = DexterUtil.RefinePath(srcDir + "/" + ModulePath);
+ if (File.Exists(moduleFullPath))
+ {
+ return moduleFullPath;
+ }
+ }
+ return "";
+ }
+ }
+}
\ No newline at end of file
diff --git a/project/dexter-cs/DexterCS/Src/DexterLogConstant.cs b/project/dexter-cs/DexterCS/Src/DexterLogConstant.cs
new file mode 100644
index 00000000..7b3e89f2
--- /dev/null
+++ b/project/dexter-cs/DexterCS/Src/DexterLogConstant.cs
@@ -0,0 +1,37 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+namespace DexterCS
+{
+ public class DexterLogConstant
+ {
+ public static string GetStartingAnalysisMessage()
+ {
+ return @" ===== Starting Dexter Analysis ===== ";
+ }
+ }
+}
\ No newline at end of file
diff --git a/project/dexter-cs/DexterCS/Src/DexterRuntimeException.cs b/project/dexter-cs/DexterCS/Src/DexterRuntimeException.cs
new file mode 100644
index 00000000..bdeb4163
--- /dev/null
+++ b/project/dexter-cs/DexterCS/Src/DexterRuntimeException.cs
@@ -0,0 +1,56 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using System;
+using System.Runtime.Serialization;
+
+namespace DexterCS
+{
+ [Serializable]
+ public class DexterRuntimeException : Exception, ISerializable
+ {
+ public DexterRuntimeException()
+ {
+ }
+
+ public DexterRuntimeException(string message) : base(message)
+ {
+ }
+
+ public DexterRuntimeException(string message, Exception innerException) : base(message, innerException)
+ {
+ }
+
+ protected DexterRuntimeException(SerializationInfo info, StreamingContext context) : base(info, context)
+ {
+ }
+ public override void GetObjectData(SerializationInfo info, StreamingContext context)
+ {
+ base.GetObjectData(info, context);
+ }
+ }
+}
\ No newline at end of file
diff --git a/project/dexter-cs/DexterCS/Src/DexterServerConfig.cs b/project/dexter-cs/DexterCS/Src/DexterServerConfig.cs
new file mode 100644
index 00000000..776d7282
--- /dev/null
+++ b/project/dexter-cs/DexterCS/Src/DexterServerConfig.cs
@@ -0,0 +1,58 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+namespace DexterCS
+{
+ public class DexterServerConfig
+ {
+ private static readonly string HTTP_PREFIX = "http://";
+
+ public string Hostname { get; set; }
+ public int Port { get; set; }
+ public string UserId { get; set; }
+ public string UserPassword { get; set; }
+ public string ServiceUrl { get; set; }
+ public string BaseUrl
+ {
+ get { return HTTP_PREFIX + Hostname + ":" + Port; }
+ }
+
+ public DexterServerConfig(string serverHostIp, int serverPort, string userId, string userPassword)
+ {
+ UserId = userId;
+ UserPassword = userPassword;
+ Hostname = serverHostIp;
+ Port = serverPort;
+ }
+
+ public DexterServerConfig(string serverHostIp, int serverPort)
+ {
+ Hostname = serverHostIp;
+ Port = serverPort;
+ }
+ }
+}
\ No newline at end of file
diff --git a/project/dexter-cs/DexterCS/Src/EmptyChecker.cs b/project/dexter-cs/DexterCS/Src/EmptyChecker.cs
new file mode 100644
index 00000000..54a7ee8f
--- /dev/null
+++ b/project/dexter-cs/DexterCS/Src/EmptyChecker.cs
@@ -0,0 +1,55 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using System.ComponentModel;
+
+namespace DexterCS
+{
+ public class EmptyChecker : IChecker
+ {
+ [DefaultValue("")]
+ public string Type { get; set; }
+ [DefaultValue("")]
+ public string CategoryName { get; set; }
+ [DefaultValue("")]
+ public string Cwe { get; set; }
+ public string Description { get; set; }
+ [DefaultValue("")]
+ public string Code { get; set; }
+ [DefaultValue("")]
+ public string SeverityCode { get; set; }
+ [DefaultValue("false")]
+ public bool IsActive { get; set; }
+ [DefaultValue("0.0.0")]
+ public string Version { get; set; }
+ [DefaultValue("")]
+ public string Name { get; set; }
+ [DefaultValue("")]
+ public Properties Properties { get; set; }
+ public string GetProperties(string key) { return ""; }
+ }
+}
\ No newline at end of file
diff --git a/project/dexter-cs/DexterCS/Src/EnabledChecker.cs b/project/dexter-cs/DexterCS/Src/EnabledChecker.cs
new file mode 100644
index 00000000..ab670cd6
--- /dev/null
+++ b/project/dexter-cs/DexterCS/Src/EnabledChecker.cs
@@ -0,0 +1,33 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+namespace DexterCS
+{
+ public class EnabledChecker
+ {
+ }
+}
\ No newline at end of file
diff --git a/project/dexter-cs/DexterCS/Src/IAnalysisEntityFactory.cs b/project/dexter-cs/DexterCS/Src/IAnalysisEntityFactory.cs
new file mode 100644
index 00000000..6957c437
--- /dev/null
+++ b/project/dexter-cs/DexterCS/Src/IAnalysisEntityFactory.cs
@@ -0,0 +1,37 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using System.Collections.Generic;
+
+namespace DexterCS
+{
+ public interface IAnalysisEntityFactory
+ {
+ AnalysisResult CreateAnalysisResult(AnalysisConfig config);
+ AnalysisResult CreateAnalysisResultList(List resultList);
+ }
+}
\ No newline at end of file
diff --git a/project/dexter-cs/DexterCS/Src/IAnalysisResultHandler.cs b/project/dexter-cs/DexterCS/Src/IAnalysisResultHandler.cs
new file mode 100644
index 00000000..cfcc21d2
--- /dev/null
+++ b/project/dexter-cs/DexterCS/Src/IAnalysisResultHandler.cs
@@ -0,0 +1,40 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using DexterCS.Client;
+using System.Collections.Generic;
+
+namespace DexterCS
+{
+ public interface IAnalysisResultHandler
+ {
+ void HandleBeginningOfResultFile();
+ void HandleEndOfResultFile();
+ void PrintLogAfterAnalyze();
+ void HandleAnalysisResult(List resultList, IDexterClient client);
+ }
+}
\ No newline at end of file
diff --git a/project/dexter-cs/DexterCS/Src/ICLIResultFile.cs b/project/dexter-cs/DexterCS/Src/ICLIResultFile.cs
new file mode 100644
index 00000000..767fc4fa
--- /dev/null
+++ b/project/dexter-cs/DexterCS/Src/ICLIResultFile.cs
@@ -0,0 +1,45 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using System.Collections.Generic;
+using System.IO;
+
+namespace DexterCS
+{
+ public interface ICLIResultFile
+ {
+ void WriteJsonResultFilePrefix(FileInfo file);
+ void WriteXmlResultFilePrefix(FileInfo xmlResultFile);
+ void WriteXml2ResultFilePrefix(FileInfo xml2ResultFile);
+ void WriteJsonResultFilePostfix(FileInfo file);
+ void WriteXmlResultFilePostfix(FileInfo xmlResultFile);
+ void WriteXml2ResultFilePostfix(FileInfo xml2ResultFile);
+ void WriteJsonResultFileBody(FileInfo jsonResultFile, List allDefectList);
+ void WriteXml2ResultFileBody(FileInfo xml2ResultFile, List allDefectList, string sourceFileFullPath);
+ void WriteXmlResultFileBody(FileInfo xmlResultFile, List allDefectList, string sourceFileFullPath);
+ }
+}
\ No newline at end of file
diff --git a/project/dexter-cs/DexterCS/Src/IChecker.cs b/project/dexter-cs/DexterCS/Src/IChecker.cs
new file mode 100644
index 00000000..c8ae6671
--- /dev/null
+++ b/project/dexter-cs/DexterCS/Src/IChecker.cs
@@ -0,0 +1,62 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using Newtonsoft.Json;
+
+namespace DexterCS
+{
+ public interface IChecker
+ {
+ string Code { get; set; }
+ string Name { get; set; }
+ string Type { get; set; }
+ string CategoryName { get; set; }
+ string SeverityCode { get; set; }
+ string Version { get; set; }
+ string Description { get; set; }
+ bool IsActive { get; set; }
+ Properties Properties { get; set; }
+ string Cwe { get; set; }
+ }
+ public interface IProperties
+ {
+ [JsonProperty("value")]
+ string Value { get; set; }
+ }
+ public class Properties : IProperties
+ {
+ [JsonProperty("value")]
+ public string Value { get; set; }
+ }
+ public class EmptyProperties : IProperties
+ {
+ string tempValue = "";
+ [JsonProperty("value")]
+ public string Value { get { return ""; } set { tempValue = value; } }
+ }
+
+}
diff --git a/project/dexter-cs/DexterCS/Src/ICheckerConfig.cs b/project/dexter-cs/DexterCS/Src/ICheckerConfig.cs
new file mode 100644
index 00000000..4c923fa6
--- /dev/null
+++ b/project/dexter-cs/DexterCS/Src/ICheckerConfig.cs
@@ -0,0 +1,42 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using System.Collections.Generic;
+using static DexterCS.DexterConfig;
+
+namespace DexterCS
+{
+ public interface ICheckerConfig
+ {
+ string ToolName { get; set; }
+ LANGUAGE Language { get; set; }
+ List CheckerList { get; }
+ bool IsActiveChecker(string checkerCode);
+ IChecker GetChecker(string checkerCode);
+ void AddCheckerList(Checker checker);
+ }
+}
\ No newline at end of file
diff --git a/project/dexter-cs/DexterCS/Src/IDexterAnalyzerListener.cs b/project/dexter-cs/DexterCS/Src/IDexterAnalyzerListener.cs
new file mode 100644
index 00000000..5c5750e3
--- /dev/null
+++ b/project/dexter-cs/DexterCS/Src/IDexterAnalyzerListener.cs
@@ -0,0 +1,38 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using System.Collections.Generic;
+
+namespace DexterCS
+{
+ internal interface IDexterAnalyzerListener
+ {
+ void HandlePreRunStaticAnalysis(AnalysisConfig config);
+ void HandlePostRunStaticAnalysis(AnalysisConfig config, List resultList);
+ void HandlePreSendSourceCode(AnalysisConfig config);
+ }
+}
\ No newline at end of file
diff --git a/project/dexter-cs/DexterCS/Src/IDexterCLIOption.cs b/project/dexter-cs/DexterCS/Src/IDexterCLIOption.cs
new file mode 100644
index 00000000..64eb349c
--- /dev/null
+++ b/project/dexter-cs/DexterCS/Src/IDexterCLIOption.cs
@@ -0,0 +1,52 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using System.Collections.Generic;
+using System.IO;
+
+namespace DexterCS
+{
+ public interface IDexterCLIOption
+ {
+ bool IsSpisSpecifiedCheckerEnabledMode { get; set; }
+ bool IsTargetFileOptionEnabled { get; set; }
+ List TargetFileFullPathList { get; set; }
+
+ FileInfo JsonResultFile { get; set; }
+ FileInfo XmlResultFile { get; set; }
+ FileInfo Xml2ResultFile { get; set; }
+
+ bool IsJsonResultFile { get; set; }
+ bool IsXmlResultFile { get; set; }
+ bool IsXml2ResultFile { get; set; }
+ string UserId { get; set; }
+ string UserPassword { get; set; }
+ string ServerHostIp { get; set; }
+ int ServerPort { get; set; }
+ string ConfigFilePath { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/project/dexter-cs/DexterCS/Src/IDexterConfigFile.cs b/project/dexter-cs/DexterCS/Src/IDexterConfigFile.cs
new file mode 100644
index 00000000..963ccaaa
--- /dev/null
+++ b/project/dexter-cs/DexterCS/Src/IDexterConfigFile.cs
@@ -0,0 +1,39 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using System.Collections.Generic;
+
+namespace DexterCS
+{
+ public interface IDexterConfigFile
+ {
+ string DexterHome { get; set; }
+ void LoadFromFile(string dexterConfig);
+ AnalysisConfig ToAnalysisConfig();
+ List GenerateSourceFileFullPathList();
+ }
+}
\ No newline at end of file
diff --git a/project/dexter-cs/DexterCS/Src/IDexterHomeListener.cs b/project/dexter-cs/DexterCS/Src/IDexterHomeListener.cs
new file mode 100644
index 00000000..2b1cf471
--- /dev/null
+++ b/project/dexter-cs/DexterCS/Src/IDexterHomeListener.cs
@@ -0,0 +1,34 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+namespace DexterCS
+{
+ public interface IDexterHomeListener
+ {
+ void HandleDexterHomeChanged(string oldPath, string newPath);
+ }
+}
\ No newline at end of file
diff --git a/project/dexter-cs/DexterCS/Src/IDexterPlugin.cs b/project/dexter-cs/DexterCS/Src/IDexterPlugin.cs
new file mode 100644
index 00000000..d2dba2a7
--- /dev/null
+++ b/project/dexter-cs/DexterCS/Src/IDexterPlugin.cs
@@ -0,0 +1,46 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using System;
+
+namespace DexterCS
+{
+ public interface IDexterPlugin
+ {
+ string PLUGIN_NAME { get; }
+ string PLUGIN_DESCRIPTION { get; }
+ string PLUGIN_AUTHOR { get; }
+ Version VERSION { get; }
+
+ void Dispose();
+
+ void Init();
+ bool SupportLanguage(DexterConfig.LANGUAGE language);
+ string[] SupportingFileExtensions { get; }
+ AnalysisResult Analyze(AnalysisConfig config);
+ }
+}
\ No newline at end of file
diff --git a/project/dexter-cs/DexterCS/Src/IDexterPluginInitializer.cs b/project/dexter-cs/DexterCS/Src/IDexterPluginInitializer.cs
new file mode 100644
index 00000000..b4e139a3
--- /dev/null
+++ b/project/dexter-cs/DexterCS/Src/IDexterPluginInitializer.cs
@@ -0,0 +1,36 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using System.Collections.Generic;
+
+namespace DexterCS
+{
+ public interface IDexterPluginInitializer
+ {
+ void Init(List list);
+ }
+}
\ No newline at end of file
diff --git a/project/dexter-cs/DexterCS/Src/IDexterPluginManager.cs b/project/dexter-cs/DexterCS/Src/IDexterPluginManager.cs
new file mode 100644
index 00000000..59b42111
--- /dev/null
+++ b/project/dexter-cs/DexterCS/Src/IDexterPluginManager.cs
@@ -0,0 +1,38 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using System.Collections.Generic;
+
+namespace DexterCS
+{
+ public interface IDexterPluginManager
+ {
+ void InitDexterPlugins();
+ List Analyze(AnalysisConfig config);
+
+ }
+}
\ No newline at end of file
diff --git a/project/dexter-cs/DexterCS/Src/Job/SendResultJob.cs b/project/dexter-cs/DexterCS/Src/Job/SendResultJob.cs
new file mode 100644
index 00000000..a0258353
--- /dev/null
+++ b/project/dexter-cs/DexterCS/Src/Job/SendResultJob.cs
@@ -0,0 +1,95 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using DexterCS.Client;
+using log4net;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Text;
+
+namespace DexterCS.Job
+{
+ public class SendResultJob
+ {
+ private static ILog CliLog = LogManager.GetLogger(typeof(SendResultJob));
+ private IDexterClient client;
+ public SendResultJob(IDexterClient client)
+ {
+ this.client = client;
+ }
+
+ internal static void SendResultFileThenDelete(IDexterClient client, string resultFilePrefix)
+ {
+ string resultFolderStr = DexterConfig.Instance.DexterHome + "/" + DexterConfig.RESULT_FOLDER_NAME;
+ IList resultFiles = DexterUtil.GetSubFileNamesByPrefix(resultFolderStr, resultFilePrefix);
+
+ foreach (var resultFile in resultFiles)
+ {
+ SendResult(resultFile, client);
+ MmoveResultFileToOldFolder(resultFile);
+ }
+ }
+
+ private static void MmoveResultFileToOldFolder(FileInfo resultFile)
+ {
+ try
+ {
+ string oldResultPath = DexterConfig.Instance.OldFilePath;
+ File.Move(resultFile.FullName, oldResultPath + "/" + resultFile.Name);
+ }
+ catch (Exception e)
+ {
+ throw new DexterRuntimeException(e.Message);
+ }
+ }
+
+ private static void SendResult(FileInfo resultFile, IDexterClient client)
+ {
+ if (DexterUtil.IsDirectory(resultFile) || !resultFile.Exists || resultFile.IsReadOnly)
+ {
+ throw new DexterRuntimeException("Cannot access result file (is not a directory or does not exist or is read-only: " + resultFile);
+ }
+
+ if (!DexterUtil.JSON_EXTENSION.Equals(resultFile.Extension)
+ || !resultFile.ToString().StartsWith("result_", StringComparison.Ordinal))
+ {
+ return;
+ }
+ try
+ {
+ client.SendAnalysisResult(File.ReadAllText(resultFile.FullName, Encoding.UTF8)).Wait();
+ }
+ catch (Exception e)
+ {
+ CliLog.Error(e.StackTrace);
+ }
+ }
+
+
+ }
+}
\ No newline at end of file
diff --git a/project/dexter-cs/DexterCS/Src/Occurence.cs b/project/dexter-cs/DexterCS/Src/Occurence.cs
new file mode 100644
index 00000000..ac09bde7
--- /dev/null
+++ b/project/dexter-cs/DexterCS/Src/Occurence.cs
@@ -0,0 +1,96 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using Newtonsoft.Json;
+using System;
+
+namespace DexterCS
+{
+ public class Occurence
+ {
+ public Occurence() { }
+ [JsonProperty("code")]
+ public string Code { get; set; }
+ [JsonProperty("startLine")]
+ public int StartLine { get; set; }
+ [JsonProperty("endLine")]
+ public int EndLine { get; set; }
+ [JsonProperty("charStart")]
+ public int CharStart { get; set; }
+ [JsonProperty("charEnd")]
+ public int CharEnd { get; set; }
+ [JsonProperty("variableName")]
+ public string VariableName { get; set; }
+ [JsonProperty("stringValue")]
+ public string StringValue { get; set; }
+ [JsonProperty("fieldName")]
+ public string FieldName { get; set; }
+ [JsonProperty("message")]
+ public string Message { get; set; }
+
+ public override int GetHashCode()
+ {
+ return base.GetHashCode();
+ }
+
+ public override bool Equals(Object obj)
+ {
+ if (obj == null)
+ {
+ return false;
+ }
+ PreOccurence other = (PreOccurence)obj;
+
+ if (!Object.Equals(StartLine, other.StartLine))
+ {
+ return false;
+ }
+ if (!Object.Equals(EndLine, other.EndLine))
+ {
+ return false;
+ }
+ if (!string.IsNullOrEmpty(FieldName) && !Object.Equals(FieldName, other.FieldName))
+ {
+ return false;
+ }
+ if (!string.IsNullOrEmpty(VariableName) && !Object.Equals(VariableName, other.VariableName))
+ {
+ return false;
+ }
+ if (!string.IsNullOrEmpty(StringValue) && !Object.Equals(StringValue, other.StringValue))
+ {
+ return false;
+ }
+ if (!string.IsNullOrEmpty(Message) && !Object.Equals(Message, other.Message))
+ {
+ return false;
+ }
+
+ return true;
+ }
+ }
+}
diff --git a/project/dexter-cs/DexterCS/Src/PreOccurence.cs b/project/dexter-cs/DexterCS/Src/PreOccurence.cs
new file mode 100644
index 00000000..9730abab
--- /dev/null
+++ b/project/dexter-cs/DexterCS/Src/PreOccurence.cs
@@ -0,0 +1,76 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+namespace DexterCS
+{
+ public class PreOccurence : BaseDefect
+ {
+ public string OccurenceCode { get; set; }
+ public int CharStart { get; set; }
+ public int CharEnd { get; set; }
+ public int StartLine { get; set; }
+ public int EndLine { get; set; }
+ public string VariableName { get; set; }
+ public string StringValue { get; set; }
+ public string FieldName { get; set; }
+ public string Message { get; set; }
+ public string SeverityCode { get; set; }
+ public string CategoryName { get; set; }
+
+ internal Occurence ToOccurence()
+ {
+ Occurence occurence = new Occurence();
+ occurence.StartLine = StartLine;
+ occurence.EndLine = EndLine;
+ occurence.FieldName = FieldName;
+ occurence.CharStart = CharStart;
+ occurence.CharEnd = CharEnd;
+ occurence.Message = Message;
+ occurence.StringValue = StringValue;
+ occurence.VariableName = VariableName;
+ occurence.Code = OccurenceCode;
+
+ return occurence;
+ }
+
+ internal Defect ToDefect()
+ {
+ Defect defect = new Defect();
+ defect.CheckerCode = CheckerCode;
+ defect.ClassName = ClassName;
+ defect.FileName = FileName;
+ defect.ModulePath = ModulePath;
+ defect.MethodName = MethodName;
+ defect.SeverityCode = SeverityCode;
+ defect.CategoryName = CategoryName;
+ defect.Language = Language;
+ defect.ToolName = ToolName;
+
+ return defect;
+ }
+ }
+}
diff --git a/project/dexter-cs/DexterCS/Src/ProjectAnalysisConfiguration.cs b/project/dexter-cs/DexterCS/Src/ProjectAnalysisConfiguration.cs
new file mode 100644
index 00000000..a76fb79f
--- /dev/null
+++ b/project/dexter-cs/DexterCS/Src/ProjectAnalysisConfiguration.cs
@@ -0,0 +1,61 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using System.Collections.Generic;
+
+namespace DexterCS
+{
+ public class ProjectAnalysisConfiguration
+ {
+ public string ProjectName { get; set; }
+ public string ProjectFullPath { get; set; }
+ private List sourceDirs;
+ public List SourceDirs
+ {
+ get { return sourceDirs ?? new List(); }
+ set { sourceDirs = value; }
+ }
+
+ private List headerDirs;
+ public List HeaderDirs
+ {
+ get { return headerDirs ?? new List(); }
+ set { headerDirs = value; }
+ }
+
+ private List targetDir;
+ public List TargetDirs
+ {
+ get
+ {
+ return targetDir ?? new List();
+ }
+ set { targetDir = value; }
+ }
+ public string Type { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/project/dexter-cs/DexterCS/Src/ResultFileConstant.cs b/project/dexter-cs/DexterCS/Src/ResultFileConstant.cs
new file mode 100644
index 00000000..a332376d
--- /dev/null
+++ b/project/dexter-cs/DexterCS/Src/ResultFileConstant.cs
@@ -0,0 +1,51 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+namespace DexterCS
+{
+ public static class ResultFileConstant
+ {
+ internal static readonly string PROJECT_NAME = "projectName";
+ internal static readonly string PROJECT_FULL_PATH = "projectFullPath";
+ internal static readonly string FILE_TYPE = "FILE";
+ internal static readonly string FOLDER_TYPE = "FOLDER";
+ internal static readonly string PROJECT_TYPE = "PROJECT";
+ internal static readonly string SNAPSHOT_TYPE = "SNAPSHOT";
+ internal static readonly string FILE_NAME = "fileName";
+ internal static readonly string MODULE_PATH = "modulePath";
+ internal static readonly string SNAPSHOT_ID = "snapshotId";
+ internal static readonly string HEADER_DIR = "headerDir";
+ internal static readonly string SOURCE_DIR = "sourceDir";
+ internal static readonly string FULL_FILE_PATH = "fullFilePath";
+ internal static readonly string GROUP_ID = "groupId";
+ internal static readonly string DEFECT_COUNT = "defectCount";
+ internal static readonly long DEFAULT_GROUPT_IP = 1;
+ internal static readonly string DEFECT_LIST = "defectList";
+ internal static readonly string RESULT_FILE_EXTENSION = ".json";
+ internal static readonly string RESULT_FILE_PREFIX = "result_";
+ }
+}
\ No newline at end of file
diff --git a/project/dexter-cs/DexterCS/Src/ResultJson/ResultJsonParsing.cs b/project/dexter-cs/DexterCS/Src/ResultJson/ResultJsonParsing.cs
new file mode 100644
index 00000000..e589413e
--- /dev/null
+++ b/project/dexter-cs/DexterCS/Src/ResultJson/ResultJsonParsing.cs
@@ -0,0 +1,107 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using Newtonsoft.Json;
+using System.Collections.Generic;
+
+namespace DexterCS
+{
+ [JsonObject(MemberSerialization.OptIn)]
+ public class ResultJsonParsing
+ {
+ [JsonProperty("snapshotId")]
+ public long SnapshotId { get; set; }
+ [JsonProperty("modulePath")]
+ public string ModulePath { get; set; }
+ [JsonProperty("fileName")]
+ public string FileName { get; set; }
+ [JsonProperty("fullFilePath")]
+ public string FullFilePath { get; set; }
+ [JsonProperty("groupId")]
+ public string GroupId { get; set; }
+ [JsonProperty("projectName")]
+ public string ProjectName { get; set; }
+ [JsonProperty("defectCount")]
+ public int defectCount { get; set; }
+ [JsonProperty("defectList")]
+ public IList DefectList { get; set; }
+ }
+
+ [JsonObject(MemberSerialization.OptIn)]
+ public class DefectJsonParsing
+ {
+ [JsonProperty("message")]
+ public string Message { get; set; }
+ [JsonProperty("severityCode")]
+ public string SeverityCode { get; set; }
+ [JsonProperty("categoryName")]
+ public string CategoryName { get; set; }
+ [JsonProperty("analysisType")]
+ public string AnalysisType { get; set; }
+ [JsonProperty("occurences")]
+ public IList Occurences { get; set; }
+ [JsonProperty("checkerCode")]
+ public string CheckerCode { get; set; }
+ [JsonProperty("className")]
+ public string ClassName { get; set; }
+ [JsonProperty("methodName")]
+ public string MethodName { get; set; }
+ [JsonProperty("toolName")]
+ public string ToolName { get; set; }
+ [JsonProperty("language")]
+ public string Language { get; set; }
+ [JsonProperty("fileStatus")]
+ public string FileStatus { get; set; }
+ [JsonProperty("modulePath")]
+ public string ModulePath { get; set; }
+ [JsonProperty("fileName")]
+ public string FileName { get; set; }
+ }
+
+ [JsonObject(MemberSerialization.OptIn)]
+ public class OccurenceJsonParsing
+ {
+ [JsonProperty("code")]
+ public string Code { get; set; }
+ [JsonProperty("startLine")]
+ public int StartLine { get; set; }
+ [JsonProperty("endLine")]
+ public int EndLine { get; set; }
+ [JsonProperty("charStart")]
+ public int CharStart { get; set; }
+ [JsonProperty("charEnd")]
+ public int CharEnd { get; set; }
+ [JsonProperty("variableName")]
+ public string VariableName { get; set; }
+ [JsonProperty("stringValue")]
+ public string StringValue { get; set; }
+ [JsonProperty("fieldName")]
+ public string FieldName { get; set; }
+ [JsonProperty("message")]
+ public string Message { get; set; }
+ }
+}
diff --git a/project/dexter-cs/DexterCS/Src/TargetFile.cs b/project/dexter-cs/DexterCS/Src/TargetFile.cs
new file mode 100644
index 00000000..348899de
--- /dev/null
+++ b/project/dexter-cs/DexterCS/Src/TargetFile.cs
@@ -0,0 +1,122 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using log4net;
+using Newtonsoft.Json;
+using System;
+
+namespace DexterCS
+{
+ public class TargetFile
+ {
+ private static ILog CliLog = LogManager.GetLogger(typeof(TargetFile));
+
+ private string fileName = "";
+ [JsonProperty("fileName")]
+ public string FileName
+ {
+ get { return fileName; }
+ set { this.fileName = value; }
+ }
+
+ [JsonProperty("fileStatus")]
+ public string FileStatus { get; set; }
+
+ protected TargetFile() { }
+
+ public TargetFile(TargetFile other)
+ {
+ fileName = other.FileName;
+ ModulePath = other.ModulePath;
+ FileStatus = other.FileStatus;
+ }
+ private string modulePath = "";
+ [JsonProperty("modulePath")]
+ public string ModulePath
+ {
+ get { return modulePath; }
+ set
+ {
+ if (string.IsNullOrEmpty(value))
+ {
+ return;
+ }
+ value = value.Replace("\\", "/");
+ if (GetLanguageEnum() == DexterConfig.LANGUAGE.JAVA)
+ {
+ value = value.Replace(".", "/");
+ }
+ value = value.Replace("//", "/");
+ if (value.EndsWith("/", StringComparison.CurrentCulture))
+ {
+ value = value.Substring(0, value.Length - 1);
+ }
+ if (value.StartsWith("/", StringComparison.CurrentCulture))
+ {
+ value = value.Substring(1, value.Length);
+ }
+
+ modulePath = value;
+ }
+ }
+
+
+ public DexterConfig.LANGUAGE GetLanguageEnum()
+ {
+ if (string.IsNullOrEmpty(FileName))
+ {
+ CliLog.Error("fileName field is not set yet.");
+ return DexterConfig.LANGUAGE.UNKNOWN;
+ }
+
+ if (FileName.ToLowerInvariant().EndsWith(".java", StringComparison.CurrentCulture))
+ {
+ return DexterConfig.LANGUAGE.JAVA;
+ }
+ else if (FileName.ToLowerInvariant().EndsWith(".cpp", StringComparison.CurrentCulture)
+ || FileName.ToLowerInvariant().EndsWith(".hpp", StringComparison.CurrentCulture)
+ || FileName.ToLowerInvariant().EndsWith(".c", StringComparison.CurrentCulture)
+ || FileName.ToLowerInvariant().EndsWith(".h", StringComparison.CurrentCulture))
+ {
+ return DexterConfig.LANGUAGE.CPP;
+ }
+ else if (FileName.ToLowerInvariant().EndsWith(".js", StringComparison.CurrentCulture))
+ {
+ return DexterConfig.LANGUAGE.JAVASCRIPT;
+ }
+ else if (FileName.ToLowerInvariant().EndsWith(".cs", StringComparison.CurrentCulture))
+ {
+ return DexterConfig.LANGUAGE.C_SHARP;
+ }
+ else
+ {
+ return DexterConfig.LANGUAGE.UNKNOWN;
+ }
+ }
+
+ }
+}
diff --git a/project/dexter-cs/DexterCS/Src/Util/DexterUtil.cs b/project/dexter-cs/DexterCS/Src/Util/DexterUtil.cs
new file mode 100644
index 00000000..70347d0b
--- /dev/null
+++ b/project/dexter-cs/DexterCS/Src/Util/DexterUtil.cs
@@ -0,0 +1,354 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using log4net;
+using Microsoft.CodeAnalysis.CSharp.Syntax;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Text.RegularExpressions;
+
+namespace DexterCS
+{
+ public class DexterUtil
+ {
+ private static ILog CliLog = LogManager.GetLogger(typeof(DexterUtil));
+ public enum STATUS_CODE
+ {
+ SUCCESS, ERROR
+ }
+ public enum OS
+ {
+ WINDOWS, LINUX, MAC, UNKNOWN
+ };
+
+ public enum BIT
+ {
+ _32, _64, _128, UNKNOWN
+ };
+
+ public enum OS_BIT
+ {
+ WIN32, WIN64, WIN128, LINUX32, LINUX64, LINUX128, UNKNOWN
+ };
+
+ public static string[] Split(string input)
+ {
+ input = Regex.Replace(input, "_", " ", RegexOptions.CultureInvariant);
+ input = Regex.Replace(input, "([A-Z])", " $1", RegexOptions.CultureInvariant);
+ input = Regex.Replace(input, @"\s+", " ");
+ return input.Trim().Split(' '); ;
+ }
+
+ public static string FILE_SEPARATOR
+ {
+ get
+ {
+ return Path.AltDirectorySeparatorChar.ToString();
+ }
+ }
+
+ public static bool IsPropertyDeclarationBoolean(PropertyDeclarationSyntax propertyRaw)
+ {
+ return propertyRaw.Type.ToString() == "bool" || propertyRaw.Type.ToString() == "boolean";
+ }
+
+ private static string dateFormat = "yyyyMMddHHmmss";
+ private static DateTimeFormatInfo dti = new DateTimeFormatInfo();
+ public static readonly string JSON_EXTENSION = ".json";
+
+ public static bool IsDirectory(FileInfo fi)
+ {
+ FileAttributes attr = File.GetAttributes(fi.FullName);
+ return ((attr & FileAttributes.Directory) == FileAttributes.Directory);
+ }
+
+ public static string GetSourcecodeFromFile(string filePath)
+ {
+ LogErrorAndExitIfFileDoesNotExist(filePath);
+ try
+ {
+ FileInfo fi = new FileInfo(filePath);
+ if (IsDirectory(fi) || fi.Length > DexterConfig.SOURCE_FILE_SIZE_LIMIT)
+ {
+ CliLog.Error("Dexter can't analyze:" + fi.FullName);
+ return "";
+ }
+ return File.ReadAllText(fi.FullName, Encoding.UTF8);
+ }
+ catch (IOException e)
+ {
+ throw new DexterRuntimeException(e.Message);
+ }
+ }
+
+ public static string GetCurrentMethodName()
+ {
+ StackTrace st = new StackTrace();
+ StackFrame sf = st.GetFrame(1);
+
+ return sf.GetMethod().Name;
+ }
+
+ public static string currentDateTime()
+ {
+ DateTime dateTime = DateTime.Now;
+ return ConvertDateTimeToFormatedString(dateTime);
+ }
+
+ internal static void CreateFolderIfNotExist(string resultFolderStr)
+ {
+ if (!Directory.Exists(resultFolderStr))
+ {
+ return;
+ }
+ try
+ {
+ Directory.CreateDirectory(resultFolderStr);
+ }
+ catch (Exception e)
+ {
+ CliLog.Error(e.StackTrace);
+ }
+ }
+
+ public static string GetBase64CharSequence(string sourcecode)
+ {
+ try
+ {
+ return Convert.ToBase64String(Encoding.UTF8.GetBytes(sourcecode));
+ }
+ catch (Exception e)
+ {
+ CliLog.Error(e.StackTrace);
+ return "";
+ }
+ }
+
+ internal static void WriteFilecontents(string contents, FileInfo file)
+ {
+ try
+ {
+ using (StreamWriter sw = file.AppendText())
+ {
+ sw.Write(contents);
+ }
+ }
+ catch (Exception e)
+ {
+ CliLog.Error(e.StackTrace);
+ }
+ }
+
+ internal static FileInfo CreateEmptyFileIfDoesNotExist(string path)
+ {
+ FileInfo fi = new FileInfo(path);
+ if (!fi.Exists)
+ {
+ try
+ {
+ using (FileStream fs = fi.Create())
+ {
+ Byte[] info = new UTF8Encoding(true).GetBytes("");
+ fs.Write(info, 0, info.Length);
+ }
+ }
+ catch (Exception e)
+ {
+ CliLog.Error(e.StackTrace);
+ }
+ }
+ return fi;
+ }
+
+ internal static void LogErrorAndExitIfFileDoesNotExist(string filePath)
+ {
+ try
+ {
+ if (!File.Exists(filePath))
+ {
+ throw (new DexterRuntimeException("File does not exist: " + filePath));
+ }
+ }
+ catch (DexterRuntimeException e)
+ {
+ CliLog.Error(e.Message);
+ Environment.Exit(0);
+ }
+ }
+
+ internal static string GetCurrentDateTimeMillis()
+ {
+ return DateTime.UtcNow.ToString("yyyyMMddHHmmssfff", CultureInfo.InvariantCulture);
+ }
+
+ internal static string GetContentsFromFile(string cfgFilePath)
+ {
+ LogErrorAndExitIfFileDoesNotExist(cfgFilePath);
+ return File.ReadAllText(cfgFilePath, Encoding.UTF8);
+ }
+
+ public static void CreateEmptyFileIfNotExist(string cfgFilePath)
+ {
+ if (!File.Exists(cfgFilePath))
+ {
+ try
+ {
+ File.Create(cfgFilePath);
+ }
+ catch (Exception e)
+ {
+ CliLog.Error(e.StackTrace);
+ }
+ }
+ }
+
+ private static string ConvertDateTimeToFormatedString(DateTime dateTime)
+ {
+ return dateTime.ToString(dateFormat, dti);
+ }
+ //convert Formatted String into DateTime
+ public static DateTime convertStringToDateTime(string dateTimeInString)
+ {
+ dti.LongTimePattern = dateFormat;
+ return DateTime.ParseExact(dateTimeInString, "T", dti);
+ }
+
+ public static void CheckFolderExistence(dynamic dir)
+ {
+ if (Object.ReferenceEquals(null, dir))
+ {
+ return;
+ }
+ if (!new DirectoryInfo(dir.ToString()).Exists)
+ {
+ throw new DexterRuntimeException("Directory does not exist: " + dir);
+ }
+ }
+
+ public static string RefinePath(string path)
+ {
+ if (string.IsNullOrEmpty(path))
+ {
+ return "";
+ }
+ string _path = path.Replace("//", "/").Replace("\\", "/").Replace(DexterUtil.FILE_SEPARATOR, "/");
+ return _path;
+ }
+
+ public static void CreateFolderIfDoesNotExist(string dir)
+ {
+ try
+ {
+ if (!Directory.Exists(dir))
+ {
+ Directory.CreateDirectory(dir);
+ }
+ }
+ catch (Exception)
+ {
+ CliLog.Error("Cannot create directory: " + dir);
+ }
+ }
+
+ public static List getSubFileNames(string baseDir)
+ {
+ if (string.IsNullOrEmpty(baseDir))
+ {
+ return new List();
+ }
+
+ try
+ {
+ DirectoryInfo baseDirInfo = new DirectoryInfo(baseDir);
+ var fileNames = baseDirInfo.GetFiles().Select(fileName => fileName.Name).ToList();
+ return fileNames;
+ }
+ catch (Exception)
+ {
+ CliLog.Error("Cannot get file names in directory: " + baseDir);
+ return new List();
+ }
+ }
+
+ public static IList GetSubFileNamesByPrefix(string baseDir, string fileNamePrefix)
+ {
+ List fileNames = null;
+ if (string.IsNullOrEmpty(baseDir))
+ {
+ return new List();
+ }
+
+ try
+ {
+ DirectoryInfo baseDirInfo = new DirectoryInfo(baseDir);
+ return baseDirInfo.GetFiles(fileNamePrefix + "*").ToList();
+ }
+ catch (Exception)
+ {
+ CliLog.Error("Cannot get file names in directory: " + baseDir);
+ }
+ return fileNames;
+ }
+
+ public static string getFileName(string filePath)
+ {
+ return Path.GetFileName(filePath);
+ }
+
+ public static bool HasOption(object option)
+ {
+ return !(Object.ReferenceEquals(null, option));
+ }
+
+ public static IList GetAllFilesAndDirectoriesInDirectory(string dir)
+ {
+ IList subDirList = new List();
+ try
+ {
+ foreach (string f in Directory.GetFiles(dir))
+ {
+ subDirList.Add(Path.GetFullPath(f));
+ }
+ foreach (string d in Directory.GetDirectories(dir))
+ {
+ subDirList.Add(Path.GetFullPath(d));
+ GetAllFilesAndDirectoriesInDirectory(d);
+ }
+ }
+ catch (Exception e)
+ {
+ CliLog.Error(e.Message);
+ }
+ return subDirList;
+ }
+ }
+};
\ No newline at end of file
diff --git a/project/dexter-cs/DexterCS/dexter_cfg.json b/project/dexter-cs/DexterCS/dexter_cfg.json
new file mode 100644
index 00000000..87ff0232
--- /dev/null
+++ b/project/dexter-cs/DexterCS/dexter_cfg.json
@@ -0,0 +1,14 @@
+{
+ "dexterHome":"C:\plugin",
+ "dexterServerIp": "127.0.0.1",
+ "dexterServerPort": "4982",
+ "projectName":"sample",
+ "projectFullPath":"D:\tests\project\example\example",
+ "sourceDir":["D:\tests\project\example\example"],
+ "headerDir":["D:\tests\project\example\example"],
+ "sourceEncoding":"UTF-8",
+ "libDir":[],
+ "binDir":"",
+ "type":"FILE",
+ "fileName":["main.cpp"]
+}
\ No newline at end of file
diff --git a/project/dexter-cs/DexterCS/packages.config b/project/dexter-cs/DexterCS/packages.config
new file mode 100644
index 00000000..f59267f9
--- /dev/null
+++ b/project/dexter-cs/DexterCS/packages.config
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/project/dexter-cs/DexterCSTest/DexterCSTest.csproj b/project/dexter-cs/DexterCSTest/DexterCSTest.csproj
new file mode 100644
index 00000000..5e1fd256
--- /dev/null
+++ b/project/dexter-cs/DexterCSTest/DexterCSTest.csproj
@@ -0,0 +1,208 @@
+
+
+
+ Debug
+ AnyCPU
+ {2468EF67-FA29-463E-942C-2BC2C20FDAD1}
+ Library
+ Properties
+ DexterCSTest
+ DexterCSTest
+ v4.7.1
+ 512
+ {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+ 10.0
+ $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
+ $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages
+ False
+ UnitTest
+
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+ ..\packages\Castle.Core.4.0.0\lib\net45\Castle.Core.dll
+
+
+ ..\packages\CommandLineParser.2.0.61-alpha\lib\net45\CommandLine.dll
+
+
+ ..\packages\log4net.2.0.8\lib\net45-full\log4net.dll
+
+
+ ..\packages\Microsoft.CodeAnalysis.Common.1.1.0\lib\net45\Microsoft.CodeAnalysis.dll
+
+
+ ..\packages\Microsoft.CodeAnalysis.CSharp.1.1.0\lib\net45\Microsoft.CodeAnalysis.CSharp.dll
+
+
+ ..\packages\Microsoft.CodeAnalysis.CSharp.Workspaces.1.1.0\lib\net45\Microsoft.CodeAnalysis.CSharp.Workspaces.dll
+
+
+ ..\packages\Microsoft.CodeAnalysis.VisualBasic.1.1.0\lib\net45\Microsoft.CodeAnalysis.VisualBasic.dll
+
+
+ ..\packages\Microsoft.CodeAnalysis.VisualBasic.Workspaces.1.1.0\lib\net45\Microsoft.CodeAnalysis.VisualBasic.Workspaces.dll
+
+
+ ..\packages\Microsoft.CodeAnalysis.Workspaces.Common.1.1.0\lib\net45\Microsoft.CodeAnalysis.Workspaces.dll
+
+
+ ..\packages\Microsoft.CodeAnalysis.Workspaces.Common.1.1.0\lib\net45\Microsoft.CodeAnalysis.Workspaces.Desktop.dll
+
+
+ ..\packages\Newtonsoft.Json.4.5.11\lib\net40\Newtonsoft.Json.dll
+
+
+
+ ..\packages\System.Collections.Immutable.1.1.37\lib\dotnet\System.Collections.Immutable.dll
+
+
+ ..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.AttributedModel.dll
+
+
+ ..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.Convention.dll
+
+
+ ..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.Hosting.dll
+
+
+ ..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.Runtime.dll
+
+
+ ..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.TypedParts.dll
+
+
+ ..\packages\System.Linq.4.3.0\lib\net463\System.Linq.dll
+ True
+
+
+
+
+ ..\packages\Microsoft.AspNet.WebApi.Client.5.2.0\lib\net45\System.Net.Http.Formatting.dll
+
+
+ ..\packages\System.Reflection.Metadata.1.2.0\lib\portable-net45+win8\System.Reflection.Metadata.dll
+
+
+ ..\packages\Microsoft.AspNet.WebApi.Core.5.2.0\lib\net45\System.Web.Http.dll
+
+
+ ..\packages\Microsoft.AspNet.WebApi.WebHost.5.2.0\lib\net45\System.Web.Http.WebHost.dll
+
+
+
+
+
+
+
+
+
+
+
+ False
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Designer
+
+
+
+ Designer
+
+
+
+
+
+
+ {933d5e52-7521-4941-acac-b2daca3aedac}
+ DexterCRC
+
+
+ {0fefcf8d-0a75-40f1-beec-21be6e483c48}
+ DexterCS
+
+
+ {83b7b942-be00-4cc8-98e8-4a19c50f38cd}
+ DexterDepend
+
+
+
+
+
+
+
+
+
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/project/dexter-cs/DexterCSTest/Properties/AssemblyInfo.cs b/project/dexter-cs/DexterCSTest/Properties/AssemblyInfo.cs
new file mode 100644
index 00000000..20115cdb
--- /dev/null
+++ b/project/dexter-cs/DexterCSTest/Properties/AssemblyInfo.cs
@@ -0,0 +1,45 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using System.Reflection;
+using System.Runtime.InteropServices;
+
+[assembly: AssemblyTitle("DexterCSTest")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("DexterCSTest")]
+[assembly: AssemblyCopyright("")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+[assembly: ComVisible(false)]
+
+[assembly: Guid("2468ef67-fa29-463e-942c-2bc2c20fdad1")]
+
+[assembly: AssemblyVersion("0.0.1.0")]
+[assembly: AssemblyFileVersion("0.0.1.0")]
diff --git a/project/dexter-cs/DexterCSTest/Resource/checker-config.json b/project/dexter-cs/DexterCSTest/Resource/checker-config.json
new file mode 100644
index 00000000..e6618465
--- /dev/null
+++ b/project/dexter-cs/DexterCSTest/Resource/checker-config.json
@@ -0,0 +1,18 @@
+{
+ "checkerList": [
+ {
+ "code": "USLEEP",
+ "name": "USEEP for Critical Secure Coding",
+ "type": "BOTH",
+ "categoryName": "Market Issue",
+ "severityCode": "CRI",
+ "version": "0.10.6",
+ "description": "usleep(useconds_t usec) function can affect system performance, if usec parameter set too shortly. VD recommend that you use more than 10000 ms of usleep function.",
+ "isActive": true,
+ "properties": { "value": "10000" },
+ "cwe": 0
+ }
+ ],
+ "toolName": "dexter-cs-crc",
+ "language": "C_SHARP"
+}
\ No newline at end of file
diff --git a/project/dexter-cs/DexterCSTest/Resource/dexter_cfg-snapshot.json b/project/dexter-cs/DexterCSTest/Resource/dexter_cfg-snapshot.json
new file mode 100644
index 00000000..7dba2f43
--- /dev/null
+++ b/project/dexter-cs/DexterCSTest/Resource/dexter_cfg-snapshot.json
@@ -0,0 +1,14 @@
+{
+ "dexterHome": ":/DEV/temp/dexterCS-cli_#.#.#_64",
+ "dexterServerIp": "localhost",
+ "dexterServerPort": "4982",
+ "projectName": "epg_ug",
+ "projectFullPath": ":/TEST//TestSI",
+ "sourceDir": [ ":/TEST//TestSI/TestDir4", ":/TEST//TestSI/TestDir5" ],
+ "headerDir": [],
+ "sourceEncoding": "UTF-8",
+ "libDir": [],
+ "binDir": "",
+ "type": "PROJECT",
+ "snapshotId": "155556"
+}
diff --git a/project/dexter-cs/DexterCSTest/Resource/dexter_cfg.json b/project/dexter-cs/DexterCSTest/Resource/dexter_cfg.json
new file mode 100644
index 00000000..f66efd15
--- /dev/null
+++ b/project/dexter-cs/DexterCSTest/Resource/dexter_cfg.json
@@ -0,0 +1,13 @@
+{
+ "dexterHome": ":/DEV/temp/dexterCS-cli_0.1.0_64",
+ "dexterServerIp": "localhost",
+ "dexterServerPort": "4982",
+ "projectName": "epg_ug",
+ "projectFullPath": ":/TEST//TestSI",
+ "sourceDir": [ ":/TEST//TestSI/TestDir4", ":/TEST//TestSI/TestDir5" ],
+ "headerDir": [],
+ "sourceEncoding": "UTF-8",
+ "libDir": [],
+ "binDir": "",
+ "type": "PROJECT"
+}
diff --git a/project/dexter-cs/DexterCSTest/Src/CRCLogic/CommentRulesTest.cs b/project/dexter-cs/DexterCSTest/Src/CRCLogic/CommentRulesTest.cs
new file mode 100644
index 00000000..a49953de
--- /dev/null
+++ b/project/dexter-cs/DexterCSTest/Src/CRCLogic/CommentRulesTest.cs
@@ -0,0 +1,44 @@
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using System;
+using DexterCRC;
+using DexterCRC.Src.CheckerLogic;
+
+namespace DexterCSTest.Src.CRCLogic
+{
+ [TestClass]
+ class CommentRulesTest
+ {
+ CommentRules rules;
+ public void Init()
+ {
+ rules = new CommentRules();
+ }
+
+ [TestMethod]
+ public void HasDefect_Should_True_without_Slashes()
+ {
+ Init();
+ //given
+ string statement = @" Write the description for the Class/Interface ";
+ //when
+ bool result = rules.HasDefect(statement);
+ //then
+ Assert.IsTrue(result);
+ }
+
+ [TestMethod]
+ public void HasDefect_Should_False_with_Slashes()
+ {
+ Init();
+ //given
+ string statement = @"///
+ /// Write the description for the Class/Interface.
+ ///
+ ";
+ //when
+ bool result = rules.HasDefect(statement);
+ //then
+ Assert.IsFalse(result);
+ }
+ }
+}
diff --git a/project/dexter-cs/DexterCSTest/Src/CheckerLogic/CamelCasingTests.cs b/project/dexter-cs/DexterCSTest/Src/CheckerLogic/CamelCasingTests.cs
new file mode 100644
index 00000000..4291fef9
--- /dev/null
+++ b/project/dexter-cs/DexterCSTest/Src/CheckerLogic/CamelCasingTests.cs
@@ -0,0 +1,89 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+namespace DexterCRC.Tests
+{
+ [TestClass()]
+ public class CamelCasingTests
+ {
+ CamelCasing camelCasing;
+ void Init()
+ {
+ camelCasing = new CamelCasing();
+ }
+
+ [TestMethod]
+ public void HasDefectTest_WithoutCamelCasing_ReturnsTrue()
+ {
+ Init();
+ // Given
+ string typeName = @"Name";
+ // When
+ bool result = camelCasing.HasDefect(typeName);
+ // Then
+ Assert.IsTrue(result);
+ }
+
+ [TestMethod]
+ public void HasDefectTest_WithCamelCasing_ReturnsFalse()
+ {
+ Init();
+ // Given
+ string typeName = @"pName";
+ // When
+ bool result = camelCasing.HasDefect(typeName);
+ // Then
+ Assert.IsFalse(result);
+ }
+
+ [TestMethod]
+ public void HasDefectTest_WithLambdaParameter_ReturnsFalse()
+ {
+ Init();
+ // Given
+ string parameterName = @"_";
+ // When
+ bool result = camelCasing.HasDefect(parameterName);
+ // Then
+ Assert.IsFalse(result);
+ }
+
+ [TestMethod]
+ public void HasDefectTest_WithLambdaParameter_ReturnsTrue()
+ {
+ Init();
+ // Given
+ string parameterName = @"_pName";
+ // When
+ bool result = camelCasing.HasDefect(parameterName);
+ // Then
+ Assert.IsTrue(result);
+ }
+ }
+}
\ No newline at end of file
diff --git a/project/dexter-cs/DexterCSTest/Src/CheckerLogic/CommentRulesTests.cs b/project/dexter-cs/DexterCSTest/Src/CheckerLogic/CommentRulesTests.cs
new file mode 100644
index 00000000..8c4a1761
--- /dev/null
+++ b/project/dexter-cs/DexterCSTest/Src/CheckerLogic/CommentRulesTests.cs
@@ -0,0 +1,134 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+namespace DexterCRC.Src.CheckerLogic.Tests
+{
+ [TestClass()]
+ public class CommentRulesTests
+ {
+ CommentRules commentRules;
+
+ private void Init()
+ {
+ commentRules = new CommentRules();
+ }
+
+ [TestMethod()]
+ public void HasDefectTest_CommentWithOutSummaryTag_ReturnsTrue()
+ {
+ Init();
+
+ // Given
+ string comment = @"
+ /// Comment content";
+
+ // When
+ bool result = commentRules.HasDefect(comment);
+
+ // Then
+ Assert.IsTrue(result);
+ }
+
+ [TestMethod()]
+ public void HasDefectTest_CommentWithSummaryTagIncorrectSlashes_ReturnsTrue()
+ {
+ Init();
+
+ // Given
+ string comment = @"
+ //
+ // Summary content
+ // ";
+
+ // When
+ bool result = commentRules.HasDefect(comment);
+
+ // Then
+ Assert.IsTrue(result);
+ }
+
+ [TestMethod()]
+ public void HasDefectTest_CommentWithTypoInSummaryTag_ReturnsTrue()
+ {
+ Init();
+
+ // Given
+ string comment = @"
+ //
+ // Summary content
+ // ";
+
+ // When
+ bool result = commentRules.HasDefect(comment);
+
+ // Then
+ Assert.IsTrue(result);
+ }
+
+ [TestMethod()]
+ public void HasDefectTest_LongCommentWithSummaryTagAndOtherTags_ReturnsFalse()
+ {
+ Init();
+
+ // Given
+ string comment = @"
+ ///
+ ///
+ /// Summary content
+ ///
+ /// Remarks
+ /// Example
+ /// The Plugin to Add";
+
+ // When
+ bool result = commentRules.HasDefect(comment);
+
+ // Then
+ Assert.IsFalse(result);
+ }
+
+ [TestMethod()]
+ public void HasDefectTest_CommentWithSummaryTag_ReturnsFalse()
+ {
+ Init();
+
+ // Given
+ string comment = @"
+ ///
+ /// Summary content
+ /// ";
+
+ // When
+ bool result = commentRules.HasDefect(comment);
+
+ // Then
+ Assert.IsFalse(result);
+ }
+ }
+}
\ No newline at end of file
diff --git a/project/dexter-cs/DexterCSTest/Src/CheckerLogic/HeadingRuleTest.cs b/project/dexter-cs/DexterCSTest/Src/CheckerLogic/HeadingRuleTest.cs
new file mode 100644
index 00000000..cffa3d5f
--- /dev/null
+++ b/project/dexter-cs/DexterCSTest/Src/CheckerLogic/HeadingRuleTest.cs
@@ -0,0 +1,94 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using DexterCRC;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+namespace DexterCSTest.Src.CRCLogic
+{
+ [TestClass]
+ class HeadingRuleTest
+ {
+ HeadingRule rules;
+ public void Init()
+ {
+ rules = new HeadingRule();
+ }
+
+ [TestMethod]
+ public void HasDefect_SHedingRule_without_Heading()
+ {
+ Init();
+ //given
+ string statement = @"
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Text;
+ using System.Threading.Tasks;
+
+ namespace DexterCRC
+ {
+ public class SampleClass {";
+ //when
+ bool result = rules.HasDefect(statement);
+ //then
+ Assert.IsTrue(result);
+ }
+
+ [TestMethod]
+ public void HasDefect_HedingRule_with_Heading()
+ {
+ Init();
+ //given
+ string statement = @" // Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ // PROPRIETARY/CONFIDENTIAL
+ // This software is the confidential and proprietary
+ // information of SAMSUNG ELECTRONICS (Confidential Information). You shall
+ // not disclose such Confidential Information and shall use it only in
+ // accordance with the terms of the license agreement you entered into with
+ // SAMSUNG ELECTRONICS. SAMSUNG make no representations or warranties about the
+ // suitability of the software, either express or implied, including but not
+ // limited to the implied warranties of merchantability, fitness for a
+ // particular purpose, or non-infringement. SAMSUNG shall not be liable for any
+ // damages suffered by licensee as a result of using, modifying or distributing
+ // this software or its derivatives.
+
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Text;
+ using System.Threading.Tasks;
+
+ namespace DexterCRC
+ {
+ public class SampleClass {";
+ //when
+ bool result = rules.HasDefect(statement);
+ //then
+ Assert.IsFalse(result);
+ }
+ }
+}
\ No newline at end of file
diff --git a/project/dexter-cs/DexterCSTest/Src/CheckerLogic/MessageMethodTests.cs b/project/dexter-cs/DexterCSTest/Src/CheckerLogic/MessageMethodTests.cs
new file mode 100644
index 00000000..2f5e82f5
--- /dev/null
+++ b/project/dexter-cs/DexterCSTest/Src/CheckerLogic/MessageMethodTests.cs
@@ -0,0 +1,73 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using System.Collections.Generic;
+
+namespace DexterDepend.Tests
+{
+ [TestClass()]
+ public class MessageMehodTests
+ {
+ MessageMethod messageMethod;
+ List subMethodList;
+
+ public void Init()
+ {
+ messageMethod = new MessageMethod();
+ subMethodList = new List();
+ subMethodList.AddRange(new string[] { "new MessagePort" });
+ }
+ [TestMethod]
+ public void HasMessageMethodTest_MessagePortUsage_ReturnsTrue()
+ {
+ // Given
+ Init();
+ string methodName = "new MessagePort(senderPort, false);";
+
+ // When
+ bool result = messageMethod.HasVconfMethod(subMethodList, methodName);
+
+ // Then
+ Assert.IsTrue(result);
+ }
+
+ [TestMethod]
+ public void HasMessageMethodTest_OtherMethod_ReturnsFalse()
+ {
+ // Given
+ Init();
+ string methodName = "MessagePort(\"weatherMsgPort\", false);";
+
+ // When
+ bool result = messageMethod.HasVconfMethod(subMethodList, methodName);
+
+ // Then
+ Assert.IsFalse(result);
+ }
+ }
+}
\ No newline at end of file
diff --git a/project/dexter-cs/DexterCSTest/Src/CheckerLogic/MethodSpacingTests.cs b/project/dexter-cs/DexterCSTest/Src/CheckerLogic/MethodSpacingTests.cs
new file mode 100644
index 00000000..841904a6
--- /dev/null
+++ b/project/dexter-cs/DexterCSTest/Src/CheckerLogic/MethodSpacingTests.cs
@@ -0,0 +1,232 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using Microsoft.CodeAnalysis;
+using Microsoft.CodeAnalysis.CSharp;
+using Microsoft.CodeAnalysis.CSharp.Syntax;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using System.Linq;
+
+namespace DexterCRC.Src.CheckerLogic.Tests
+{
+ [TestClass()]
+ public class MethodSpacingTests
+ {
+ MethodSpacing methodSpacing;
+
+ private void Init()
+ {
+ methodSpacing = new MethodSpacing();
+ }
+
+ [TestMethod()]
+ public void HasDefectTest_OneMethodWithCorrectSpacing_ReturnsFalse()
+ {
+ Init();
+ // Given
+ var tree = CSharpSyntaxTree.ParseText(@"class Class1
+ {
+ int variable1 = 0;
+
+ public void Method1()
+ {
+
+ }
+ }"
+ );
+ SyntaxNode syntaxRoot = tree.GetRoot();
+
+ var methodRaws = syntaxRoot.DescendantNodes().OfType();
+
+ foreach (var methodRaw in methodRaws)
+ {
+ SyntaxTriviaList syntaxTriviaList = methodRaw.GetLeadingTrivia();
+
+ // When
+
+ bool result = methodSpacing.HasDefect(syntaxTriviaList);
+
+ // Then
+ Assert.IsFalse(result);
+ }
+ }
+
+ [TestMethod()]
+ public void HasDefectTest_OneMethodsWithIncorrectSpacing_ReturnsTrue()
+ {
+ Init();
+ // Given
+ var tree = CSharpSyntaxTree.ParseText(@"class Class1
+ {
+ int variable1 = 0;
+
+
+ public void Method1()
+ {
+
+ }
+ }"
+ );
+ SyntaxNode syntaxRoot = tree.GetRoot();
+
+ var methodRaws = syntaxRoot.DescendantNodes().OfType();
+
+ SyntaxTriviaList syntaxTriviaList = methodRaws.ElementAt(0).GetLeadingTrivia();
+
+ // When
+ bool result = methodSpacing.HasDefect(syntaxTriviaList);
+
+ // Then
+ Assert.IsTrue(result);
+ }
+
+ [TestMethod()]
+ public void HasDefectTest_OneMethodWithCorrectSpacingAndOneLineComment_ReturnsFalse()
+ {
+ Init();
+ // Given
+ var tree = CSharpSyntaxTree.ParseText(@"class Class1
+ {
+ int variable1 = 0;
+ // Comment1
+
+ public void Method1()
+ {
+
+ }
+ }"
+ );
+ SyntaxNode syntaxRoot = tree.GetRoot();
+
+ var methodRaws = syntaxRoot.DescendantNodes().OfType();
+
+ SyntaxTriviaList syntaxTriviaList = methodRaws.ElementAt(0).GetLeadingTrivia();
+
+ // When
+ bool result = methodSpacing.HasDefect(syntaxTriviaList);
+
+ // Then
+ Assert.IsFalse(result);
+ }
+
+ [TestMethod()]
+ public void HasDefectTest_OneMethodWithIncorrectSpacingAndOneLineComment_ReturnsTrue()
+ {
+ Init();
+ // Given
+ var tree = CSharpSyntaxTree.ParseText(@"class Class1
+ {
+ int variable1 = 0;
+ // Comment1
+
+
+ public void Method1()
+ {
+
+ }
+ }"
+ );
+ SyntaxNode syntaxRoot = tree.GetRoot();
+
+ var methodRaws = syntaxRoot.DescendantNodes().OfType();
+
+ SyntaxTriviaList syntaxTriviaList = methodRaws.ElementAt(0).GetLeadingTrivia();
+
+ // When
+ bool result = methodSpacing.HasDefect(syntaxTriviaList);
+
+ // Then
+ Assert.IsTrue(result);
+ }
+
+ [TestMethod()]
+ public void HasDefectTest_OneMethodWithCorrectSpacingAndMultiLineComment_ReturnsFalse()
+ {
+ Init();
+ // Given
+ var tree = CSharpSyntaxTree.ParseText(@"class Class1
+ {
+ int variable1 = 0;
+
+ /*
+ * Comment1
+ *
+ */
+ public void Method1()
+ {
+
+ }
+ }"
+ );
+ SyntaxNode syntaxRoot = tree.GetRoot();
+
+ var methodRaws = syntaxRoot.DescendantNodes().OfType();
+
+ SyntaxTriviaList syntaxTriviaList = methodRaws.ElementAt(0).GetLeadingTrivia();
+
+ // When
+ bool result = methodSpacing.HasDefect(syntaxTriviaList);
+
+ // Then
+ Assert.IsFalse(result);
+ }
+
+ [TestMethod()]
+ public void HasDefectTest_OneMethodWithIncorrectSpacingAndMultiLineComment_ReturnsTrue()
+ {
+ Init();
+ // Given
+ var tree = CSharpSyntaxTree.ParseText(@"class Class1
+ {
+ int variable1 = 0;
+
+ /*
+ * Comment1
+ *
+ */
+
+
+ public void Method1()
+ {
+
+ }
+ }"
+ );
+ SyntaxNode syntaxRoot = tree.GetRoot();
+
+ var methodRaws = syntaxRoot.DescendantNodes().OfType();
+
+ SyntaxTriviaList syntaxTriviaList = methodRaws.ElementAt(0).GetLeadingTrivia();
+
+ // When
+ bool result = methodSpacing.HasDefect(syntaxTriviaList);
+
+ // Then
+ Assert.IsTrue(result);
+ }
+ }
+}
\ No newline at end of file
diff --git a/project/dexter-cs/DexterCSTest/Src/CheckerLogic/PascalCasingTests.cs b/project/dexter-cs/DexterCSTest/Src/CheckerLogic/PascalCasingTests.cs
new file mode 100644
index 00000000..c056fff3
--- /dev/null
+++ b/project/dexter-cs/DexterCSTest/Src/CheckerLogic/PascalCasingTests.cs
@@ -0,0 +1,79 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+namespace DexterCRC.Tests
+{
+ [TestClass()]
+ public class PascalCasingTests
+ {
+ PascalCasing pascalCasing;
+
+ void Init()
+ {
+ pascalCasing = new PascalCasing();
+ }
+
+ [TestMethod]
+ public void HasDefectTest_WithPascalCasing_ReturnsTrue()
+ {
+ Init();
+ // Given
+ string typeName = @"textReader";
+ // When
+ bool result = pascalCasing.HasDefect(typeName);
+ // Then
+ Assert.IsTrue(result);
+ }
+
+ [TestMethod]
+ public void HasDefectTest_WithPascalCasing_ReturnsFalse()
+ {
+ Init();
+ // Given
+ string typeName = @"TestReader";
+ // When
+ bool result = pascalCasing.HasDefect(typeName);
+ // Then
+ Assert.IsFalse(result);
+
+ }
+
+ [TestMethod]
+ public void HasDefectTest_WithPascalCasingWithInteger_ReturnsFalse()
+ {
+ Init();
+ // Given
+ string typeName = @"TestReader1301";
+ // When
+ bool result = pascalCasing.HasDefect(typeName);
+ // Then
+ Assert.IsFalse(result);
+ }
+ }
+}
\ No newline at end of file
diff --git a/project/dexter-cs/DexterCSTest/Src/CheckerLogic/PrefixNamingTests.cs b/project/dexter-cs/DexterCSTest/Src/CheckerLogic/PrefixNamingTests.cs
new file mode 100644
index 00000000..32161ddb
--- /dev/null
+++ b/project/dexter-cs/DexterCSTest/Src/CheckerLogic/PrefixNamingTests.cs
@@ -0,0 +1,76 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+namespace DexterCRC.Tests
+{
+ [TestClass()]
+ public class PrefixNamingTests
+ {
+ PrefixNaming prefixNaming;
+
+ void Init()
+ {
+ prefixNaming = new PrefixNaming();
+ }
+
+ [TestMethod]
+ public void HasDefectTest_WithoutAnI_ReturnsTrue()
+ {
+ // Given
+ Init();
+ string interfaceName = @"DexterInterfaceNameTest";
+ NamingSet namingSet = new NamingSet
+ {
+ currentName = interfaceName,
+ basicWord = "I"
+ };
+ // When
+ bool result = prefixNaming.HasDefect(namingSet);
+ // Then
+ Assert.IsTrue(result);
+ }
+
+ [TestMethod]
+ public void HasDefectTest_WithAnI_ReturnsFalse()
+ {
+ Init();
+ // Given
+ string interfaceName = @"IDexterInterfaceNameTest";
+ NamingSet namingSet = new NamingSet
+ {
+ currentName = interfaceName,
+ basicWord = "I"
+ };
+ // When
+ bool result = prefixNaming.HasDefect(namingSet);
+ // Then
+ Assert.IsFalse(result);
+ }
+ }
+}
\ No newline at end of file
diff --git a/project/dexter-cs/DexterCSTest/Src/CheckerLogic/SuffixNamingTests.cs b/project/dexter-cs/DexterCSTest/Src/CheckerLogic/SuffixNamingTests.cs
new file mode 100644
index 00000000..7f0d32a6
--- /dev/null
+++ b/project/dexter-cs/DexterCSTest/Src/CheckerLogic/SuffixNamingTests.cs
@@ -0,0 +1,76 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+namespace DexterCRC.Tests
+{
+ [TestClass()]
+ public class SuffixNamingTests
+ {
+ SuffixNaming suffixNaming;
+
+ void Init()
+ {
+ suffixNaming = new SuffixNaming();
+ }
+
+ [TestMethod]
+ public void HasDefectTest_WithoutAnI_ReturnsTrue()
+ {
+ // Given
+ Init();
+ string interfaceName = @"ClassWork";
+ NamingSet namingSet = new NamingSet
+ {
+ currentName = interfaceName,
+ basicWord = "er"
+ };
+ // When
+ bool result = suffixNaming.HasDefect(namingSet);
+ // Then
+ Assert.IsTrue(result);
+ }
+
+ [TestMethod]
+ public void HasDefectTest_WithAnI_ReturnsFalse()
+ {
+ Init();
+ // Given
+ string interfaceName = @"ClassWorker";
+ NamingSet namingSet = new NamingSet
+ {
+ currentName = interfaceName,
+ basicWord = "er"
+ };
+ // When
+ bool result = suffixNaming.HasDefect(namingSet);
+ // Then
+ Assert.IsFalse(result);
+ }
+ }
+}
\ No newline at end of file
diff --git a/project/dexter-cs/DexterCSTest/Src/CheckerLogic/WithBraceTests.cs b/project/dexter-cs/DexterCSTest/Src/CheckerLogic/WithBraceTests.cs
new file mode 100644
index 00000000..f53a6ec8
--- /dev/null
+++ b/project/dexter-cs/DexterCSTest/Src/CheckerLogic/WithBraceTests.cs
@@ -0,0 +1,68 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+namespace DexterCRC.Tests
+{
+ [TestClass()]
+ public class WithBraceTests
+ {
+ WithBrace brace;
+ public void Init()
+ {
+ brace = new WithBrace();
+ }
+
+ [TestMethod]
+ public void HasDefectTest_WithoutBrace_ReturnsTrue()
+ {
+ Init();
+ // Given
+ string statement = @" int a = 10; ";
+ // When
+ bool result = brace.HasDefect(statement);
+ // Then
+ Assert.IsTrue(result);
+ }
+
+ [TestMethod]
+ public void HasDefectTest_With_Brace_ReturnsFalse()
+ {
+ Init();
+ // Given
+ string statement = @"{
+ int a = 10;
+ int b = 20;
+ }";
+ // When
+ bool result = brace.HasDefect(statement);
+ // Then
+ Assert.IsFalse(result);
+ }
+ }
+}
\ No newline at end of file
diff --git a/project/dexter-cs/DexterCSTest/Src/CheckerLogic/WithoutUnderscoreTests.cs b/project/dexter-cs/DexterCSTest/Src/CheckerLogic/WithoutUnderscoreTests.cs
new file mode 100644
index 00000000..b3a2e39c
--- /dev/null
+++ b/project/dexter-cs/DexterCSTest/Src/CheckerLogic/WithoutUnderscoreTests.cs
@@ -0,0 +1,61 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+namespace DexterCRC.Tests
+{
+ [TestClass()]
+ public class WithoutUnderscoreTests
+ {
+ [TestMethod]
+ public void HasDefectTest_WithUnderscore_ReturnsFalse()
+ {
+ // Given
+ string interfaceName = @"Dexter_CS_Test";
+
+ // When
+ bool result = (new WithoutUnderscore()).HasDefect(interfaceName);
+
+ // Then
+ Assert.IsTrue(result);
+ }
+
+ [TestMethod]
+ public void HasDefectTest_CorrectInterfaceName_ReturnsFalse()
+ {
+ // Given
+ string interfaceName = @"IDexterCSTest";
+
+ // When
+ bool result = (new WithoutUnderscore()).HasDefect(interfaceName);
+
+ // Then
+ Assert.IsFalse(result);
+ }
+ }
+}
\ No newline at end of file
diff --git a/project/dexter-cs/DexterCSTest/Src/Config/DexterConfigTests.cs b/project/dexter-cs/DexterCSTest/Src/Config/DexterConfigTests.cs
new file mode 100644
index 00000000..e7b6fc02
--- /dev/null
+++ b/project/dexter-cs/DexterCSTest/Src/Config/DexterConfigTests.cs
@@ -0,0 +1,177 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using DexterCSTest.Src;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using System;
+using System.IO;
+using System.Linq;
+
+namespace DexterCS.Tests
+{
+ [TestClass()]
+ public class DexterConfigTests
+ {
+ [TestMethod()]
+ public void CreateInitialFolderAndFilesTest_ProvidedDexterHomePath_CreatesNonEmptyDirectory()
+ {
+ try
+ {
+ // Given
+ DexterConfig dexterConfig = new DexterConfig();
+ string dexterHomePath = DexterCSTestUtil.TestingDirectory + @"\" + "DexterHome";
+ dexterConfig.DexterHome = dexterHomePath;
+
+ // When
+ dexterConfig.CreateInitialFolderAndFiles();
+
+ // Then
+ Assert.IsTrue(Directory.GetFileSystemEntries(dexterHomePath).Any());
+ }
+ finally
+ {
+ DexterCSTestUtil.ClearTestingDirectory();
+ }
+ }
+
+ [TestMethod()]
+ public void CreateInitialFolderAndFilesTest_ProvidedDexterHomePath_CreatesBinDirectoryInDexterHome()
+ {
+ try
+ {
+ // Given
+ DexterConfig dexterConfig = new DexterConfig();
+ string dexterHomePath = DexterCSTestUtil.TestingDirectory + @"\" + "DexterHome";
+ dexterConfig.DexterHome = dexterHomePath;
+
+ // When
+ dexterConfig.CreateInitialFolderAndFiles();
+
+ foreach (string s in Directory.GetDirectories(dexterHomePath))
+ {
+ Console.WriteLine(s);
+ }
+
+ // Then
+ Assert.IsTrue(Directory.GetDirectories(dexterHomePath)
+ .Any(x => new DirectoryInfo(x).Name == "bin"));
+ }
+ finally
+ {
+ DexterCSTestUtil.ClearTestingDirectory();
+ }
+ }
+
+ [TestMethod()]
+ public void ChangeDexterHomeTest_SimplePath_ChangesDexterHomePath()
+ {
+ // Given
+ string dexterHomePath = @"C:\NewDexterHomePath";
+ DexterConfig dexterConfig = new DexterConfig();
+
+ // When
+ dexterConfig.ChangeDexterHome(dexterHomePath);
+
+ // Then
+ Assert.AreEqual(
+ Path.GetFullPath(dexterHomePath),
+ Path.GetFullPath(dexterConfig.DexterHome));
+ }
+
+ [TestMethod()]
+ public void ChangeDexterHomeTest_ComplexPath_ChangesDexterHomePath()
+ {
+ // Given
+ string dexterHomePath = @"C:\Directory1\\Directory2\..\NewDexterHomePath";
+ DexterConfig dexterConfig = new DexterConfig();
+
+ // When
+ dexterConfig.ChangeDexterHome(dexterHomePath);
+
+ // Then
+ Assert.AreEqual(
+ Path.GetFullPath(dexterHomePath),
+ Path.GetFullPath(dexterConfig.DexterHome));
+ }
+
+ [TestMethod()]
+ public void IsAnalysisAllowedFileTest_OneExtensionSupported_FileWithSupportedExtensions_ReturnsTrue()
+ {
+ // Given
+ DexterConfig dexterConfig = new DexterConfig();
+ dexterConfig.AddSupportedFileExtensions(new string[] { "cpp" });
+
+ // When
+ bool result = dexterConfig.IsFileSupportedForAnalysis("file.cpp");
+
+ // Then
+ Assert.IsTrue(result);
+ }
+
+ [TestMethod()]
+ public void IsAnalysisAllowedFileTest_OneExtensionSupported_FileWithNotSupportedExtensions_ReturnsFalse()
+ {
+ // Given
+ DexterConfig dexterConfig = new DexterConfig();
+ dexterConfig.AddSupportedFileExtensions(new string[] { "cpp" });
+
+ // When
+ bool result = dexterConfig.IsFileSupportedForAnalysis("file.txt");
+
+ // Then
+ Assert.IsFalse(result);
+ }
+
+ [TestMethod()]
+ public void IsAnalysisAllowedFileTest_MultipleExtensionsSupported_FileWithSupportedExtension_ReturnsTrue()
+ {
+ // Given
+ DexterConfig dexterConfig = new DexterConfig();
+ dexterConfig.AddSupportedFileExtensions(new string[] { "c", "cpp", "java" });
+
+ // When
+ bool result = dexterConfig.IsFileSupportedForAnalysis("file.c");
+
+ // Then
+ Assert.IsTrue(result);
+ }
+
+ [TestMethod()]
+ public void IsAnalysisAllowedFileTest_MultipleExtensionsSupported_FileWithNotSupportedExtension_ReturnsFalse()
+ {
+ // Given
+ DexterConfig dexterConfig = new DexterConfig();
+ dexterConfig.AddSupportedFileExtensions(new string[] { "c", "cpp", "java" });
+
+ // When
+ bool result = dexterConfig.IsFileSupportedForAnalysis("file.cs");
+
+ // Then
+ Assert.IsFalse(result);
+ }
+ }
+}
\ No newline at end of file
diff --git a/project/dexter-cs/DexterCSTest/Src/Crc/ClassCRCTests.cs b/project/dexter-cs/DexterCSTest/Src/Crc/ClassCRCTests.cs
new file mode 100644
index 00000000..31784614
--- /dev/null
+++ b/project/dexter-cs/DexterCSTest/Src/Crc/ClassCRCTests.cs
@@ -0,0 +1,93 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+namespace DexterCRC.Tests
+{
+ [TestClass()]
+ public class ClassCRCTests
+ {
+ ClassCRC classCRC;
+
+ void Init()
+ {
+ classCRC = new ClassCRC();
+ }
+
+ [TestMethod]
+ public void CheckEventNamingTest_ReturnsTrue_Invalid_Class_Name()
+ {
+ Init();
+ // Given
+ string className = @"MyEvent";
+ string baseName = @"EventArgs";
+ // When
+ bool result = classCRC.CheckEventNaming(className, baseName);
+ // Then
+ Assert.IsTrue(result);
+ }
+
+ [TestMethod]
+ public void CheckEventNamingTest_ValidClassName_ReturnsFalse()
+ {
+ Init();
+ // Given
+ string className = @"MyEventArgs";
+ string baseName = @"EventArgs";
+ // When
+ bool result = classCRC.CheckEventNaming(className, baseName);
+ // Then
+ Assert.IsFalse(result);
+ }
+
+ [TestMethod]
+ public void CheckAttributeNamingTest_InvalidClassName_ReturnsTrue()
+ {
+ Init();
+ // Given
+ string className = @"User";
+ string baseName = @"Attribute";
+ // When
+ bool result = classCRC.CheckAttributeNaming(className, baseName);
+ // Then
+ Assert.IsTrue(result);
+ }
+ [TestMethod]
+ public void CheckAttributeNamingTest_ValidClassName_ReturnsFalse()
+ {
+ Init();
+ // Given
+ string className = @"HelpAttribute";
+ string baseName = @"Attribute";
+ // When
+ bool result = classCRC.CheckAttributeNaming(className, baseName);
+ // Then
+ Assert.IsFalse(result);
+ }
+ }
+}
\ No newline at end of file
diff --git a/project/dexter-cs/DexterCSTest/Src/Crc/DelegateCRCTests.cs b/project/dexter-cs/DexterCSTest/Src/Crc/DelegateCRCTests.cs
new file mode 100644
index 00000000..bf5e659c
--- /dev/null
+++ b/project/dexter-cs/DexterCSTest/Src/Crc/DelegateCRCTests.cs
@@ -0,0 +1,76 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+namespace DexterCRC.Tests
+{
+ [TestClass()]
+ public class DelegateCRCTests
+ {
+ SuffixNaming suffixNaming;
+
+ void Init()
+ {
+ suffixNaming = new SuffixNaming();
+ }
+
+ [TestMethod]
+ public void HasDefectTest_WithInvalidDelegateName_Should_True()
+ {
+ Init();
+ // Given
+ string delegateName = @"NameChangedDelegate";
+ NamingSet namingSet = new NamingSet
+ {
+ currentName = delegateName,
+ basicWord = DexterCRCUtil.DELEGATE_SUFFIX
+ };
+ // When
+ bool result = !suffixNaming.HasDefect(namingSet);
+ // Then
+ Assert.IsTrue(result);
+ }
+
+ [TestMethod]
+ public void HasDefectTest_WithValidDelegateName_ReturnsFalse()
+ {
+ Init();
+ // Given
+ string delegateName = @"NameChangedDele";
+ NamingSet namingSet = new NamingSet
+ {
+ currentName = delegateName,
+ basicWord = DexterCRCUtil.DELEGATE_SUFFIX
+ };
+ // When
+ bool result = !suffixNaming.HasDefect(namingSet);
+ // Then
+ Assert.IsFalse(result);
+ }
+ }
+}
\ No newline at end of file
diff --git a/project/dexter-cs/DexterCSTest/Src/Crc/EventCRCTests.cs b/project/dexter-cs/DexterCSTest/Src/Crc/EventCRCTests.cs
new file mode 100644
index 00000000..4d1817d4
--- /dev/null
+++ b/project/dexter-cs/DexterCSTest/Src/Crc/EventCRCTests.cs
@@ -0,0 +1,75 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+namespace DexterCRC.Tests
+{
+ [TestClass()]
+ public class EventCRCTests
+ {
+ SuffixNaming suffixNaming;
+ void Init()
+ {
+ suffixNaming = new SuffixNaming();
+ }
+
+ [TestMethod]
+ public void HasDefectTest_WithInValidEventTypeName_ReturnsTrue()
+ {
+ Init();
+ // Given
+ string eventTypeName = @"NameChangedEvent";
+ NamingSet namingSet = new NamingSet
+ {
+ currentName = eventTypeName,
+ basicWord = DexterCRCUtil.EVENT_TYPE_SUFFIX
+ };
+ // When
+ bool result = suffixNaming.HasDefect(namingSet);
+ // Then
+ Assert.IsTrue(result);
+ }
+
+ [TestMethod]
+ public void HasDefectTest_WithValidEventTypeName_ReturnsFalse()
+ {
+ Init();
+ // Given
+ string eventTypeName = @"NameChangedEventHandler";
+ NamingSet namingSet = new NamingSet
+ {
+ currentName = eventTypeName,
+ basicWord = DexterCRCUtil.EVENT_TYPE_SUFFIX
+ };
+ // When
+ bool result = suffixNaming.HasDefect(namingSet);
+ // Then
+ Assert.IsFalse(result);
+ }
+ }
+}
\ No newline at end of file
diff --git a/project/dexter-cs/DexterCSTest/Src/Crc/FieldCRCTests.cs b/project/dexter-cs/DexterCSTest/Src/Crc/FieldCRCTests.cs
new file mode 100644
index 00000000..5ce88111
--- /dev/null
+++ b/project/dexter-cs/DexterCSTest/Src/Crc/FieldCRCTests.cs
@@ -0,0 +1,102 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+namespace DexterCRC.Tests
+{
+ [TestClass()]
+ public class FieldCRCTests
+ {
+ FieldCRC filedCRC;
+
+ void Init()
+ {
+ filedCRC = new FieldCRC();
+ }
+
+ [TestMethod]
+ public void HasInvalidModifierTest_HasInvalidProtectedModifier_ReturnsTrue()
+ {
+ Init();
+ // Given
+ string modifier = @" protected static";
+ // When
+ bool result = filedCRC.HasInvalidModifier(modifier);
+ // Then
+ Assert.IsTrue(result);
+ }
+
+ [TestMethod]
+ public void HasInvalidModifierTest_HasInvalidStaticModifier_ReturnsTrue()
+ {
+ Init();
+ // Given
+ string modifier = @"public static";
+ // When
+ bool result = filedCRC.HasInvalidModifier(modifier);
+ // Then
+ Assert.IsTrue(result);
+ }
+
+ [TestMethod]
+ public void HasInvalidModifierTest_HasInvalidStaticModifierWithBlank_ReturnsTrue()
+ {
+ Init();
+ // Given
+ string modifier = @" public static ";
+ // When
+ bool result = filedCRC.HasInvalidModifier(modifier);
+ // Then
+ Assert.IsTrue(result);
+ }
+
+ [TestMethod]
+ public void HasInvalidModifierTest_HasValidPublicModifier_ReturnsFalse()
+ {
+ Init();
+ // Given
+ string modifier = @"public";
+ // When
+ bool result = filedCRC.HasInvalidModifier(modifier);
+ // Then
+ Assert.IsFalse(result);
+ }
+
+ [TestMethod]
+ public void HasInvalidModifierTest_HasValidPrivateModifier_ReturnsFalse()
+ {
+ Init();
+ // Given
+ string modifier = @"private ";
+ // When
+ bool result = filedCRC.HasInvalidModifier(modifier);
+ // Then
+ Assert.IsFalse(result);
+ }
+ }
+}
\ No newline at end of file
diff --git a/project/dexter-cs/DexterCSTest/Src/Depend/VconfETCTests.cs b/project/dexter-cs/DexterCSTest/Src/Depend/VconfETCTests.cs
new file mode 100644
index 00000000..a252b68c
--- /dev/null
+++ b/project/dexter-cs/DexterCSTest/Src/Depend/VconfETCTests.cs
@@ -0,0 +1,87 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using System.Collections.Generic;
+
+namespace DexterDepend.Tests
+{
+ [TestClass()]
+ public class VconfETCTests
+ {
+ VconfMethod vconfMethod;
+ List subMethodList;
+
+ public void Init()
+ {
+ vconfMethod = new VconfMethod();
+ subMethodList = new List();
+ subMethodList.AddRange(new string[] { "Vconf.NotifyKeyChanged" });
+ }
+ [TestMethod]
+ public void HasVConfMethodTest_VconfEtc_ReturnsTrue()
+ {
+ // Given
+ Init();
+ string methodName = "Vconf.NotifyKeyChanged(IntKey, Outkey, out GetValue)";
+
+ // When
+ bool result = vconfMethod.HasVconfMethod(subMethodList, methodName);
+
+ // Then
+ Assert.IsTrue(result);
+ }
+
+ [TestMethod]
+ public void HasVConfMethodTest_OtherMethod_ReturnsFalse()
+ {
+ // Given
+ Init();
+ string methodName = "Vconf.NotifyKeysTest(IntKey, out GetValue)";
+
+ // When
+ bool result = vconfMethod.HasVconfMethod(subMethodList, methodName);
+
+ // Then
+ Assert.IsFalse(result);
+ }
+
+ [TestMethod]
+ public void HasVConfMethodTest_VconfGetInt_ReturnsTrue()
+ {
+ // Given
+ Init();
+ string methodName = "Vconf.NotifyKeyChanged(IntKey, outKey, out GetValue)";
+
+ // When
+ bool result = vconfMethod.HasVconfMethod(subMethodList, methodName);
+
+ // Then
+ Assert.IsTrue(result);
+ }
+ }
+}
\ No newline at end of file
diff --git a/project/dexter-cs/DexterCSTest/Src/Depend/VconfGetTests.cs b/project/dexter-cs/DexterCSTest/Src/Depend/VconfGetTests.cs
new file mode 100644
index 00000000..cb4279eb
--- /dev/null
+++ b/project/dexter-cs/DexterCSTest/Src/Depend/VconfGetTests.cs
@@ -0,0 +1,87 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using System.Collections.Generic;
+
+namespace DexterDepend.Tests
+{
+ [TestClass()]
+ public class VconfGetTests
+ {
+ VconfMethod vconfMethod;
+ List subMethodList;
+
+ public void Init()
+ {
+ vconfMethod = new VconfMethod();
+ subMethodList = new List();
+ subMethodList.AddRange(new string[] { "Vconf.GetString", "Vconf.GetInt" });
+ }
+ [TestMethod]
+ public void HasVConfMethodTest_VconfGet_ReturnsTrue()
+ {
+ // Given
+ Init();
+ string methodName = "Vconf.GetInt(IntKey, out GetValue)";
+
+ // When
+ bool result = vconfMethod.HasVconfMethod(subMethodList, methodName);
+
+ // Then
+ Assert.IsTrue(result);
+ }
+
+ [TestMethod]
+ public void HasVConfMethodTest_OtherMethod_ReturnsFalse()
+ {
+ // Given
+ Init();
+ string methodName = "Vconf.GetTest(IntKey, out GetValue)";
+
+ // When
+ bool result = vconfMethod.HasVconfMethod(subMethodList, methodName);
+
+ // Then
+ Assert.IsFalse(result);
+ }
+
+ [TestMethod]
+ public void HasVConfMethodTest_VconfGetInt_ReturnsTrue()
+ {
+ // Given
+ Init();
+ string methodName = "Vconf.GetInt(IntKey, out GetValue)";
+
+ // When
+ bool result = vconfMethod.HasVconfMethod(subMethodList, methodName);
+
+ // Then
+ Assert.IsTrue(result);
+ }
+ }
+}
diff --git a/project/dexter-cs/DexterCSTest/Src/Depend/VconfSetTests.cs b/project/dexter-cs/DexterCSTest/Src/Depend/VconfSetTests.cs
new file mode 100644
index 00000000..edde3042
--- /dev/null
+++ b/project/dexter-cs/DexterCSTest/Src/Depend/VconfSetTests.cs
@@ -0,0 +1,87 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using System.Collections.Generic;
+
+namespace DexterDepend.Tests
+{
+ [TestClass()]
+ public class VconfSetTests
+ {
+ VconfMethod vconfMethod;
+ List subMethodList;
+
+ public void Init()
+ {
+ vconfMethod = new VconfMethod();
+ subMethodList = new List();
+ subMethodList.AddRange(new string[] { "Vconf.SetString", "Vconf.SetInt" });
+ }
+ [TestMethod]
+ public void HasVConfMethodTest_VconfSet_ReturnsTrue()
+ {
+ // Given
+ Init();
+ string methodName = "Vconf.SetString(\"db/cloud_voice_assistant/location/latitude\", latitude);";
+
+ // When
+ bool result = vconfMethod.HasVconfMethod(subMethodList, methodName);
+
+ // Then
+ Assert.IsTrue(result);
+ }
+
+ [TestMethod]
+ public void HasVConfMethodTest_OtherMethod_ReturnsFalse()
+ {
+ // Given
+ Init();
+ string methodName = "Vconf.SetTest(\"db/cloud_voice/location\", \"suwon\");";
+
+ // When
+ bool result = vconfMethod.HasVconfMethod(subMethodList, methodName);
+
+ // Then
+ Assert.IsFalse(result);
+ }
+
+ [TestMethod]
+ public void HasVConfMethodTest_VconfSetInt_ReturnsTrue()
+ {
+ // Given
+ Init();
+ string methodName = "Vconf.SetInt(\"db/cloud_voice\", \"test\");";
+
+ // When
+ bool result = vconfMethod.HasVconfMethod(subMethodList, methodName);
+
+ // Then
+ Assert.IsTrue(result);
+ }
+ }
+}
diff --git a/project/dexter-cs/DexterCSTest/Src/DexterCRCPluginTests.cs b/project/dexter-cs/DexterCSTest/Src/DexterCRCPluginTests.cs
new file mode 100644
index 00000000..aaf06260
--- /dev/null
+++ b/project/dexter-cs/DexterCSTest/Src/DexterCRCPluginTests.cs
@@ -0,0 +1,53 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using System;
+using System.IO;
+using System.Text;
+
+namespace DexterCRC.Tests
+{
+ [TestClass()]
+ public class DexterCRCPluginTests
+ {
+ DexterCRCPlugin dexterCrcPlugin;
+ static string currentSolutionPath = Directory.GetParent(Environment.CurrentDirectory).Parent.FullName;
+ readonly string checkerConfig = File.ReadAllText(currentSolutionPath + "/resource/dexter_cfg.json", Encoding.UTF8);
+
+ [TestMethod]
+ public void DexterCRCPluginTest_InitiatesDexterCRCPlugin()
+ {
+ // Given
+ dexterCrcPlugin = new DexterCRCPlugin();
+ // When
+
+ // Then
+ Assert.IsNotNull(dexterCrcPlugin);
+ }
+ }
+}
\ No newline at end of file
diff --git a/project/dexter-cs/DexterCSTest/Src/DexterCSTestUtil.cs b/project/dexter-cs/DexterCSTest/Src/DexterCSTestUtil.cs
new file mode 100644
index 00000000..097afb7c
--- /dev/null
+++ b/project/dexter-cs/DexterCSTest/Src/DexterCSTestUtil.cs
@@ -0,0 +1,67 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using System;
+using System.IO;
+using System.Linq;
+
+namespace DexterCSTest.Src
+{
+ public static class DexterCSTestUtil
+ {
+ private static Random random = new Random();
+
+ public static string RandomString(int length = 10)
+ {
+ const string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
+ return new string(Enumerable.Repeat(chars, length)
+ .Select(s => s[random.Next(s.Length)]).ToArray());
+ }
+
+ public static string TestingDirectory
+ {
+ get
+ {
+ return Path.GetFullPath(@"..\..\TestingDirectory");
+ }
+ }
+
+ public static void ClearTestingDirectory()
+ {
+ DirectoryInfo di = new DirectoryInfo(TestingDirectory);
+
+ foreach (FileInfo file in di.GetFiles())
+ {
+ file.Delete();
+ }
+ foreach (DirectoryInfo dir in di.GetDirectories())
+ {
+ dir.Delete(true);
+ }
+ }
+ }
+}
diff --git a/project/dexter-cs/DexterCSTest/Src/DexterConfigFileTests.cs b/project/dexter-cs/DexterCSTest/Src/DexterConfigFileTests.cs
new file mode 100644
index 00000000..95e147d8
--- /dev/null
+++ b/project/dexter-cs/DexterCSTest/Src/DexterConfigFileTests.cs
@@ -0,0 +1,96 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Newtonsoft.Json.Linq;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Text;
+
+namespace DexterCS.Tests
+{
+ [TestClass()]
+ public class DexterConfigFileTests
+ {
+ DexterConfigFile dexterConfigFile;
+ static string currentSolutionPath = Directory.GetParent(Environment.CurrentDirectory).Parent.FullName;
+ readonly string dexterConfig = File.ReadAllText(currentSolutionPath + "/resource/dexter_cfg.json", Encoding.UTF8);
+ readonly string dexterSnapshotConfig = File.ReadAllText(currentSolutionPath + "/resource/dexter_cfg-snapshot.json", Encoding.UTF8);
+
+ public void DexterConfigFileInit()
+ {
+ dexterConfigFile = new DexterConfigFile();
+ }
+
+ [TestMethod]
+ public void DexterConfigFileTest_InitiatesDexterConfigFile()
+ {
+ // Given
+ dexterConfigFile = new DexterConfigFile();
+ // When
+
+ // Then
+ Assert.IsNotNull(dexterConfigFile);
+ }
+
+ [TestMethod]
+ public void GetListFromDictionaryTest_TwoElementDictionary_ShouldReturnCorrectList()
+ {
+ DexterConfigFileInit();
+
+ // Given
+ JObject configMetadata = JObject.Parse(dexterConfig);
+ List expected = new List();
+ expected.Add(":/TEST//TestSI/TestDir4");
+ expected.Add(":/TEST//TestSI/TestDir5");
+
+ // When
+ List result = dexterConfigFile.GetListFromDictionary(configMetadata["sourceDir"]);
+
+ // Then
+ Assert.AreEqual(expected[0], result[0]);
+ Assert.AreEqual(expected[1], result[1]);
+ }
+
+ [TestMethod]
+ public void GetSnapshotIdFromConfigFileTest_SnapshotIDProvided_ReturnCorrectSnaphshotId()
+ {
+ DexterConfigFileInit();
+ // Given
+ JObject configMetadata = JObject.Parse(dexterSnapshotConfig);
+ long expected = 155556;
+
+ // When
+ long result = Convert.ToInt64((string)configMetadata["snapshotId"]);
+
+ // Then
+ Assert.AreEqual(expected, result);
+ }
+ }
+}
+
diff --git a/project/dexter-cs/DexterCSTest/Src/DexterDependPluginTests.cs b/project/dexter-cs/DexterCSTest/Src/DexterDependPluginTests.cs
new file mode 100644
index 00000000..818a5083
--- /dev/null
+++ b/project/dexter-cs/DexterCSTest/Src/DexterDependPluginTests.cs
@@ -0,0 +1,53 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using System;
+using System.IO;
+using System.Text;
+
+namespace DexterDepend.Tests
+{
+ [TestClass()]
+ public class DexterDependPluginTests
+ {
+ DexterDependPlugin dexterDependPlugin;
+ static string currentSolutionPath = Directory.GetParent(Environment.CurrentDirectory).Parent.FullName;
+ readonly string checkerConfig = File.ReadAllText(currentSolutionPath + "/resource/dexter_cfg.json", Encoding.UTF8);
+
+ [TestMethod]
+ public void DexterDependPluginTest_InitiatesDexterDependPlugin()
+ {
+ // Given
+ dexterDependPlugin = new DexterDependPlugin();
+ // When
+
+ // Then
+ Assert.IsNotNull(dexterDependPlugin);
+ }
+ }
+}
\ No newline at end of file
diff --git a/project/dexter-cs/DexterCSTest/Src/Util/DexterCRCUtilTests.cs b/project/dexter-cs/DexterCSTest/Src/Util/DexterCRCUtilTests.cs
new file mode 100644
index 00000000..3a835226
--- /dev/null
+++ b/project/dexter-cs/DexterCSTest/Src/Util/DexterCRCUtilTests.cs
@@ -0,0 +1,63 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+namespace DexterCRC.Tests
+{
+ [TestClass()]
+ public class DexterCRCUtilTests
+ {
+ [TestMethod()]
+ public void HasSuffixTest_StringWithSuffix_ReturnsTrue()
+ {
+ // Given
+ string name = "Namesuffix1";
+ string suffix = "suffix1";
+
+ // When
+ bool result = DexterCRCUtil.HasSuffix(name, suffix);
+
+ // Then
+ Assert.IsTrue(result);
+ }
+
+ [TestMethod()]
+ public void HasSuffixTest_StringWithoutSuffix_ReturnsTrue()
+ {
+ // Given
+ string name = "Name";
+ string suffix = "suffix1";
+
+ // When
+ bool result = DexterCRCUtil.HasSuffix(name, suffix);
+
+ // Then
+ Assert.IsFalse(result);
+ }
+ }
+}
\ No newline at end of file
diff --git a/project/dexter-cs/DexterCSTest/Src/Util/DexterUtilTests.cs b/project/dexter-cs/DexterCSTest/Src/Util/DexterUtilTests.cs
new file mode 100644
index 00000000..452f6dbf
--- /dev/null
+++ b/project/dexter-cs/DexterCSTest/Src/Util/DexterUtilTests.cs
@@ -0,0 +1,281 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using DexterCSTest.Src;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using System;
+using System.IO;
+using System.Linq;
+using System.Text.RegularExpressions;
+
+namespace DexterCS.Tests
+{
+ [TestClass()]
+ public class DexterUtilTests
+ {
+
+ [TestMethod()]
+ public void SplitTest_CamelCasingWord_ReturnsSplitWord()
+ {
+ // Given
+ string camelCasingWord = "camelCasingWord";
+
+ // When
+ string[] splitcamelCasingWord = DexterUtil.Split(camelCasingWord);
+
+ // Then
+ Assert.IsTrue(splitcamelCasingWord.SequenceEqual(new string[] { "camel", "Casing", "Word" }));
+ }
+
+ [TestMethod()]
+ public void SplitTest_PascalCasingWord_ReturnsSplitWord()
+ {
+ // Given
+ string pascalCasingWord = "PascalCasingWord";
+
+ // When
+ string[] splitPascalCasingWord = DexterUtil.Split(pascalCasingWord);
+
+ // Then
+ Assert.IsTrue(splitPascalCasingWord.SequenceEqual(new string[] { "Pascal", "Casing", "Word" }));
+ }
+
+ [TestMethod()]
+ public void SplitTest_SnakeCasingWord_ReturnsSplitWord()
+ {
+ // Given
+ string snakeCasingWord = "snake_casing_word";
+
+ // When
+ string[] splitSnakeCasingWord = DexterUtil.Split(snakeCasingWord);
+
+ // Then
+ foreach (string x in splitSnakeCasingWord)
+ {
+ Console.WriteLine("\"" + x + "\"");
+ }
+ Assert.IsTrue(splitSnakeCasingWord.SequenceEqual(new string[] { "snake", "casing", "word" }));
+ }
+
+ [TestMethod()]
+ public void SplitTest_CamelAndSnakeCasingWord_ReturnsSplitWord()
+ {
+ // Given
+ string camelAndSnakeCasingWord = "camelAndSnake_Casing_Word";
+
+ // When
+ string[] splitCamelAndSnakeCasingWord = DexterUtil.Split(camelAndSnakeCasingWord);
+
+ // Then
+ foreach (string x in splitCamelAndSnakeCasingWord)
+ {
+ Console.WriteLine("\"" + x + "\"");
+ }
+ Assert.IsTrue(splitCamelAndSnakeCasingWord.SequenceEqual(new string[] { "camel", "And", "Snake", "Casing", "Word" }));
+ }
+
+ [TestMethod()]
+ public void SplitTest_PascalAndSnakeCasingWord_ReturnsSplitWord()
+ {
+ // Given
+ string pascalAndSnakeCasingWord = "PascalAndSnake_Casing_Word";
+
+ // When
+ string[] splitPascalAndSnakeCasingWord = DexterUtil.Split(pascalAndSnakeCasingWord);
+
+ // Then
+ foreach (string x in splitPascalAndSnakeCasingWord)
+ {
+ Console.WriteLine("\"" + x + "\"");
+ }
+ Assert.IsTrue(splitPascalAndSnakeCasingWord.SequenceEqual(new string[] { "Pascal", "And", "Snake", "Casing", "Word" }));
+ }
+
+ [TestMethod()]
+ public void IsDirectoryTest_ExistingDirectory_ReturnsTrue()
+ {
+ try
+ {
+ // Given
+ string directoryPath = DexterCSTestUtil.TestingDirectory + @"\" + DexterCSTestUtil.RandomString();
+ Directory.CreateDirectory(directoryPath);
+ FileInfo fileInfo = new FileInfo(directoryPath);
+
+ // When
+ bool result = DexterUtil.IsDirectory(fileInfo);
+
+ // Then
+ Assert.IsTrue(result);
+ }
+ finally
+ {
+ DexterCSTestUtil.ClearTestingDirectory();
+ }
+ }
+
+ [TestMethod()]
+ public void IsDirectoryTest_ExistingFile_ReturnsFalse()
+ {
+ try
+ {
+ // Given
+ string filePath = DexterCSTestUtil.TestingDirectory + @"\" + DexterCSTestUtil.RandomString();
+ File.Create(filePath).Close();
+ FileInfo fileInfo = new FileInfo(filePath);
+
+ // When
+ bool result = DexterUtil.IsDirectory(fileInfo);
+
+ // Then
+ Assert.IsFalse(result);
+ }
+ finally
+ {
+ DexterCSTestUtil.ClearTestingDirectory();
+ }
+ }
+
+ [TestMethod()]
+ [ExpectedException(typeof(FileNotFoundException))]
+ public void IsDirectoryTest_NonExistantDirectory_ThrowsException()
+ {
+ // Given
+ string directoryPath = DexterCSTestUtil.TestingDirectory + @"\" + DexterCSTestUtil.RandomString();
+ FileInfo fileInfo = new FileInfo(directoryPath);
+
+ // When
+ bool result = DexterUtil.IsDirectory(fileInfo);
+
+ // Then
+ // FileNotFoundException is thrown
+ }
+
+ [TestMethod()]
+ public void GetSourcecodeFromFileTest_SimpleFileContent_ReturnsFileContent()
+ {
+ try
+ {
+ // Given
+ string filePath = DexterCSTestUtil.TestingDirectory + @"\" + DexterCSTestUtil.RandomString();
+ string fileContent = DexterCSTestUtil.RandomString();
+ StreamWriter streamWriter = File.CreateText(filePath);
+ streamWriter.Write(fileContent);
+ streamWriter.Close();
+ FileInfo fileInfo = new FileInfo(filePath);
+
+ // When
+ string result = DexterUtil.GetSourcecodeFromFile(filePath);
+
+ // Then
+ Assert.AreEqual(fileContent, result);
+ }
+ finally
+ {
+ DexterCSTestUtil.ClearTestingDirectory();
+ }
+ }
+
+ [TestMethod()]
+ public void GetSourcecodeFromFileTest_ComplexAndBigFileContent_ReturnsFileContent()
+ {
+ try
+ {
+ // Given
+ string filePath = DexterCSTestUtil.TestingDirectory + @"\" + DexterCSTestUtil.RandomString();
+ string fileContent = DexterCSTestUtil.RandomString(10000);
+ StreamWriter streamWriter = File.CreateText(filePath);
+ streamWriter.Write(fileContent);
+ streamWriter.Close();
+ FileInfo fileInfo = new FileInfo(filePath);
+
+ // When
+ string result = DexterUtil.GetSourcecodeFromFile(filePath);
+
+ // Then
+ Assert.AreEqual(fileContent, result);
+ }
+ finally
+ {
+ DexterCSTestUtil.ClearTestingDirectory();
+ }
+ }
+
+ [TestMethod()]
+ public void GetCurrentMethodNameTest_ReturnsCorrectMethodName()
+ {
+ // Given
+
+ // When
+ string methodName = DexterUtil.GetCurrentMethodName();
+
+ // Then
+ Assert.AreEqual("GetCurrentMethodNameTest_ReturnsCorrectMethodName", methodName);
+ }
+
+ [TestMethod()]
+ public void GetBase64CharSequenceTest_SimpleString_ReturnsStringOfLengthDivisableByFour()
+ {
+ // Given
+ string simpleString = "Simple String Content";
+
+ // When
+ string base64String = DexterUtil.GetBase64CharSequence(simpleString);
+
+ // Then
+ base64String = base64String.Trim();
+ Assert.IsTrue((base64String.Length % 4 == 0));
+ }
+
+ [TestMethod()]
+ public void GetBase64CharSequenceTest_SimpleString_ReturnsStringContainingOnlyBase64Characters()
+ {
+ // Given
+ string simpleString = "Simple String Content";
+
+ // When
+ string base64String = DexterUtil.GetBase64CharSequence(simpleString);
+
+ // Then
+ base64String = base64String.Trim();
+ Assert.IsTrue(Regex.IsMatch(base64String, @"^[a-zA-Z0-9\+/]*={0,3}$", RegexOptions.None));
+ }
+
+ [TestMethod]
+ public void RefinePathTest_RefinesFilePath()
+ {
+ // Given
+ string tempPath = @":/DEV//temp\DexterCS-cli_#.#.#_64";
+ string expectedPath = @":/DEV/temp/DexterCS-cli_#.#.#_64";
+
+ // When
+ string result = DexterUtil.RefinePath(tempPath);
+
+ // Then
+ Assert.AreEqual(expectedPath, result);
+ }
+ }
+}
\ No newline at end of file
diff --git a/project/dexter-cs/DexterCSTest/app.config b/project/dexter-cs/DexterCSTest/app.config
new file mode 100644
index 00000000..bc88aaaa
--- /dev/null
+++ b/project/dexter-cs/DexterCSTest/app.config
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/project/dexter-cs/DexterCSTest/packages.config b/project/dexter-cs/DexterCSTest/packages.config
new file mode 100644
index 00000000..85e5b208
--- /dev/null
+++ b/project/dexter-cs/DexterCSTest/packages.config
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/project/dexter-cs/DexterDepend/DexterDepend.csproj b/project/dexter-cs/DexterDepend/DexterDepend.csproj
new file mode 100644
index 00000000..6760cee2
--- /dev/null
+++ b/project/dexter-cs/DexterDepend/DexterDepend.csproj
@@ -0,0 +1,132 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {83B7B942-BE00-4CC8-98E8-4A19C50F38CD}
+ Library
+ Properties
+ DexterDepend
+ DexterDepend
+ v4.7.1
+ 512
+
+
+
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+ ..\packages\log4net.2.0.8\lib\net45-full\log4net.dll
+
+
+ ..\packages\Microsoft.CodeAnalysis.Common.1.1.0\lib\net45\Microsoft.CodeAnalysis.dll
+
+
+ ..\packages\Microsoft.CodeAnalysis.CSharp.1.1.0\lib\net45\Microsoft.CodeAnalysis.CSharp.dll
+
+
+ ..\packages\Microsoft.CodeAnalysis.CSharp.Workspaces.1.1.0\lib\net45\Microsoft.CodeAnalysis.CSharp.Workspaces.dll
+
+
+ ..\packages\Microsoft.CodeAnalysis.VisualBasic.1.1.0\lib\net45\Microsoft.CodeAnalysis.VisualBasic.dll
+
+
+ ..\packages\Microsoft.CodeAnalysis.VisualBasic.Workspaces.1.1.0\lib\net45\Microsoft.CodeAnalysis.VisualBasic.Workspaces.dll
+
+
+ ..\packages\Microsoft.CodeAnalysis.Workspaces.Common.1.1.0\lib\net45\Microsoft.CodeAnalysis.Workspaces.dll
+
+
+ ..\packages\Microsoft.CodeAnalysis.Workspaces.Common.1.1.0\lib\net45\Microsoft.CodeAnalysis.Workspaces.Desktop.dll
+
+
+ ..\packages\Newtonsoft.Json.4.5.11\lib\net40\Newtonsoft.Json.dll
+
+
+
+ ..\packages\System.Collections.Immutable.1.1.37\lib\dotnet\System.Collections.Immutable.dll
+
+
+ ..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.AttributedModel.dll
+
+
+ ..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.Convention.dll
+
+
+ ..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.Hosting.dll
+
+
+ ..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.Runtime.dll
+
+
+ ..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.TypedParts.dll
+
+
+
+ ..\packages\System.Linq.4.3.0\lib\net463\System.Linq.dll
+ True
+
+
+ ..\packages\System.Reflection.Metadata.1.2.0\lib\portable-net45+win8\System.Reflection.Metadata.dll
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {0fefcf8d-0a75-40f1-beec-21be6e483c48}
+ DexterCS
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 이 프로젝트는 이 컴퓨터에 없는 NuGet 패키지를 참조합니다. 해당 패키지를 다운로드하려면 NuGet 패키지 복원을 사용하십시오. 자세한 내용은 http://go.microsoft.com/fwlink/?LinkID=322105를 참조하십시오. 누락된 파일은 {0}입니다.
+
+
+
\ No newline at end of file
diff --git a/project/dexter-cs/DexterDepend/Properties/AssemblyInfo.cs b/project/dexter-cs/DexterDepend/Properties/AssemblyInfo.cs
new file mode 100644
index 00000000..a6b9508f
--- /dev/null
+++ b/project/dexter-cs/DexterDepend/Properties/AssemblyInfo.cs
@@ -0,0 +1,45 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using System.Reflection;
+using System.Runtime.InteropServices;
+
+[assembly: AssemblyTitle("DexterDepend")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("DexterDepend")]
+[assembly: AssemblyCopyright("")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+[assembly: ComVisible(false)]
+
+[assembly: Guid("83b7b942-be00-4cc8-98e8-4a19c50f38cd")]
+
+[assembly: AssemblyVersion("0.0.1.0")]
+[assembly: AssemblyFileVersion("0.0.1.0")]
diff --git a/project/dexter-cs/DexterDepend/Resource/checker-config.json b/project/dexter-cs/DexterDepend/Resource/checker-config.json
new file mode 100644
index 00000000..7f98a7d5
--- /dev/null
+++ b/project/dexter-cs/DexterDepend/Resource/checker-config.json
@@ -0,0 +1,54 @@
+{
+ "checkerList": [
+ {
+ "code": "VconfGet",
+ "name": " GET",
+ "type": "BOTH",
+ "categoryName": "CsharpDepend",
+ "severityCode": "CRI",
+ "version": "0.1.0",
+ "description": " to check",
+ "isActive": true,
+ "properties": { "value": "Vconf.GetString,Vconf.GetInt,Vconf.GetDouble,Vconf.GetBool,VconfUtil.GetStringValue" },
+ "cwe": 0
+ },
+ {
+ "code": "VconfSet",
+ "name": " SET",
+ "type": "BOTH",
+ "categoryName": "CsharpDepend",
+ "severityCode": "CRI",
+ "version": "0.1.0",
+ "description": " to check",
+ "isActive": true,
+ "properties": { "value": "Vconf.SetString,Vconf.SetInt,Vconf.SetDouble,Vconf.SetBool" },
+ "cwe": 0
+ },
+ {
+ "code": "VconfETC",
+ "name": " ETC",
+ "type": "BOTH",
+ "categoryName": "CsharpDepend",
+ "severityCode": "CRI",
+ "version": "0.1.0",
+ "description": " to check",
+ "isActive": true,
+ "properties": { "value": "Vconf.NotifyKeyChanged" },
+ "cwe": 0
+ },
+ {
+ "code": "MessagePort",
+ "name": " Usage",
+ "type": "BOTH",
+ "categoryName": "CsharpDepend",
+ "severityCode": "CRI",
+ "version": "0.1.0",
+ "description": " to check",
+ "isActive": true,
+ "properties": { "value": "new MessagePort,new FSMessagePort" },
+ "cwe": 0
+ }
+ ],
+ "toolName": "dexter-cs-depend",
+ "language": "C_SHARP"
+}
\ No newline at end of file
diff --git a/project/dexter-cs/DexterDepend/Src/CheckerLogic/ICheckerLogic.cs b/project/dexter-cs/DexterDepend/Src/CheckerLogic/ICheckerLogic.cs
new file mode 100644
index 00000000..39925ea3
--- /dev/null
+++ b/project/dexter-cs/DexterDepend/Src/CheckerLogic/ICheckerLogic.cs
@@ -0,0 +1,42 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using DexterCS;
+using Microsoft.CodeAnalysis.CSharp;
+using System.Collections.Generic;
+
+namespace DexterDepend
+{
+ public interface ICheckerLogic
+ {
+ string CheckerName { get; set; }
+ string Description { get; set; }
+ bool HasVconfMethod(List list, object value);
+ PreOccurence MakeVConfList(AnalysisConfig config, Checker checker, CSharpSyntaxNode raw, List args);
+ }
+}
+
diff --git a/project/dexter-cs/DexterDepend/Src/CheckerLogic/MessageMethod.cs b/project/dexter-cs/DexterDepend/Src/CheckerLogic/MessageMethod.cs
new file mode 100644
index 00000000..86099219
--- /dev/null
+++ b/project/dexter-cs/DexterDepend/Src/CheckerLogic/MessageMethod.cs
@@ -0,0 +1,58 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using DexterCS;
+using Microsoft.CodeAnalysis.CSharp;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace DexterDepend
+{
+ public class MessageMethod : ICheckerLogic
+ {
+ public MessageMethod()
+ {
+ CheckerName = this.GetType().Name;
+ Description = "Use Message Port";
+ }
+ public string CheckerName { get; set; }
+ public string Description { get; set; }
+
+ public bool HasVconfMethod(List subMethodList, object value)
+ {
+ var statement = value.ToString();
+ return subMethodList.Any(statement.StartsWith);
+ }
+
+ public PreOccurence MakeVConfList(AnalysisConfig config, Checker checker, CSharpSyntaxNode raw, List args)
+ {
+ var lineSpan = raw.GetLocation().GetLineSpan();
+ PreOccurence preOcc = DexterDependUtil.MakePreOccurence(raw, lineSpan, args, checker, config, CheckerName, Description);
+ return preOcc;
+ }
+ }
+}
diff --git a/project/dexter-cs/DexterDepend/Src/CheckerLogic/VconfMethod.cs b/project/dexter-cs/DexterDepend/Src/CheckerLogic/VconfMethod.cs
new file mode 100644
index 00000000..eefb5cd6
--- /dev/null
+++ b/project/dexter-cs/DexterDepend/Src/CheckerLogic/VconfMethod.cs
@@ -0,0 +1,59 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using DexterCS;
+using Microsoft.CodeAnalysis;
+using Microsoft.CodeAnalysis.CSharp;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace DexterDepend
+{
+ public class VconfMethod : ICheckerLogic
+ {
+ public VconfMethod()
+ {
+ CheckerName = this.GetType().Name;
+ Description = "Use VConf Method";
+ }
+ public string CheckerName { get; set; }
+ public string Description { get; set; }
+
+ public bool HasVconfMethod(List subMethodList, object value)
+ {
+ var statement = value.ToString();
+ return subMethodList.Any(statement.StartsWith);
+ }
+
+ public PreOccurence MakeVConfList(AnalysisConfig config, Checker checker, CSharpSyntaxNode raw, List args)
+ {
+ var lineSpan = raw.GetLocation().GetLineSpan();
+ PreOccurence preOcc = DexterDependUtil.MakePreOccurence(raw, lineSpan, args, checker, config, CheckerName, Description);
+ return preOcc;
+ }
+ }
+}
diff --git a/project/dexter-cs/DexterDepend/Src/Depend/IDependLogic.cs b/project/dexter-cs/DexterDepend/Src/Depend/IDependLogic.cs
new file mode 100644
index 00000000..f752aeca
--- /dev/null
+++ b/project/dexter-cs/DexterDepend/Src/Depend/IDependLogic.cs
@@ -0,0 +1,37 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using DexterCS;
+using Microsoft.CodeAnalysis;
+
+namespace DexterDepend
+{
+ public interface IDependLogic
+ {
+ void Analyze(AnalysisConfig config, AnalysisResult result, Checker checker, SyntaxNode syntaxRoot);
+ }
+}
diff --git a/project/dexter-cs/DexterDepend/Src/Depend/MessagePort.cs b/project/dexter-cs/DexterDepend/Src/Depend/MessagePort.cs
new file mode 100644
index 00000000..8883286b
--- /dev/null
+++ b/project/dexter-cs/DexterDepend/Src/Depend/MessagePort.cs
@@ -0,0 +1,65 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using DexterCS;
+using Microsoft.CodeAnalysis;
+using Microsoft.CodeAnalysis.CSharp.Syntax;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace DexterDepend
+{
+ public class MessagePort : IDependLogic
+ {
+ MessageMethod messageMethod = new MessageMethod();
+ public MessagePort() { }
+ public void Analyze(AnalysisConfig config, AnalysisResult result, Checker checker, SyntaxNode syntaxRoot)
+ {
+ var statementRaws = syntaxRoot.DescendantNodes().OfType();
+ if (!statementRaws.Any())
+ {
+ return;
+ }
+
+ char delimiters = ',';
+ string[] subMethod = checker.Properties.Value.Split(delimiters);
+ List subMethodList = new List();
+ subMethodList.AddRange(subMethod);
+
+ foreach (var statementRaw in statementRaws)
+ {
+ string statement = statementRaw.ToString();
+ if (messageMethod.HasVconfMethod(subMethodList, statement))
+ {
+ List args = new List(2) { "", "" };
+ PreOccurence preOcc = messageMethod.MakeVConfList(config, checker, statementRaw, args);
+ result.AddDefectWithPreOccurence(preOcc);
+ }
+ }
+ }
+ }
+}
diff --git a/project/dexter-cs/DexterDepend/Src/Depend/VconfETC.cs b/project/dexter-cs/DexterDepend/Src/Depend/VconfETC.cs
new file mode 100644
index 00000000..37abde7a
--- /dev/null
+++ b/project/dexter-cs/DexterDepend/Src/Depend/VconfETC.cs
@@ -0,0 +1,76 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using DexterCS;
+using Microsoft.CodeAnalysis;
+using Microsoft.CodeAnalysis.CSharp.Syntax;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace DexterDepend
+{
+ public class VconfETC : IDependLogic
+ {
+ VconfMethod vconfMethod = new VconfMethod();
+ public VconfETC() { }
+ public void Analyze(AnalysisConfig config, AnalysisResult result, Checker checker, SyntaxNode syntaxRoot)
+ {
+ var statementRaws = syntaxRoot.DescendantNodes().OfType();
+ if (!statementRaws.Any())
+ {
+ return;
+ }
+
+ char delimiters = ',';
+ string[] subMethod = checker.Properties.Value.Split(delimiters);
+ List subMethodList = new List();
+ subMethodList.AddRange(subMethod);
+
+ foreach (var statementRaw in statementRaws)
+ {
+ string statement = statementRaw.ToString();
+ if (vconfMethod.HasVconfMethod(subMethodList, statement))
+ {
+ List args = statementRaw.ArgumentList.Arguments.Select(s => s.ToString().Replace("\"", "")).ToList();
+
+ List declaredVariables = syntaxRoot.DescendantNodes().OfType().Select(d => d.Declaration.Variables.ToString()).ToList();
+ var resultList = declaredVariables.Where(r => r.StartsWith(args[0]));
+ foreach (string s in resultList)
+ {
+ string[] declaredArr = s.Split('=');
+ if (declaredArr.Length == 2)
+ {
+ args[0] = declaredArr[1].Trim().Replace("\"", "");
+ }
+ }
+ PreOccurence preOcc = vconfMethod.MakeVConfList(config, checker, statementRaw, args);
+ result.AddDefectWithPreOccurence(preOcc);
+ }
+ }
+ }
+ }
+}
diff --git a/project/dexter-cs/DexterDepend/Src/Depend/VconfGet.cs b/project/dexter-cs/DexterDepend/Src/Depend/VconfGet.cs
new file mode 100644
index 00000000..c5e9ccae
--- /dev/null
+++ b/project/dexter-cs/DexterDepend/Src/Depend/VconfGet.cs
@@ -0,0 +1,77 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using DexterCS;
+using Microsoft.CodeAnalysis;
+using Microsoft.CodeAnalysis.CSharp.Syntax;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace DexterDepend
+{
+ public class VconfGet : IDependLogic
+ {
+ VconfMethod vconfMethod = new VconfMethod();
+ public VconfGet() { }
+ public void Analyze(AnalysisConfig config, AnalysisResult result, Checker checker, SyntaxNode syntaxRoot)
+ {
+ var statementRaws = syntaxRoot.DescendantNodes().OfType();
+ if (!statementRaws.Any())
+ {
+ return;
+ }
+
+ char delimiters = ',';
+ string[] subMethod = checker.Properties.Value.Split(delimiters);
+ List subMethodList = new List();
+ subMethodList.AddRange(subMethod);
+
+ foreach (var statementRaw in statementRaws)
+ {
+ string statement = statementRaw.ToString();
+ if (vconfMethod.HasVconfMethod(subMethodList, statement))
+ {
+ List args = statementRaw.ArgumentList.Arguments.Select(s => s.ToString().Replace("\"", "")).ToList();
+ args.Add(""); // Vconf get only 1 arg
+
+ List declaredVariables = syntaxRoot.DescendantNodes().OfType().Select(d => d.Declaration.Variables.ToString()).ToList();
+ var resultList = declaredVariables.Where(r => r.StartsWith(args[0]));
+ foreach (string s in resultList)
+ {
+ string[] declaredArr = s.Split('=');
+ if (declaredArr.Length == 2)
+ {
+ args[0] = declaredArr[1].Trim().Replace("\"", "");
+ }
+ }
+ PreOccurence preOcc = vconfMethod.MakeVConfList(config, checker, statementRaw, args);
+ result.AddDefectWithPreOccurence(preOcc);
+ }
+ }
+ }
+ }
+}
diff --git a/project/dexter-cs/DexterDepend/Src/Depend/VconfSet.cs b/project/dexter-cs/DexterDepend/Src/Depend/VconfSet.cs
new file mode 100644
index 00000000..c49711d3
--- /dev/null
+++ b/project/dexter-cs/DexterDepend/Src/Depend/VconfSet.cs
@@ -0,0 +1,76 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using DexterCS;
+using Microsoft.CodeAnalysis;
+using Microsoft.CodeAnalysis.CSharp.Syntax;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace DexterDepend
+{
+ public class VconfSet : IDependLogic
+ {
+ VconfMethod vconfMethod = new VconfMethod();
+ public VconfSet() { }
+ public void Analyze(AnalysisConfig config, AnalysisResult result, Checker checker, SyntaxNode syntaxRoot)
+ {
+ var statementRaws = syntaxRoot.DescendantNodes().OfType();
+ if (!statementRaws.Any())
+ {
+ return;
+ }
+
+ char delimiters = ',';
+ string[] subMethod = checker.Properties.Value.Split(delimiters);
+ List subMethodList = new List();
+ subMethodList.AddRange(subMethod);
+
+ foreach (var statementRaw in statementRaws)
+ {
+ string statement = statementRaw.ToString();
+ if (vconfMethod.HasVconfMethod(subMethodList, statement))
+ {
+ List args = statementRaw.ArgumentList.Arguments.Select(s => s.ToString().Replace("\"", "")).ToList();
+
+ List declaredVariables = syntaxRoot.DescendantNodes().OfType().Select(d => d.Declaration.Variables.ToString()).ToList();
+ var resultList = declaredVariables.Where(r => r.StartsWith(args[0]));
+ foreach (string s in resultList)
+ {
+ string[] declaredArr = s.Split('=');
+ if (declaredArr.Length == 2)
+ {
+ args[0] = declaredArr[1].Trim().Replace("\"", "");
+ }
+ }
+ PreOccurence preOcc = vconfMethod.MakeVConfList(config, checker, statementRaw, args);
+ result.AddDefectWithPreOccurence(preOcc);
+ }
+ }
+ }
+ }
+}
diff --git a/project/dexter-cs/DexterDepend/Src/DexterDependPlugin.cs b/project/dexter-cs/DexterDepend/Src/DexterDependPlugin.cs
new file mode 100644
index 00000000..5c235620
--- /dev/null
+++ b/project/dexter-cs/DexterDepend/Src/DexterDependPlugin.cs
@@ -0,0 +1,190 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using DexterCS;
+using log4net;
+using Microsoft.CodeAnalysis;
+using Microsoft.CodeAnalysis.CSharp;
+using Newtonsoft.Json;
+using System;
+using System.IO;
+using System.Reflection;
+using System.Text;
+
+namespace DexterDepend
+{
+ public class DexterDependPlugin : IDexterPlugin
+ {
+ private const string DEFAULT_CHECKER_CONFIG_PATH = ".Resource.checker-config.json";
+ private static ILog CliLog = LogManager.GetLogger(typeof(DexterDependPlugin));
+
+ static Assembly assem = Assembly.GetExecutingAssembly();
+ static AssemblyName assemName = assem.GetName();
+ static Version version = assemName.Version;
+ private static string pluginName = assemName.Name;
+
+ private BaseCheckerConfig baseCheckerConfig;
+ private ICheckerConfig checkerConfig = new CheckerConfig(pluginName, DexterConfig.LANGUAGE.C_SHARP);
+ public ICheckerConfig CheckerConfig
+ {
+ get
+ {
+ return checkerConfig;
+ }
+ set
+ {
+ checkerConfig = value;
+ }
+ }
+
+ public string PLUGIN_NAME
+ {
+ get
+ {
+ return pluginName;
+ }
+ }
+
+ public string PLUGIN_DESCRIPTION
+ {
+ get { return "Dexter CSharp App Dependency Plug-in"; }
+ }
+
+ public string PLUGIN_AUTHOR
+ {
+ get { return "Samsung Electronics"; }
+ }
+
+ public Version VERSION
+ {
+ get { return version; }
+ }
+
+ public string[] SupportingFileExtensions
+ {
+ get { return new String[] { "cs" }; }
+ }
+
+ private string GetFileContents(string fileName)
+ {
+ string fileContent;
+ var fileStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
+ using (var streamReader = new StreamReader(fileStream, Encoding.UTF8))
+ {
+ fileContent = streamReader.ReadToEnd();
+ }
+ return fileContent;
+ }
+
+ public AnalysisResult Analyze(AnalysisConfig config)
+ {
+ IAnalysisEntityFactory factory = new AnalysisEntityFactory();
+ AnalysisResult result = factory.CreateAnalysisResult(config);
+
+ var tree = CSharpSyntaxTree.ParseText(GetFileContents(config.SourceFileFullPath));
+ DexterDependUtil.ToolName = checkerConfig.ToolName;
+ SyntaxNode syntaxRoot = tree.GetRoot();
+
+ foreach (Checker checker in CheckerConfig.CheckerList)
+ {
+ if (!checker.IsActive)
+ {
+ continue;
+ }
+ IDependLogic logic = GetCheckerLogic(checker.Code);
+ logic.Analyze(config, result, checker, syntaxRoot);
+ }
+ return result;
+ }
+
+ private IDependLogic GetCheckerLogic(string code)
+ {
+ return (IDependLogic)Activator.CreateInstance(Type.GetType(PLUGIN_NAME + "." + code, true));
+ }
+
+ public void Dispose()
+ {
+ //TODO:
+ }
+
+ public void Init()
+ {
+ InitCheckerConfig();
+ MakeCheckerConfig();
+ }
+
+ private void MakeCheckerConfig()
+ {
+ CheckerConfig.ToolName = baseCheckerConfig.ToolName;
+ CheckerConfig.Language = baseCheckerConfig.Language;
+ foreach (Checker checker in baseCheckerConfig.CheckerList)
+ {
+ CheckerConfig.AddCheckerList(checker);
+ }
+ }
+
+ protected void InitCheckerConfig()
+ {
+ string dexterConfig;
+ try
+ {
+ var assembly = Assembly.GetExecutingAssembly();
+ var resourceName = pluginName + DEFAULT_CHECKER_CONFIG_PATH;
+ using (Stream stream = assembly.GetManifestResourceStream(resourceName))
+ using (StreamReader reader = new StreamReader(stream))
+ {
+ dexterConfig = reader.ReadToEnd();
+ }
+
+ baseCheckerConfig = JsonConvert.DeserializeObject(dexterConfig
+ , new JsonSerializerSettings
+ {
+ NullValueHandling = NullValueHandling.Ignore
+ });
+ }
+ catch (Exception e)
+ {
+ CliLog.Error("There is no plug-in in directory.");
+ CliLog.Error(e.StackTrace);
+ Environment.Exit(0);
+ }
+ }
+
+ public bool SupportLanguage(DexterConfig.LANGUAGE language)
+ {
+ if (language.Equals(DexterConfig.LANGUAGE.C_SHARP))
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/project/dexter-cs/DexterDepend/Src/Util/DexterDependUtil.cs b/project/dexter-cs/DexterDepend/Src/Util/DexterDependUtil.cs
new file mode 100644
index 00000000..051cfba2
--- /dev/null
+++ b/project/dexter-cs/DexterDepend/Src/Util/DexterDependUtil.cs
@@ -0,0 +1,96 @@
+#region Copyright notice
+/**
+ * Copyright (c) 2018 Samsung Electronics, Inc.,
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+using DexterCS;
+using Microsoft.CodeAnalysis;
+using Microsoft.CodeAnalysis.CSharp;
+using Microsoft.CodeAnalysis.CSharp.Syntax;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace DexterDepend
+{
+ public class DexterDependUtil
+ {
+ public static string ToolName { get; set; }
+
+ internal static string GetClassName(IEnumerable typeEnumerable)
+ {
+ string className = null;
+ try
+ {
+ className = typeEnumerable.First().Identifier.ToString();
+ }
+ catch (InvalidOperationException)
+ {
+ className = "";
+ }
+ return className;
+ }
+
+ private static string GetMethodName(IEnumerable methodEnumrable)
+ {
+ string methodName = null;
+ try
+ {
+ methodName = methodEnumrable.First().Identifier.ToString();
+ }
+ catch (InvalidOperationException)
+ {
+ methodName = "";
+ }
+ return methodName;
+ }
+ internal static PreOccurence MakePreOccurence(CSharpSyntaxNode raw, FileLinePositionSpan lineSpan,
+ List args, Checker checker, AnalysisConfig config, string baseCheckerName, string baseDescription)
+ {
+ PreOccurence preOcc = new PreOccurence();
+ preOcc.CheckerCode = checker.Code + baseCheckerName;
+ preOcc.FileName = config.FileName;
+ preOcc.ModulePath = config.ModulePath;
+ preOcc.ClassName = GetClassName(raw.AncestorsAndSelf().OfType());
+ preOcc.MethodName = GetMethodName(raw.AncestorsAndSelf().OfType());
+ preOcc.Language = config.GetLanguageEnum().ToString();
+ preOcc.SeverityCode = checker.SeverityCode;
+ preOcc.CategoryName = checker.CategoryName;
+ preOcc.Message = GetOccurenceMessage(baseDescription, checker.Name);
+ preOcc.ToolName = ToolName;
+ preOcc.StartLine = lineSpan.StartLinePosition.Line + 1;
+ preOcc.EndLine = lineSpan.EndLinePosition.Line + 1;
+ preOcc.CharStart = lineSpan.StartLinePosition.Character;
+ preOcc.CharEnd = lineSpan.EndLinePosition.Character;
+ preOcc.VariableName = (!string.IsNullOrEmpty(args[0])) ? args[0] : "";
+ preOcc.StringValue = (!string.IsNullOrEmpty(args[1])) ? args[1] : "";
+ return preOcc;
+ }
+ private static string GetOccurenceMessage(string baseName, string name)
+ {
+ return baseName + name;
+ }
+ }
+}
diff --git a/project/dexter-cs/DexterDepend/app.config b/project/dexter-cs/DexterDepend/app.config
new file mode 100644
index 00000000..e748098c
--- /dev/null
+++ b/project/dexter-cs/DexterDepend/app.config
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/project/dexter-cs/DexterDepend/packages.config b/project/dexter-cs/DexterDepend/packages.config
new file mode 100644
index 00000000..7889141b
--- /dev/null
+++ b/project/dexter-cs/DexterDepend/packages.config
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/project/dexter-cs/resource/DexterCS.exe.config b/project/dexter-cs/resource/DexterCS.exe.config
new file mode 100644
index 00000000..31b08b0e
--- /dev/null
+++ b/project/dexter-cs/resource/DexterCS.exe.config
@@ -0,0 +1,49 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/project/dexter-cs/resource/dexter_cfg.json b/project/dexter-cs/resource/dexter_cfg.json
new file mode 100644
index 00000000..7f8b45ec
--- /dev/null
+++ b/project/dexter-cs/resource/dexter_cfg.json
@@ -0,0 +1,14 @@
+{
+ "dexterHome":"D:/1.DEV_CSharp/dexter-cs-cli_0.1.0",
+ "dexterServerIp": "10.89.33.162",
+ "dexterServerPort": "1301",
+ "projectName":"dotnet",
+ "projectFullPath":"D:/Perforce/DEV-DexterCS-minjung.baek/TIZEN_3.0/MAIN2017/PROD2017_Prj/INT/DOTNET/Csapi",
+ "sourceDir":["D:/Perforce/DEV-DexterCS-minjung.baek/TIZEN_3.0/MAIN2017/PROD2017_Prj/INT/DOTNET/Csapi/csapi-application"],
+ "headerDir":["D:/Perforce/DEV-DexterCS-minjung.baek/TIZEN_3.0/MAIN2017/PROD2017_Prj/INT/DOTNET/Csapi/csapi-application"],
+ "sourceEncoding":"UTF-8",
+ "libDir":[],
+ "binDir":"",
+ "type":"SNAPSHOT",
+ "snapshotId": "1555"
+}
\ No newline at end of file
diff --git a/project/dexter-vs/Dexter/Common/Core/Config/Configuration.cs b/project/dexter-vs/Dexter/Common/Core/Config/Configuration.cs
index 51f807ef..859228c3 100644
--- a/project/dexter-vs/Dexter/Common/Core/Config/Configuration.cs
+++ b/project/dexter-vs/Dexter/Common/Core/Config/Configuration.cs
@@ -11,7 +11,7 @@ namespace Dexter.Common.Config
public sealed class Configuration
{
///
- /// Dexter Home path
+ /// Dexter/DexterCS Home path
///
public string dexterHome { get; set; }
@@ -98,6 +98,13 @@ public sealed class Configuration
[JsonIgnore]
public string DexterExecutorPath { get { return dexterHome + "\\bin\\dexter-executor.jar"; } }
+ ///
+ /// Default path to DexterCS executable: dexterHome + "\bin\DexterCS.exe"
+ ///
+ [JsonIgnore]
+ public string DexterCSPath { get { return dexterHome + "\\bin\\DexterCS.exe"; } }
+
+
///
/// Default path to dexter configuration file: "\dexter-config-vsplugin.json"
///
@@ -117,11 +124,17 @@ public bool IsDexterFound
}
///
- /// Whether Dexter home is enabled (Dexter home is available for only c/c++ analysis)
+ /// Whether Dexter/Dexter CS home is enabled (Dexter/DexterCS home is available for only C/C++/C# analysis)
///
[JsonIgnore]
public bool IsDexterHomeEnabled { get; set; }
+ ///
+ /// Whether analysis on save is enabled
+ ///
+ [JsonIgnore]
+ public bool IsAnalysisOnSaveEnabled { get; set; }
+
///
/// Creates new instance of Configuration with default values
///
@@ -154,6 +167,7 @@ public Configuration(ProjectInfo projectInfo, DexterInfo dexterInfo)
userPassword = dexterInfo.userPassword;
standalone = dexterInfo.standalone;
IsDexterHomeEnabled = dexterInfo.IsDexterHomeEnabled;
+ IsAnalysisOnSaveEnabled = dexterInfo.IsAnalysisOnSaveEnabled;
}
diff --git a/project/dexter-vs/Dexter/Common/Core/Config/DexterInfo.cs b/project/dexter-vs/Dexter/Common/Core/Config/DexterInfo.cs
index e6b543f9..61691c72 100644
--- a/project/dexter-vs/Dexter/Common/Core/Config/DexterInfo.cs
+++ b/project/dexter-vs/Dexter/Common/Core/Config/DexterInfo.cs
@@ -9,7 +9,7 @@ namespace Dexter.Common.Config
public class DexterInfo
{
///
- /// Dexter Home path
+ /// Dexter/DexterCS Home path
///
public string dexterHome { get; set; }
@@ -34,33 +34,44 @@ public class DexterInfo
public string userPassword { get; set; }
///
- /// Whether analysis result should be standalone or sent to a server
+ /// Indicates whether analysis result should be standalone or sent to a server
///
public bool standalone { get; set; }
///
- /// Whether Dexter home is enabled (Dexter home is available for only c/c++ analysis)
+ /// Indicates whether Dexter/DexterCS home is enabled (Dexter/DexterCS home is available for only C/C++/C# analysis)
///
public bool IsDexterHomeEnabled { get; set; }
///
- /// Default path to dexter executable: dexterHome + "\bin\dexter-executor.jar"
+ /// Indicates whether analysis on save is enabled
+ ///
+ public bool IsAnalysisOnSaveEnabled { get; set; }
+
+ ///
+ /// Default path to dexter-executor: dexterHome + "\bin\dexter-executor.jar"
///
[JsonIgnore]
public string DexterExecutorPath { get { return dexterHome + "\\bin\\dexter-executor.jar"; } }
///
- /// Checks if dexter-executor.jar is found under dexterExecutorPath
+ /// Default path to DexterCS: dexterHome + "\bin\DexterCS.exe"
+ ///
+ [JsonIgnore]
+ public string DexterCSPath { get { return dexterHome + "\\bin\\DexterCS.exe"; } }
+
+ ///
+ /// Checks if dexter-executor.jar is found under dexterExecutorPath or DexterCS.exe is found under DexterCSPath
///
[JsonIgnore]
public bool IsDexterFound
{
get
{
- return File.Exists(DexterExecutorPath);
+ return (File.Exists(DexterExecutorPath) || File.Exists(DexterCSPath));
}
}
-
+
///
/// Creates new DexterInfo instance with default values
///
@@ -73,6 +84,7 @@ public DexterInfo()
userPassword = "";
standalone = true;
IsDexterHomeEnabled = false;
+ IsAnalysisOnSaveEnabled = false;
}
///
@@ -103,7 +115,8 @@ public static DexterInfo fromConfiguration(Configuration configuration)
userName = configuration.userName,
userPassword = configuration.userPassword,
standalone = configuration.standalone,
- IsDexterHomeEnabled = configuration.IsDexterHomeEnabled
+ IsDexterHomeEnabled = configuration.IsDexterHomeEnabled,
+ IsAnalysisOnSaveEnabled = configuration.IsAnalysisOnSaveEnabled
};
}
}
diff --git a/project/dexter-vs/Dexter/Common/Core/Config/Providers/SettingsStoreDexterInfoProvider.cs b/project/dexter-vs/Dexter/Common/Core/Config/Providers/SettingsStoreDexterInfoProvider.cs
index 4b7afdfa..7a50be17 100644
--- a/project/dexter-vs/Dexter/Common/Core/Config/Providers/SettingsStoreDexterInfoProvider.cs
+++ b/project/dexter-vs/Dexter/Common/Core/Config/Providers/SettingsStoreDexterInfoProvider.cs
@@ -16,7 +16,7 @@ namespace Dexter.Common.Config.Providers
public class SettingsStoreDexterInfoProvider : IDexterInfoProvider
{
///
- /// Settigns store
+ /// Settings store
///
private WritableSettingsStore settingsStore;
@@ -53,6 +53,7 @@ public DexterInfo Load()
userPassword = settingsStore.GetString(DexterStoreName, "userPassword"),
standalone = settingsStore.GetBoolean(DexterStoreName, "standalone"),
IsDexterHomeEnabled = settingsStore.GetBoolean(DexterStoreName, "isDexterHomeEnabled"),
+ IsAnalysisOnSaveEnabled = settingsStore.GetBoolean(DexterStoreName, "IsAnalysisOnSaveEnabled"),
};
}
@@ -76,6 +77,7 @@ public void Save(DexterInfo dexterInfo)
settingsStore.SetString(DexterStoreName, "userPassword", dexterInfo.userPassword);
settingsStore.SetBoolean(DexterStoreName, "standalone", dexterInfo.standalone);
settingsStore.SetBoolean(DexterStoreName, "isDexterHomeEnabled", dexterInfo.IsDexterHomeEnabled);
+ settingsStore.SetBoolean(DexterStoreName, "IsAnalysisOnSaveEnabled", dexterInfo.IsAnalysisOnSaveEnabled);
}
}
}
diff --git a/project/dexter-vs/Dexter/Common/Core/Dexter.Common.Core.csproj b/project/dexter-vs/Dexter/Common/Core/Dexter.Common.Core.csproj
index f6bb005e..13753a72 100644
--- a/project/dexter-vs/Dexter/Common/Core/Dexter.Common.Core.csproj
+++ b/project/dexter-vs/Dexter/Common/Core/Dexter.Common.Core.csproj
@@ -100,6 +100,7 @@
+
diff --git a/project/dexter-vs/Dexter/Common/Core/Utils/LanguageDetector.cs b/project/dexter-vs/Dexter/Common/Core/Utils/LanguageDetector.cs
new file mode 100644
index 00000000..eb7c7c92
--- /dev/null
+++ b/project/dexter-vs/Dexter/Common/Core/Utils/LanguageDetector.cs
@@ -0,0 +1,19 @@
+using EnvDTE;
+using EnvDTE80;
+using Microsoft.VisualStudio.Shell;
+using System;
+
+namespace Dexter.Common.Utils
+{
+ public static class LanguageDetector
+ {
+ public static bool IsCodeModelLanguageCSharp()
+ {
+ DTE2 dte2 = (DTE2)ServiceProvider.GlobalProvider.GetService(typeof(DTE));
+
+ string projectLanguage = dte2.DTE.ActiveDocument.ProjectItem.ContainingProject.CodeModel.Language;
+
+ return projectLanguage == CodeModelLanguageConstants.vsCMLanguageCSharp;
+ }
+ }
+}
diff --git a/project/dexter-vs/Dexter/Core/Analysis/Dexter.cs b/project/dexter-vs/Dexter/Core/Analysis/Dexter.cs
index aef08cb9..9f18f06b 100644
--- a/project/dexter-vs/Dexter/Core/Analysis/Dexter.cs
+++ b/project/dexter-vs/Dexter/Core/Analysis/Dexter.cs
@@ -1,8 +1,8 @@
using Dexter.Common.Config;
+using Dexter.Common.Utils;
using Dexter.Defects;
using System;
using System.Diagnostics;
-
using System.IO;
using System.Xml;
using System.Xml.Serialization;
@@ -39,7 +39,7 @@ public class DexterLegacyAnalyzer
///
/// path to a dexter-executor.jar
/// Configuration
- public DexterLegacyAnalyzer(Configuration configuration)
+ public DexterLegacyAnalyzer(Configuration configuration)
{
this.configuration = configuration;
if (configuration == null)
@@ -67,7 +67,7 @@ public Result Analyse()
///
public void Cancel()
{
- if (dexterProcess!=null && !dexterProcess.HasExited)
+ if (dexterProcess != null && !dexterProcess.HasExited)
{
dexterProcess.Kill();
}
@@ -91,25 +91,55 @@ private void CreateDexterProcess(bool createUser = false)
string configFlag = File.Exists(Configuration.DefaultConfigurationPath) ? " -f " + Configuration.DefaultConfigurationPath : "";
string createUserFlag = createUser ? " -c " : "";
string createXmlResultFlag = " -x ";
- string credentialsParams = (configuration.standalone && !createUser)
- ? " -s "
+ string credentialsParams = (configuration.standalone && !createUser)
+ ? " -s "
: " -u " + configuration.userName + " -p " + configuration.userPassword + " -h " + configuration.dexterServerIp + " -o " + configuration.dexterServerPort;
-
+ string resultFileFormatFlag = " -F xml";
+
dexterProcess = new Process();
- dexterProcess.StartInfo = new ProcessStartInfo()
+
+ DexterInfo dexterInfo = DexterInfo.fromConfiguration(configuration);
+
+ if (LanguageDetector.IsCodeModelLanguageCSharp())
{
- FileName = "java.exe",
- Arguments = "-jar " + configuration.DexterExecutorPath + createUserFlag + createXmlResultFlag + configFlag + credentialsParams,
- WorkingDirectory = Path.GetDirectoryName(configuration.DexterExecutorPath),
- CreateNoWindow = true,
- UseShellExecute = false,
- RedirectStandardOutput = true,
- RedirectStandardError = true
- };
-
+ if (!File.Exists(configuration.DexterCSPath))
+ {
+ throw new DexterRuntimeException("DexterCS.exe not found in \"" + configuration.DexterCSPath + "\"");
+ }
+
+ dexterProcess.StartInfo = new ProcessStartInfo()
+ {
+ FileName = configuration.DexterCSPath,
+ Arguments = createUserFlag + createXmlResultFlag + configFlag + credentialsParams + resultFileFormatFlag,
+ WorkingDirectory = Path.GetDirectoryName(configuration.DexterCSPath),
+ CreateNoWindow = true,
+ UseShellExecute = false,
+ RedirectStandardOutput = true,
+ RedirectStandardError = true
+ };
+ }
+ else
+ {
+ if (!File.Exists(configuration.DexterExecutorPath))
+ {
+ throw new DexterRuntimeException("dexter-executor.jar not found in \"" + configuration.DexterExecutorPath + "\"");
+ }
+
+ dexterProcess.StartInfo = new ProcessStartInfo()
+ {
+ FileName = "java.exe",
+ Arguments = "-jar " + configuration.DexterExecutorPath + createUserFlag + createXmlResultFlag + configFlag + credentialsParams,
+ WorkingDirectory = Path.GetDirectoryName(configuration.DexterExecutorPath),
+ CreateNoWindow = true,
+ UseShellExecute = false,
+ RedirectStandardOutput = true,
+ RedirectStandardError = true
+ };
+ }
+
dexterProcess.OutputDataReceived += OutputDataReceived;
dexterProcess.ErrorDataReceived += ErrorDataReceived;
- dexterProcess.Disposed += (s,e) => dexterProcess = null;
+ dexterProcess.Disposed += (s, e) => dexterProcess = null;
}
///
@@ -144,8 +174,8 @@ private Result GetAnalysisResult()
using (XmlReader reader = XmlReader.Create(resultFile))
{
- XmlSerializer serializer = new XmlSerializer(typeof(Result));
- return (Result)serializer.Deserialize(reader);
+ XmlSerializer serializer = new XmlSerializer(typeof(Result));
+ return (Result)serializer.Deserialize(reader);
}
}
diff --git a/project/dexter-vs/Dexter/Core/Dexter.Core.csproj b/project/dexter-vs/Dexter/Core/Dexter.Core.csproj
index c6d4bea0..f0c42e2e 100644
--- a/project/dexter-vs/Dexter/Core/Dexter.Core.csproj
+++ b/project/dexter-vs/Dexter/Core/Dexter.Core.csproj
@@ -55,6 +55,8 @@
+
+
diff --git a/project/dexter-vs/Dexter/Core/Exception/DexterException.cs b/project/dexter-vs/Dexter/Core/Exception/DexterException.cs
new file mode 100644
index 00000000..0ff0eb73
--- /dev/null
+++ b/project/dexter-vs/Dexter/Core/Exception/DexterException.cs
@@ -0,0 +1,14 @@
+using System;
+
+public class DexterException : Exception
+{
+ public DexterException(String message) : base(message)
+ {
+
+ }
+
+ public DexterException(String message, Exception innerException) : base(message, innerException)
+ {
+
+ }
+}
diff --git a/project/dexter-vs/Dexter/Core/Exception/DexterRunTimeException.cs b/project/dexter-vs/Dexter/Core/Exception/DexterRunTimeException.cs
new file mode 100644
index 00000000..12e34f8c
--- /dev/null
+++ b/project/dexter-vs/Dexter/Core/Exception/DexterRunTimeException.cs
@@ -0,0 +1,15 @@
+using System;
+
+public class DexterRuntimeException : SystemException
+{
+ public DexterRuntimeException(String message) : base(message)
+ {
+
+ }
+
+ public DexterRuntimeException(String message, Exception innerException) : base(message, innerException)
+ {
+
+ }
+}
+
diff --git a/project/dexter-vs/Dexter/Core/UI/Analysis/DexterAnalysisCommand.cs b/project/dexter-vs/Dexter/Core/UI/Analysis/DexterAnalysisCommand.cs
index 19feb424..28a230fa 100644
--- a/project/dexter-vs/Dexter/Core/UI/Analysis/DexterAnalysisCommand.cs
+++ b/project/dexter-vs/Dexter/Core/UI/Analysis/DexterAnalysisCommand.cs
@@ -116,6 +116,11 @@ protected virtual void OnAnalysisFinished(EventArgs e)
/// Event sender.
/// Event args.
protected override void CommandClicked(object sender, EventArgs e)
+ {
+ ValidateConfigurationAndAnalyse();
+ }
+
+ public void ValidateConfigurationAndAnalyse()
{
Configuration config = ConfigurationProvider.Load();
diff --git a/project/dexter-vs/Dexter/Core/UI/DexterCommandPackage.cs b/project/dexter-vs/Dexter/Core/UI/DexterCommandPackage.cs
index a0b94468..c6c6fb27 100644
--- a/project/dexter-vs/Dexter/Core/UI/DexterCommandPackage.cs
+++ b/project/dexter-vs/Dexter/Core/UI/DexterCommandPackage.cs
@@ -93,7 +93,7 @@ protected override void Initialize()
IProjectInfoProvider solutionSnapshotInfoProvider = new SolutionInfoProvider(this, true);
IProjectInfoProvider projectSnapshotInfoProvider = new ProjectInfoProvider(this, true);
-
+
IDexterInfoProvider dexterInfoProvider = new SettingsStoreDexterInfoProvider(this);
ConfigurationProvider solutionConfigProvider = new ConfigurationProvider(solutionInfoProvider, dexterInfoProvider);
@@ -140,10 +140,74 @@ protected override void Initialize()
RegisterSolutionManager();
CreateReviewCommentManager();
-
+
+ uint cookie;
+ var runningDocumentTable = (IVsRunningDocumentTable)GetGlobalService(typeof(SVsRunningDocumentTable));
+ runningDocumentTable.AdviseRunningDocTableEvents(new RunningDocTableEventsHandler(projectAnalysisCommand, dexterInfoProvider), out cookie);
+
base.Initialize();
}
+ class RunningDocTableEventsHandler : IVsRunningDocTableEvents3
+ {
+ DexterAnalysisCommand dexterAnalysisCommand;
+ IDexterInfoProvider dexterInfoProvider;
+
+ #region Methods
+
+ public RunningDocTableEventsHandler(DexterAnalysisCommand dexterAnalysisCommand, IDexterInfoProvider dexterInfoProvider)
+ {
+ this.dexterAnalysisCommand = dexterAnalysisCommand;
+ this.dexterInfoProvider = dexterInfoProvider;
+ }
+
+ public int OnAfterFirstDocumentLock(uint docCookie, uint dwRDTLockType, uint dwReadLocksRemaining, uint dwEditLocksRemaining)
+ {
+ return VSConstants.S_OK;
+ }
+
+ public int OnBeforeLastDocumentUnlock(uint docCookie, uint dwRDTLockType, uint dwReadLocksRemaining, uint dwEditLocksRemaining)
+ {
+ return VSConstants.S_OK;
+ }
+
+ public int OnAfterSave(uint docCookie)
+ {
+ return VSConstants.S_OK;
+ }
+
+ public int OnAfterAttributeChange(uint docCookie, uint grfAttribs)
+ {
+ return VSConstants.S_OK;
+ }
+
+ public int OnBeforeDocumentWindowShow(uint docCookie, int fFirstShow, IVsWindowFrame pFrame)
+ {
+ return VSConstants.S_OK;
+ }
+
+ public int OnAfterDocumentWindowHide(uint docCookie, IVsWindowFrame pFrame)
+ {
+ return VSConstants.S_OK;
+ }
+
+ public int OnAfterAttributeChangeEx(uint docCookie, uint grfAttribs, IVsHierarchy pHierOld, uint itemidOld, string pszMkDocumentOld, IVsHierarchy pHierNew, uint itemidNew, string pszMkDocumentNew)
+ {
+ return VSConstants.S_OK;
+ }
+
+ public int OnBeforeSave(uint docCookie)
+ {
+ if (dexterInfoProvider.Load().IsAnalysisOnSaveEnabled)
+ {
+ dexterAnalysisCommand.ValidateConfigurationAndAnalyse();
+ }
+ return VSConstants.S_OK;
+ }
+
+ #endregion Methods
+ }
+
private void CreateReviewCommentManager()
{
PeerReviewCommentManager.Instance = new PeerReviewCommentManager(
@@ -211,7 +275,7 @@ private void onSettingsChanged(object sender, EventArgs args)
{
analysisCommand.Refresh();
}
- }
+ }
#endregion
}
diff --git a/project/dexter-vs/Dexter/Core/UI/Settings/SettingsControl.Designer.cs b/project/dexter-vs/Dexter/Core/UI/Settings/SettingsControl.Designer.cs
index 254a6416..5ae7fe4f 100644
--- a/project/dexter-vs/Dexter/Core/UI/Settings/SettingsControl.Designer.cs
+++ b/project/dexter-vs/Dexter/Core/UI/Settings/SettingsControl.Designer.cs
@@ -32,6 +32,7 @@ private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SettingsControl));
this.serverSettingsGroupBox = new System.Windows.Forms.GroupBox();
+ this.createUserButton = new System.Windows.Forms.Button();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.userNameLabel = new System.Windows.Forms.Label();
this.userPasswordLabel = new System.Windows.Forms.Label();
@@ -40,17 +41,17 @@ private void InitializeComponent()
this.standaloneCheckBox = new System.Windows.Forms.CheckBox();
this.serverLabel = new System.Windows.Forms.Label();
this.dexterSettingsGroupBox = new System.Windows.Forms.GroupBox();
+ this.analysisOnSaveCheckBox = new System.Windows.Forms.CheckBox();
this.enableDexterHomeCheckBox = new System.Windows.Forms.CheckBox();
this.dexterPathButton = new System.Windows.Forms.Button();
this.dexterPathLabel = new System.Windows.Forms.Label();
- this.createUserButton = new System.Windows.Forms.Button();
- this.dexterPathIndicator = new Dexter.UI.Settings.ValidationPicture();
this.dexterPathTextBox = new Dexter.UI.Settings.PlaceholderTextBox();
+ this.dexterPathIndicator = new Dexter.UI.Settings.ValidationPicture();
+ this.serverTextBox = new Dexter.UI.Settings.PlaceholderTextBox();
this.userNameTextBox = new Dexter.UI.Settings.PlaceholderTextBox();
this.userPasswordTextBox = new Dexter.UI.Settings.PlaceholderTextBox();
this.userIndicator = new Dexter.UI.Settings.ValidationPicture();
this.serverIndicator = new Dexter.UI.Settings.ValidationPicture();
- this.serverTextBox = new Dexter.UI.Settings.PlaceholderTextBox();
this.serverSettingsGroupBox.SuspendLayout();
this.tableLayoutPanel1.SuspendLayout();
this.dexterSettingsGroupBox.SuspendLayout();
@@ -63,22 +64,36 @@ private void InitializeComponent()
//
this.serverSettingsGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
- this.serverSettingsGroupBox.Controls.Add(this.createUserButton);
+ this.serverSettingsGroupBox.Controls.Add(this.serverLabel);
+ this.serverSettingsGroupBox.Controls.Add(this.serverTextBox);
this.serverSettingsGroupBox.Controls.Add(this.tableLayoutPanel1);
- this.serverSettingsGroupBox.Controls.Add(this.connectionStatusLabel);
this.serverSettingsGroupBox.Controls.Add(this.testConnectionButton);
+ this.serverSettingsGroupBox.Controls.Add(this.createUserButton);
+ this.serverSettingsGroupBox.Controls.Add(this.connectionStatusLabel);
this.serverSettingsGroupBox.Controls.Add(this.standaloneCheckBox);
this.serverSettingsGroupBox.Controls.Add(this.userIndicator);
this.serverSettingsGroupBox.Controls.Add(this.serverIndicator);
- this.serverSettingsGroupBox.Controls.Add(this.serverLabel);
- this.serverSettingsGroupBox.Controls.Add(this.serverTextBox);
- this.serverSettingsGroupBox.Location = new System.Drawing.Point(3, 101);
+ this.serverSettingsGroupBox.Location = new System.Drawing.Point(4, 138);
+ this.serverSettingsGroupBox.Margin = new System.Windows.Forms.Padding(4);
this.serverSettingsGroupBox.Name = "serverSettingsGroupBox";
- this.serverSettingsGroupBox.Size = new System.Drawing.Size(481, 169);
+ this.serverSettingsGroupBox.Padding = new System.Windows.Forms.Padding(4);
+ this.serverSettingsGroupBox.Size = new System.Drawing.Size(641, 208);
this.serverSettingsGroupBox.TabIndex = 1;
this.serverSettingsGroupBox.TabStop = false;
this.serverSettingsGroupBox.Text = "Server Settings";
//
+ // createUserButton
+ //
+ this.createUserButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
+ this.createUserButton.Location = new System.Drawing.Point(143, 140);
+ this.createUserButton.Margin = new System.Windows.Forms.Padding(4);
+ this.createUserButton.Name = "createUserButton";
+ this.createUserButton.Size = new System.Drawing.Size(124, 30);
+ this.createUserButton.TabIndex = 4;
+ this.createUserButton.Text = "Create user";
+ this.createUserButton.UseVisualStyleBackColor = true;
+ this.createUserButton.Click += new System.EventHandler(this.createUserButton_Click);
+ //
// tableLayoutPanel1
//
this.tableLayoutPanel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
@@ -90,48 +105,52 @@ private void InitializeComponent()
this.tableLayoutPanel1.Controls.Add(this.userPasswordTextBox, 1, 1);
this.tableLayoutPanel1.Controls.Add(this.userNameLabel, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.userPasswordLabel, 1, 0);
- this.tableLayoutPanel1.Location = new System.Drawing.Point(8, 69);
+ this.tableLayoutPanel1.Location = new System.Drawing.Point(11, 85);
this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(0);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 2;
- this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 12F));
- this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
- this.tableLayoutPanel1.Size = new System.Drawing.Size(436, 41);
- this.tableLayoutPanel1.TabIndex = 4;
+ this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 15F));
+ this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F));
+ this.tableLayoutPanel1.Size = new System.Drawing.Size(581, 50);
+ this.tableLayoutPanel1.TabIndex = 2;
//
// userNameLabel
//
this.userNameLabel.AutoSize = true;
- this.userNameLabel.Location = new System.Drawing.Point(3, 0);
+ this.userNameLabel.Location = new System.Drawing.Point(4, 0);
+ this.userNameLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.userNameLabel.Name = "userNameLabel";
- this.userNameLabel.Size = new System.Drawing.Size(58, 12);
- this.userNameLabel.TabIndex = 11;
+ this.userNameLabel.Size = new System.Drawing.Size(77, 15);
+ this.userNameLabel.TabIndex = 0;
this.userNameLabel.Text = "User name";
//
// userPasswordLabel
//
this.userPasswordLabel.AutoSize = true;
- this.userPasswordLabel.Location = new System.Drawing.Point(221, 0);
+ this.userPasswordLabel.Location = new System.Drawing.Point(294, 0);
+ this.userPasswordLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.userPasswordLabel.Name = "userPasswordLabel";
- this.userPasswordLabel.Size = new System.Drawing.Size(77, 12);
- this.userPasswordLabel.TabIndex = 13;
+ this.userPasswordLabel.Size = new System.Drawing.Size(102, 15);
+ this.userPasswordLabel.TabIndex = 2;
this.userPasswordLabel.Text = "User password";
//
// connectionStatusLabel
//
this.connectionStatusLabel.AutoSize = true;
- this.connectionStatusLabel.Location = new System.Drawing.Point(210, 120);
+ this.connectionStatusLabel.Location = new System.Drawing.Point(280, 148);
+ this.connectionStatusLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.connectionStatusLabel.Name = "connectionStatusLabel";
- this.connectionStatusLabel.Size = new System.Drawing.Size(0, 13);
- this.connectionStatusLabel.TabIndex = 17;
+ this.connectionStatusLabel.Size = new System.Drawing.Size(0, 17);
+ this.connectionStatusLabel.TabIndex = 5;
//
// testConnectionButton
//
this.testConnectionButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
- this.testConnectionButton.Location = new System.Drawing.Point(8, 114);
+ this.testConnectionButton.Location = new System.Drawing.Point(11, 140);
+ this.testConnectionButton.Margin = new System.Windows.Forms.Padding(4);
this.testConnectionButton.Name = "testConnectionButton";
- this.testConnectionButton.Size = new System.Drawing.Size(93, 24);
- this.testConnectionButton.TabIndex = 16;
+ this.testConnectionButton.Size = new System.Drawing.Size(124, 30);
+ this.testConnectionButton.TabIndex = 3;
this.testConnectionButton.Text = "Test connection";
this.testConnectionButton.UseVisualStyleBackColor = true;
this.testConnectionButton.Click += new System.EventHandler(this.testConnectionButton_Click);
@@ -139,10 +158,11 @@ private void InitializeComponent()
// standaloneCheckBox
//
this.standaloneCheckBox.AutoSize = true;
- this.standaloneCheckBox.Location = new System.Drawing.Point(8, 144);
+ this.standaloneCheckBox.Location = new System.Drawing.Point(11, 177);
+ this.standaloneCheckBox.Margin = new System.Windows.Forms.Padding(4);
this.standaloneCheckBox.Name = "standaloneCheckBox";
- this.standaloneCheckBox.Size = new System.Drawing.Size(120, 17);
- this.standaloneCheckBox.TabIndex = 15;
+ this.standaloneCheckBox.Size = new System.Drawing.Size(157, 21);
+ this.standaloneCheckBox.TabIndex = 6;
this.standaloneCheckBox.Text = "Standalone analysis";
this.standaloneCheckBox.UseVisualStyleBackColor = true;
this.standaloneCheckBox.CheckedChanged += new System.EventHandler(this.standaloneCheckBox_CheckedChanged);
@@ -150,10 +170,11 @@ private void InitializeComponent()
// serverLabel
//
this.serverLabel.AutoSize = true;
- this.serverLabel.Location = new System.Drawing.Point(5, 17);
+ this.serverLabel.Location = new System.Drawing.Point(7, 21);
+ this.serverLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.serverLabel.Name = "serverLabel";
- this.serverLabel.Size = new System.Drawing.Size(115, 13);
- this.serverLabel.TabIndex = 7;
+ this.serverLabel.Size = new System.Drawing.Size(154, 17);
+ this.serverLabel.TabIndex = 0;
this.serverLabel.Text = "Dexter Server address:";
//
// dexterSettingsGroupBox
@@ -161,25 +182,39 @@ private void InitializeComponent()
this.dexterSettingsGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.dexterSettingsGroupBox.Controls.Add(this.enableDexterHomeCheckBox);
- this.dexterSettingsGroupBox.Controls.Add(this.dexterPathIndicator);
- this.dexterSettingsGroupBox.Controls.Add(this.dexterPathButton);
this.dexterSettingsGroupBox.Controls.Add(this.dexterPathLabel);
this.dexterSettingsGroupBox.Controls.Add(this.dexterPathTextBox);
- this.dexterSettingsGroupBox.Location = new System.Drawing.Point(3, 0);
+ this.dexterSettingsGroupBox.Controls.Add(this.dexterPathButton);
+ this.dexterSettingsGroupBox.Controls.Add(this.analysisOnSaveCheckBox);
+ this.dexterSettingsGroupBox.Controls.Add(this.dexterPathIndicator);
+ this.dexterSettingsGroupBox.Location = new System.Drawing.Point(4, 0);
+ this.dexterSettingsGroupBox.Margin = new System.Windows.Forms.Padding(4);
this.dexterSettingsGroupBox.Name = "dexterSettingsGroupBox";
- this.dexterSettingsGroupBox.Size = new System.Drawing.Size(481, 94);
+ this.dexterSettingsGroupBox.Padding = new System.Windows.Forms.Padding(4);
+ this.dexterSettingsGroupBox.Size = new System.Drawing.Size(641, 130);
this.dexterSettingsGroupBox.TabIndex = 0;
this.dexterSettingsGroupBox.TabStop = false;
this.dexterSettingsGroupBox.Text = "Dexter Settings";
//
+ // analysisOnSaveCheckBox
+ //
+ this.analysisOnSaveCheckBox.AutoSize = true;
+ this.analysisOnSaveCheckBox.Location = new System.Drawing.Point(12, 99);
+ this.analysisOnSaveCheckBox.Name = "analysisOnSaveCheckBox";
+ this.analysisOnSaveCheckBox.Size = new System.Drawing.Size(136, 21);
+ this.analysisOnSaveCheckBox.TabIndex = 4;
+ this.analysisOnSaveCheckBox.Text = "Analysis on save";
+ this.analysisOnSaveCheckBox.UseVisualStyleBackColor = true;
+ //
// enableDexterHomeCheckBox
//
this.enableDexterHomeCheckBox.AutoSize = true;
- this.enableDexterHomeCheckBox.Location = new System.Drawing.Point(8, 22);
+ this.enableDexterHomeCheckBox.Location = new System.Drawing.Point(11, 27);
+ this.enableDexterHomeCheckBox.Margin = new System.Windows.Forms.Padding(4);
this.enableDexterHomeCheckBox.Name = "enableDexterHomeCheckBox";
- this.enableDexterHomeCheckBox.Size = new System.Drawing.Size(222, 17);
- this.enableDexterHomeCheckBox.TabIndex = 6;
- this.enableDexterHomeCheckBox.Text = "Enable dexter home (Only C/C++ project)";
+ this.enableDexterHomeCheckBox.Size = new System.Drawing.Size(221, 21);
+ this.enableDexterHomeCheckBox.TabIndex = 0;
+ this.enableDexterHomeCheckBox.Text = "Enable Dexter/DexterCS home";
this.enableDexterHomeCheckBox.UseVisualStyleBackColor = true;
this.enableDexterHomeCheckBox.CheckedChanged += new System.EventHandler(this.enableDexterHomeCheckBox_CheckedChanged);
//
@@ -188,10 +223,11 @@ private void InitializeComponent()
this.dexterPathButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.dexterPathButton.Enabled = false;
this.dexterPathButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
- this.dexterPathButton.Location = new System.Drawing.Point(411, 53);
+ this.dexterPathButton.Location = new System.Drawing.Point(548, 65);
+ this.dexterPathButton.Margin = new System.Windows.Forms.Padding(4);
this.dexterPathButton.Name = "dexterPathButton";
- this.dexterPathButton.Size = new System.Drawing.Size(34, 24);
- this.dexterPathButton.TabIndex = 4;
+ this.dexterPathButton.Size = new System.Drawing.Size(45, 30);
+ this.dexterPathButton.TabIndex = 3;
this.dexterPathButton.Text = "...";
this.dexterPathButton.UseVisualStyleBackColor = true;
this.dexterPathButton.Click += new System.EventHandler(this.dexterPathButton_Click);
@@ -199,30 +235,41 @@ private void InitializeComponent()
// dexterPathLabel
//
this.dexterPathLabel.AutoSize = true;
- this.dexterPathLabel.Location = new System.Drawing.Point(6, 41);
+ this.dexterPathLabel.Location = new System.Drawing.Point(8, 50);
+ this.dexterPathLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.dexterPathLabel.Name = "dexterPathLabel";
- this.dexterPathLabel.Size = new System.Drawing.Size(91, 13);
+ this.dexterPathLabel.Size = new System.Drawing.Size(183, 17);
this.dexterPathLabel.TabIndex = 1;
- this.dexterPathLabel.Text = "Dexter home path";
+ this.dexterPathLabel.Text = "Dexter/DexterCS home path";
//
- // createUserButton
+ // dexterPathTextBox
//
- this.createUserButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
- this.createUserButton.Location = new System.Drawing.Point(107, 114);
- this.createUserButton.Name = "createUserButton";
- this.createUserButton.Size = new System.Drawing.Size(93, 24);
- this.createUserButton.TabIndex = 18;
- this.createUserButton.Text = "Create user";
- this.createUserButton.UseVisualStyleBackColor = true;
- this.createUserButton.Click += new System.EventHandler(this.createUserButton_Click);
+ this.dexterPathTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.dexterPathTextBox.Enabled = false;
+ this.dexterPathTextBox.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
+ this.dexterPathTextBox.ForeColor = System.Drawing.SystemColors.InactiveCaption;
+ this.dexterPathTextBox.Location = new System.Drawing.Point(12, 69);
+ this.dexterPathTextBox.Margin = new System.Windows.Forms.Padding(4);
+ this.dexterPathTextBox.Name = "dexterPathTextBox";
+ this.dexterPathTextBox.PlaceholderColor = System.Drawing.SystemColors.InactiveCaption;
+ this.dexterPathTextBox.PlaceholderFont = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
+ this.dexterPathTextBox.PlaceholderText = "e.g. D:\\Dexter";
+ this.dexterPathTextBox.Size = new System.Drawing.Size(527, 23);
+ this.dexterPathTextBox.TabIndex = 2;
+ this.dexterPathTextBox.Text = "e.g. D:\\Dexter";
+ this.dexterPathTextBox.WordWrap = false;
+ this.dexterPathTextBox.TextChanged += new System.EventHandler(this.dexterPathTextBox_TextChanged);
+ this.dexterPathTextBox.Validating += new System.ComponentModel.CancelEventHandler(this.dexterPathTextBox_Validating);
//
// dexterPathIndicator
//
this.dexterPathIndicator.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.dexterPathIndicator.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
- this.dexterPathIndicator.Location = new System.Drawing.Point(451, 53);
+ this.dexterPathIndicator.Location = new System.Drawing.Point(601, 65);
+ this.dexterPathIndicator.Margin = new System.Windows.Forms.Padding(4);
this.dexterPathIndicator.Name = "dexterPathIndicator";
- this.dexterPathIndicator.Size = new System.Drawing.Size(24, 24);
+ this.dexterPathIndicator.Size = new System.Drawing.Size(32, 30);
this.dexterPathIndicator.TabIndex = 5;
this.dexterPathIndicator.TabStop = false;
this.dexterPathIndicator.Valid = false;
@@ -230,24 +277,23 @@ private void InitializeComponent()
this.dexterPathIndicator.Visible = false;
this.dexterPathIndicator.WrongImage = ((System.Drawing.Image)(resources.GetObject("dexterPathIndicator.WrongImage")));
//
- // dexterPathTextBox
+ // serverTextBox
//
- this.dexterPathTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ this.serverTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
- this.dexterPathTextBox.Enabled = false;
- this.dexterPathTextBox.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
- this.dexterPathTextBox.ForeColor = System.Drawing.SystemColors.InactiveCaption;
- this.dexterPathTextBox.Location = new System.Drawing.Point(9, 56);
- this.dexterPathTextBox.Name = "dexterPathTextBox";
- this.dexterPathTextBox.PlaceholderColor = System.Drawing.SystemColors.InactiveCaption;
- this.dexterPathTextBox.PlaceholderFont = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
- this.dexterPathTextBox.PlaceholderText = "e.g. D:\\Dexter";
- this.dexterPathTextBox.Size = new System.Drawing.Size(396, 20);
- this.dexterPathTextBox.TabIndex = 0;
- this.dexterPathTextBox.Text = "e.g. D:\\Dexter";
- this.dexterPathTextBox.WordWrap = false;
- this.dexterPathTextBox.TextChanged += new System.EventHandler(this.dexterPathTextBox_TextChanged);
- this.dexterPathTextBox.Validating += new System.ComponentModel.CancelEventHandler(this.dexterPathTextBox_Validating);
+ this.serverTextBox.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
+ this.serverTextBox.ForeColor = System.Drawing.SystemColors.InactiveCaption;
+ this.serverTextBox.Location = new System.Drawing.Point(11, 42);
+ this.serverTextBox.Margin = new System.Windows.Forms.Padding(4);
+ this.serverTextBox.Name = "serverTextBox";
+ this.serverTextBox.PlaceholderColor = System.Drawing.SystemColors.InactiveCaption;
+ this.serverTextBox.PlaceholderFont = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
+ this.serverTextBox.PlaceholderText = "e.g. http://127.0.0.2:8081";
+ this.serverTextBox.Size = new System.Drawing.Size(580, 23);
+ this.serverTextBox.TabIndex = 1;
+ this.serverTextBox.Text = "e.g. http://127.0.0.2:8081";
+ this.serverTextBox.WordWrap = false;
+ this.serverTextBox.TextChanged += new System.EventHandler(this.connectionTextBoxes_TextChanged);
//
// userNameTextBox
//
@@ -255,14 +301,14 @@ private void InitializeComponent()
| System.Windows.Forms.AnchorStyles.Right)));
this.userNameTextBox.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.userNameTextBox.ForeColor = System.Drawing.SystemColors.InactiveCaption;
- this.userNameTextBox.Location = new System.Drawing.Point(0, 15);
- this.userNameTextBox.Margin = new System.Windows.Forms.Padding(0, 3, 3, 0);
+ this.userNameTextBox.Location = new System.Drawing.Point(0, 19);
+ this.userNameTextBox.Margin = new System.Windows.Forms.Padding(0, 4, 4, 0);
this.userNameTextBox.Name = "userNameTextBox";
this.userNameTextBox.PlaceholderColor = System.Drawing.SystemColors.InactiveCaption;
this.userNameTextBox.PlaceholderFont = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.userNameTextBox.PlaceholderText = "e.g. JohnDoe";
- this.userNameTextBox.Size = new System.Drawing.Size(215, 20);
- this.userNameTextBox.TabIndex = 10;
+ this.userNameTextBox.Size = new System.Drawing.Size(286, 23);
+ this.userNameTextBox.TabIndex = 1;
this.userNameTextBox.Text = "e.g. JohnDoe";
this.userNameTextBox.WordWrap = false;
this.userNameTextBox.TextChanged += new System.EventHandler(this.connectionTextBoxes_TextChanged);
@@ -273,15 +319,15 @@ private void InitializeComponent()
| System.Windows.Forms.AnchorStyles.Right)));
this.userPasswordTextBox.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.userPasswordTextBox.ForeColor = System.Drawing.SystemColors.InactiveCaption;
- this.userPasswordTextBox.Location = new System.Drawing.Point(221, 15);
- this.userPasswordTextBox.Margin = new System.Windows.Forms.Padding(3, 3, 0, 0);
+ this.userPasswordTextBox.Location = new System.Drawing.Point(294, 19);
+ this.userPasswordTextBox.Margin = new System.Windows.Forms.Padding(4, 4, 0, 0);
this.userPasswordTextBox.Name = "userPasswordTextBox";
this.userPasswordTextBox.PasswordChar = '•';
this.userPasswordTextBox.PlaceholderColor = System.Drawing.SystemColors.InactiveCaption;
this.userPasswordTextBox.PlaceholderFont = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.userPasswordTextBox.PlaceholderText = "e.g. myPassword";
- this.userPasswordTextBox.Size = new System.Drawing.Size(215, 20);
- this.userPasswordTextBox.TabIndex = 12;
+ this.userPasswordTextBox.Size = new System.Drawing.Size(287, 23);
+ this.userPasswordTextBox.TabIndex = 3;
this.userPasswordTextBox.Text = "e.g. myPassword";
this.userPasswordTextBox.WordWrap = false;
this.userPasswordTextBox.TextChanged += new System.EventHandler(this.connectionTextBoxes_TextChanged);
@@ -290,9 +336,10 @@ private void InitializeComponent()
//
this.userIndicator.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.userIndicator.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
- this.userIndicator.Location = new System.Drawing.Point(450, 88);
+ this.userIndicator.Location = new System.Drawing.Point(600, 108);
+ this.userIndicator.Margin = new System.Windows.Forms.Padding(4);
this.userIndicator.Name = "userIndicator";
- this.userIndicator.Size = new System.Drawing.Size(24, 18);
+ this.userIndicator.Size = new System.Drawing.Size(32, 22);
this.userIndicator.TabIndex = 14;
this.userIndicator.TabStop = false;
this.userIndicator.Valid = false;
@@ -303,41 +350,26 @@ private void InitializeComponent()
//
this.serverIndicator.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.serverIndicator.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
- this.serverIndicator.Location = new System.Drawing.Point(450, 29);
+ this.serverIndicator.Location = new System.Drawing.Point(600, 36);
+ this.serverIndicator.Margin = new System.Windows.Forms.Padding(4);
this.serverIndicator.Name = "serverIndicator";
- this.serverIndicator.Size = new System.Drawing.Size(24, 24);
+ this.serverIndicator.Size = new System.Drawing.Size(32, 30);
this.serverIndicator.TabIndex = 9;
this.serverIndicator.TabStop = false;
this.serverIndicator.Valid = false;
this.serverIndicator.ValidImage = ((System.Drawing.Image)(resources.GetObject("serverIndicator.ValidImage")));
this.serverIndicator.WrongImage = ((System.Drawing.Image)(resources.GetObject("serverIndicator.WrongImage")));
//
- // serverTextBox
- //
- this.serverTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.serverTextBox.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
- this.serverTextBox.ForeColor = System.Drawing.SystemColors.InactiveCaption;
- this.serverTextBox.Location = new System.Drawing.Point(8, 34);
- this.serverTextBox.Name = "serverTextBox";
- this.serverTextBox.PlaceholderColor = System.Drawing.SystemColors.InactiveCaption;
- this.serverTextBox.PlaceholderFont = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
- this.serverTextBox.PlaceholderText = "e.g. http://127.0.0.2:8081";
- this.serverTextBox.Size = new System.Drawing.Size(436, 20);
- this.serverTextBox.TabIndex = 6;
- this.serverTextBox.Text = "e.g. http://127.0.0.2:8081";
- this.serverTextBox.WordWrap = false;
- this.serverTextBox.TextChanged += new System.EventHandler(this.connectionTextBoxes_TextChanged);
- //
// SettingsControl
//
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.AutoScroll = true;
this.Controls.Add(this.dexterSettingsGroupBox);
this.Controls.Add(this.serverSettingsGroupBox);
+ this.Margin = new System.Windows.Forms.Padding(4);
this.Name = "SettingsControl";
- this.Size = new System.Drawing.Size(487, 280);
+ this.Size = new System.Drawing.Size(649, 350);
this.serverSettingsGroupBox.ResumeLayout(false);
this.serverSettingsGroupBox.PerformLayout();
this.tableLayoutPanel1.ResumeLayout(false);
@@ -373,5 +405,6 @@ private void InitializeComponent()
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.CheckBox enableDexterHomeCheckBox;
private System.Windows.Forms.Button createUserButton;
+ private System.Windows.Forms.CheckBox analysisOnSaveCheckBox;
}
}
\ No newline at end of file
diff --git a/project/dexter-vs/Dexter/Core/UI/Settings/SettingsControl.cs b/project/dexter-vs/Dexter/Core/UI/Settings/SettingsControl.cs
index 8a15d274..b27cb85f 100644
--- a/project/dexter-vs/Dexter/Core/UI/Settings/SettingsControl.cs
+++ b/project/dexter-vs/Dexter/Core/UI/Settings/SettingsControl.cs
@@ -125,7 +125,8 @@ DexterInfo GetDexterInfoFromSettings()
userName = username,
userPassword = password,
standalone = standaloneCheckBox.Checked,
- IsDexterHomeEnabled = enableDexterHomeCheckBox.Checked
+ IsDexterHomeEnabled = enableDexterHomeCheckBox.Checked,
+ IsAnalysisOnSaveEnabled = analysisOnSaveCheckBox.Checked
};
}
@@ -194,6 +195,8 @@ DexterInfo IDexterInfoProvider.Load()
userNameTextBox.Text = dexterInfo.userName;
userPasswordTextBox.Text = dexterInfo.userPassword;
standaloneCheckBox.Checked = dexterInfo.standalone;
+ enableDexterHomeCheckBox.Checked = dexterInfo.IsDexterHomeEnabled;
+ analysisOnSaveCheckBox.Checked = dexterInfo.IsAnalysisOnSaveEnabled;
return dexterInfo;
}
diff --git a/wiki/images/Catch (Bug[] bugs).svg b/wiki/images/Catch (Bug[] bugs).svg
new file mode 100644
index 00000000..954b14ed
--- /dev/null
+++ b/wiki/images/Catch (Bug[] bugs).svg
@@ -0,0 +1,2 @@
+
+
\ No newline at end of file
diff --git a/wiki/images/DevelopedBySamsung.svg b/wiki/images/DevelopedBySamsung.svg
new file mode 100644
index 00000000..e2f1fd2c
--- /dev/null
+++ b/wiki/images/DevelopedBySamsung.svg
@@ -0,0 +1,2 @@
+
+
\ No newline at end of file
diff --git a/wiki/images/DexterDiagram.svg b/wiki/images/DexterDiagram.svg
new file mode 100644
index 00000000..88cc1471
--- /dev/null
+++ b/wiki/images/DexterDiagram.svg
@@ -0,0 +1,2 @@
+
+
\ No newline at end of file
diff --git a/wiki/images/DexterVsIDE.svg b/wiki/images/DexterVsIDE.svg
new file mode 100644
index 00000000..d26ebeda
--- /dev/null
+++ b/wiki/images/DexterVsIDE.svg
@@ -0,0 +1,2 @@
+
+
\ No newline at end of file
diff --git a/wiki/images/DexterYesOrNo.svg b/wiki/images/DexterYesOrNo.svg
new file mode 100644
index 00000000..85f0e251
--- /dev/null
+++ b/wiki/images/DexterYesOrNo.svg
@@ -0,0 +1,2 @@
+
+
\ No newline at end of file
diff --git a/wiki/images/logos/CLILogo.svg b/wiki/images/logos/CLILogo.svg
new file mode 100644
index 00000000..e91c2c57
--- /dev/null
+++ b/wiki/images/logos/CLILogo.svg
@@ -0,0 +1,9 @@
+
+
diff --git a/wiki/images/logos/EclipseLogo.svg b/wiki/images/logos/EclipseLogo.svg
new file mode 100644
index 00000000..f49c023f
--- /dev/null
+++ b/wiki/images/logos/EclipseLogo.svg
@@ -0,0 +1,176 @@
+
+
+
+
\ No newline at end of file
diff --git a/wiki/images/logos/MicrosoftVisualStudioLogo.svg b/wiki/images/logos/MicrosoftVisualStudioLogo.svg
new file mode 100644
index 00000000..5c5f5241
--- /dev/null
+++ b/wiki/images/logos/MicrosoftVisualStudioLogo.svg
@@ -0,0 +1,102 @@
+
+
\ No newline at end of file
diff --git a/wiki/images/logos/SourceInsightLogo.png b/wiki/images/logos/SourceInsightLogo.png
new file mode 100644
index 00000000..d3538f28
Binary files /dev/null and b/wiki/images/logos/SourceInsightLogo.png differ
diff --git a/wiki/image/overview.png b/wiki/images/overview (deprecated).png
similarity index 100%
rename from wiki/image/overview.png
rename to wiki/images/overview (deprecated).png