191 строка
8.9 KiB
XML
191 строка
8.9 KiB
XML
<?xml version="1.0"?>
|
|
<doc>
|
|
<assembly>
|
|
<name>Gendarme.Rules.Portability</name>
|
|
</assembly>
|
|
<members>
|
|
<member name="T:Gendarme.Rules.Portability.DoNotHardcodePathsRule">
|
|
<summary>
|
|
This rule checks for strings that contain valid paths, either under Unix or
|
|
Windows file systems. Path literals are often not portable across
|
|
operating systems (e.g. different path separators). To ensure correct cross-platform
|
|
functionality they should be replaced by calls to <c>Path.Combine</c> and/or
|
|
<c>Environment.GetFolderPath</c>.
|
|
</summary>
|
|
<example>
|
|
Bad example:
|
|
<code>
|
|
void ReadConfig ()
|
|
{
|
|
using (FileStream fs = File.Open ("~/.local/share/myapp/user.config")) {
|
|
// read configuration
|
|
}
|
|
}
|
|
</code></example>
|
|
<example>
|
|
Good example:
|
|
<code>
|
|
void ReadConfig ()
|
|
{
|
|
string config_file = Environment.GetFolderPath (SpecialFolder.LocalApplicationData);
|
|
config_file = Path.Combine (Path.Combine (config_file, "myapp"), "user.config");
|
|
using (FileStream fs = File.Open (config_file)) {
|
|
// read configuration
|
|
}
|
|
}
|
|
</code></example>
|
|
<remarks>This rule is available since Gendarme 2.0</remarks>
|
|
</member>
|
|
<member name="T:Gendarme.Rules.Portability.ExitCodeIsLimitedOnUnixRule">
|
|
<summary>
|
|
This rule applies to all executable (i.e. EXE) assemblies. Something that many Windows
|
|
developers might not be aware of is that on Unix systems, process exit code must be
|
|
between zero and 255, unlike in Windows where it can be any valid integer value.
|
|
This rule warns if the returned value might be out of range either by:
|
|
<list type="bullet"><item><description>returning an unknown value from <c>int Main()</c>;</description></item><item><description>setting the <c>Environment.ExitCode</c> property; or</description></item><item><description>calling <c>Environment.Exit(exitCode)</c> method.</description></item></list>
|
|
An error is reported in case a number which is definitely out of range is returned
|
|
as an exit code.
|
|
</summary>
|
|
<example>
|
|
Bad example:
|
|
<code>
|
|
class MainClass {
|
|
static int Main ()
|
|
{
|
|
Environment.ExitCode = 1000;
|
|
Environment.Exit (512);
|
|
return -1;
|
|
}
|
|
}
|
|
</code></example>
|
|
<example>
|
|
Good example:
|
|
<code>
|
|
class MainClass {
|
|
static int Main ()
|
|
{
|
|
Environment.ExitCode = 42;
|
|
Environment.Exit (100);
|
|
return 1;
|
|
}
|
|
}
|
|
</code></example>
|
|
<remarks>This rule is available since Gendarme 2.0</remarks>
|
|
</member>
|
|
<member name="T:Gendarme.Rules.Portability.FeatureRequiresRootPrivilegeOnUnixRule">
|
|
<summary>
|
|
This rule fires if a feature is used which is, by default, restricted under Unix.
|
|
<list type="bullet"><item><description><c>System.Net.NetworkInformation.Ping</c>: This type can only be used
|
|
by root on Unix systems. As an alternative you can execute the ping command and
|
|
parse its result.</description></item><item><description><c>System.Diagnostics.Process</c>: The PriorityClass property can only
|
|
be set to <c>Normal</c> by non-root users. To avoid this problem you can do a
|
|
platform check before assigning a priority.</description></item></list></summary>
|
|
<example>
|
|
Bad example:
|
|
<code>
|
|
process.PriorityClass = ProcessPriorityClass.AboveNormal;
|
|
process.Start ();
|
|
</code></example>
|
|
<example>
|
|
Good example:
|
|
<code>
|
|
if (Environment.OSVersion.Platform != PlatformID.Unix) {
|
|
process.PriorityClass = ProcessPriorityClass.AboveNormal;
|
|
}
|
|
process.Start ();
|
|
</code></example>
|
|
</member>
|
|
<member name="T:MoMA.Analyzer.MoMAWebService.MoMASubmit">
|
|
<remarks />
|
|
</member>
|
|
<member name="M:MoMA.Analyzer.MoMAWebService.MoMASubmit.#ctor">
|
|
<remarks />
|
|
</member>
|
|
<member name="E:MoMA.Analyzer.MoMAWebService.MoMASubmit.SubmitResultsCompleted">
|
|
<remarks />
|
|
</member>
|
|
<member name="E:MoMA.Analyzer.MoMAWebService.MoMASubmit.GetLatestDefinitionsVersionCompleted">
|
|
<remarks />
|
|
</member>
|
|
<member name="M:MoMA.Analyzer.MoMAWebService.MoMASubmit.SubmitResults(System.String)">
|
|
<remarks />
|
|
</member>
|
|
<member name="M:MoMA.Analyzer.MoMAWebService.MoMASubmit.SubmitResultsAsync(System.String)">
|
|
<remarks />
|
|
</member>
|
|
<member name="M:MoMA.Analyzer.MoMAWebService.MoMASubmit.SubmitResultsAsync(System.String,System.Object)">
|
|
<remarks />
|
|
</member>
|
|
<member name="M:MoMA.Analyzer.MoMAWebService.MoMASubmit.GetLatestDefinitionsVersion">
|
|
<remarks />
|
|
</member>
|
|
<member name="M:MoMA.Analyzer.MoMAWebService.MoMASubmit.GetLatestDefinitionsVersionAsync">
|
|
<remarks />
|
|
</member>
|
|
<member name="M:MoMA.Analyzer.MoMAWebService.MoMASubmit.GetLatestDefinitionsVersionAsync(System.Object)">
|
|
<remarks />
|
|
</member>
|
|
<member name="M:MoMA.Analyzer.MoMAWebService.MoMASubmit.CancelAsync(System.Object)">
|
|
<remarks />
|
|
</member>
|
|
<member name="T:MoMA.Analyzer.MoMAWebService.SubmitResultsCompletedEventHandler">
|
|
<remarks />
|
|
</member>
|
|
<member name="T:MoMA.Analyzer.MoMAWebService.SubmitResultsCompletedEventArgs">
|
|
<remarks />
|
|
</member>
|
|
<member name="P:MoMA.Analyzer.MoMAWebService.SubmitResultsCompletedEventArgs.Result">
|
|
<remarks />
|
|
</member>
|
|
<member name="T:MoMA.Analyzer.MoMAWebService.GetLatestDefinitionsVersionCompletedEventHandler">
|
|
<remarks />
|
|
</member>
|
|
<member name="T:MoMA.Analyzer.MoMAWebService.GetLatestDefinitionsVersionCompletedEventArgs">
|
|
<remarks />
|
|
</member>
|
|
<member name="P:MoMA.Analyzer.MoMAWebService.GetLatestDefinitionsVersionCompletedEventArgs.Result">
|
|
<remarks />
|
|
</member>
|
|
<member name="T:Gendarme.Rules.Portability.MonoCompatibilityReviewRule">
|
|
<summary>
|
|
This rule will fire if one of the assemblies being checked contains a call to a .NET
|
|
method which is either not implemented on Mono or partially implemented. It does
|
|
this by downloading a MoMA definitions file under <c>~/.local/share/Gendarme/</c> (on UNIX)
|
|
or <c>C:\Documents and Settings\{username}\Local Settings\Application Data\Gendarme</c>
|
|
(on Windows) and checking for calls to the methods therein. The rule will work without
|
|
MoMA but if it does fire it may be useful to download and run MoMA.
|
|
By default the rule will use the latest local version available. This can be overriden to use a
|
|
specific, local, version if you want to review compatibility against a specific Mono version.
|
|
You can also manually remove them, now and then, to ensure you are using the latest version.
|
|
Also upgrading Gendarme will try to download a newer version of the definitions files.
|
|
</summary>
|
|
</member>
|
|
<member name="P:Gendarme.Rules.Portability.MonoCompatibilityReviewRule.Version">
|
|
<summary>
|
|
The version of Mono against which you wish to review compatibility.
|
|
You need to have this version of the definitions file downloaded in order to use it.
|
|
This is useful if you want to upgrade Gendarme but still want to test compatibility
|
|
against an older version of Mono.
|
|
</summary>
|
|
</member>
|
|
<member name="T:Gendarme.Rules.Portability.NewLineLiteralRule">
|
|
<summary>
|
|
This rule warns if methods, including properties, are using the literal
|
|
<c>\r</c> and/or <c>\n</c> for new lines. This isn't portable across operating systems.
|
|
To ensure correct cross-platform functionality they should be replaced by
|
|
<c>System.Environment.NewLine</c>.
|
|
</summary>
|
|
<example>
|
|
Bad example:
|
|
<code>
|
|
Console.WriteLine ("Hello,\nYou should be using Gendarme!");
|
|
</code></example>
|
|
<example>
|
|
Good example:
|
|
<code>
|
|
Console.WriteLine ("Hello,{0}You must be using Gendarme!", Environment.NewLine);
|
|
</code></example>
|
|
</member>
|
|
</members>
|
|
</doc>
|