Gloop code inspection and analysis
The service editor also features linting; it analyzes code for potential errors. When a service is opened or modified, Martini will validate the content and configuration of the service's steps to warn the user about probable runtime errors.
Depending on the severity of the problem detected, Martini will either label it as a warning or an error. A warning label indicates that the step will not cause a runtime error but is implementing unsafe logic or bad practice. An error label, on the other hand, indicates that the problem will cause a runtime error when the Gloop service is executed.
All problematic steps will be flagged via a warning or error icon near the line ruler. Hovering over an icon prompts a tooltip to pop-up, describing the issue(s) of the step.
Problems in child steps
If a step containing other steps, like the block step, contains a problematic child step, a grayed-out icon is displayed next to it (the parent step). Hovering over this grayed icon shows the summary of all problems encountered under that step1.
As an alternative, you can use the Problems view to view all the problems of your service. If the Problems view is not visible, go to the application menu Window > Show View > Problems View.
Quickly navigate to Gloop steps with validation issues
Use the shortcuts and to navigate to the next or previous step with a validation issue.
Quick fixes
Martini offers a quick fix for most problems. A quick fix is a short series of actions that can be executed in order to repair offending code. To apply a quick fix:
- Right click the offending line in the line ruler and then select Quick Fix from the context menu. Alternatively, you may press (Martini Desktop) or (Martini Online) instead. Either of these actions prompt the quick fix pop-up to appear.
- If the step has more than one problem, choose which problem to fix. You can use your arrow keys to shuffle through the choices and the key to finalize your selection.
- Choose which quick fix to apply; some problems have more than one solution or quick fix available.
- Enter required inputs, if any, as some quick fixes require certain inputs like entering a value or expression.
Once the quick fix has been applied, the warning or error icon should disappear.
Write your service with content-assist and quick fix
Martini's content-assist and quick fix feature works really well together and can be combined to write services faster.
List of detectable problems and quick fix suggestions
- Invalid map lines or set expressions
- Description: Maps or sets a property that does not exist.
- Severity: Error
- Available quick fixes:
- Re-assign map line or set expression
- Delete map line or set expression
- Invalid iterate or while step input or output array
- Description: Input or output array does not exist.
- Severity: Error
- Available quick fixes:
- Set input or output array
- Clear input or output array of the step
- Invalid declared property
- Description: A property is declared on a model that does not exist.
- Severity: Error
- Available quick fixes:
- Delete declared property
- Invalid unload property
- Description: A property that does not exist is unloaded.
- Severity: Error
- Available quick fixes:
- Delete unload
- Invalid unevaluated while step expression
- Description: Unevaluated while step expression must be an integer.
- Severity: Error
- Available quick fixes:
- Edit expression
- Empty while step expression
- Severity: Warning
- Available quick fixes:
- Edit expression
- Empty fork step expression
- Severity: Warning
- Available quick fixes:
- Edit expression
- Invalid break step expression
- Description: Unevaluated expression must be one of the labels above the step or a proper
Gloop keyword; for example
$gloopIterate
must be used within a iterate step. - Severity: Error
- Available quick fixes:
- Edit expression
- Description: Unevaluated expression must be one of the labels above the step or a proper
Gloop keyword; for example
- Empty step label of fork step child
- Description: All the steps under a fork step must have a label.
- Severity: Warning
- Available quick fixes:
- Edit step label
- Duplicated step label
- Description: Steps within the same context or level2 should have a unique label.
- Severity: Warning
- Available quick fixes:
- Edit step label
- Invalid asynchronous invoke step
- Description: Asynchronous invoke step should not have an output map line, set expression, declared property, or unload property.
- Severity: Warning
- Available quick fixes:
- Make invoke step synchronous
-
Unhandled invoke step exception
- Description: Some invoke steps throw an exception; such steps should be wrapped in a
try
-block
. - Severity: Warning
- Available quick fixes:
- Wrap step in a
try
/catch
and log error message - Wrap step in a
try
/catch
, log error exception and write message - Wrap step in a
try
/catch
- Wrap step in
try
/catch
/finally
- Wrap step in
try
/finally
- Wrap step in a
To warn or not to warn?
If you would like to create and use a service that knowingly throws an exception and prefer not to see the warning, simply name the service
throw*Exception
, where the*
can be any combination of letters and numbers. - Description: Some invoke steps throw an exception; such steps should be wrapped in a
-
Invalid unevaluated set expression
- Description: An unevaluated expression assigned on a property should have the right type; for example, the
set expression on a
GloopInteger
should be a number. - Severity: Error
- Available quick fixes:
- Edit set expression
- Description: An unevaluated expression assigned on a property should have the right type; for example, the
set expression on a
- Unmapped non-nullable invoke step input property
- Description: Some invoke steps have input properties that are marked as non-nullable (
Allow Null
:false
); such properties should be either mapped or have a set expression. - Severity: Error
- Available quick fixes:
- Map a property
- Add a set expression
- Description: Some invoke steps have input properties that are marked as non-nullable (
- Empty map step
- Severity: Warning
- Available quick fixes:
- Delete step
- Open Mapper view
- Map a property via content-assist
- Set an expression via content-assist
- Invoke step references a service from a package which is not a dependency of the current package
- Severity: Error
- Available quick fixes:
- Add package to package dependencies