How to integrate with ICodeProcessor
The following page should explain how to integrate an ICodeProcessor and its main components, as an example, you can visit the following code processor: DummyCodeProcessor
How to integrate
First, you need to download and install the Mobilize.Common.Contracts nuget
This class is used in the license fingerprint
Next, you need to implement the ICodeProcessor interface defined in the Mobilize.Common.Contracts.CodeProcessor namespace:
Properties
Name
The tool name defined by the team.
RequiresLicense
Most code processors will need a license, there are some cases like scanners that don't need a license.
SupportedExtensions
The list of supported extensions by the code processor, as an example in a c# code processor should be { ".sln" }, or an oracle code processor should have {".ora", ".sql", ... }
ProgressDescriptor
An instance of the progress descriptor defined the Mobilize.Common.Utils nuget, for more information visit ProgressDescriptor, it is recommended to initialize the progress descriptor during the construction of the code processor, as an example:
You can change the progress descriptor to InProgress or another state following the example:
Logger
An instance of the Logger defined in the Mobilize.Common.Utils nuget, for more information visit Logger
The Logger instance is provided by the controller, so it's not needed to create a new instance of it
Functions
Cancel
This is currently not supported by the infrastructure
ValidateParameters
Method used to validate if the received execution parameters are valid to the code processor, the return value should be either true if everything is correct or false otherwise if the execution parameters are not valid, it should be specified in the errorMessage ref parameter since that message will be shown to the user, the paths are validated beforehand so it's not needed to validate it again, its only needed to validate the additional parameters received in the ExecutionParameters.
Execute
Method used to execute the code processor, this method will be called after ValidateParameters method, any assessment information should be registered through the ICodeModelWriter instance, for more information about the return value visit CodeProcessorExecutionResult.
GetCodeDescriptor
Method used to get CodeDescriptor using the inputFolder parameter.
Return values
CodeProcessorExecutionResult
This class is defined in the Mobilize.Common.Contracts nuget as the following:
ExecutionStatus
A class composed of the following properties:
FinalResult
An enum used to describe the code processor final state, it should be one of the following values:
ExceptionReport
Added if the code processor execution failed due to an exception.
CustomResultDetails
A key-value pair dictionary that the code processor should add values in case there is something extra to show to the user since it will be used later in the interface.
CodeDescriptor
This class is defined in the Mobilize.Common.Contracts nuget as the following:
Units
The number of units measured in the given ProjectDescriptors
UnitsType
To specify what are the units, for example, Lines of code, files
AllFileBytes
The sum of all bytes from the projects files
HasSomethingToProcess
Value to say whether the code processor can do something with the current input
ExtensionsCategory
A class used to group certain file extensions with a category, for example: ".sql" ".ora" as a "SQL" category
ProjectDescriptors
A list of projects that describes each project with its files
Last updated