Browse Source

Source Analysis addin now working with StyleCop 4.3. Code now checks that the settings editor executable exists before running it.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/3.0@3436 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Matt Ward 17 years ago
parent
commit
55bd3aeb8a
  1. 8
      src/AddIns/Misc/SourceAnalysis/SharpDevelop.SourceAnalysis.targets
  2. 11
      src/AddIns/Misc/SourceAnalysis/Src/AnalysisIdeOptionsPanel.cs
  3. 14
      src/AddIns/Misc/SourceAnalysis/Src/AnalysisProjectOptionsPanel.cs
  4. 2
      src/AddIns/Misc/SourceAnalysis/Src/StyleCopWrapper.cs

8
src/AddIns/Misc/SourceAnalysis/SharpDevelop.SourceAnalysis.targets

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
<?xml version="1.0"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<UsingTask TaskName="SourceAnalysisTask"
AssemblyFile="$(StyleCopDir)\Microsoft.SourceAnalysis.dll"/>
<UsingTask TaskName="StyleCopTask"
AssemblyFile="$(StyleCopDir)\Microsoft.StyleCop.dll"/>
<PropertyGroup>
<BuildDependsOn>$(BuildDependsOn);SourceAnalysis</BuildDependsOn>
@ -30,8 +30,8 @@ @@ -30,8 +30,8 @@
<Output TaskParameter="Include" ItemName="SourceAnalysisFiles"/>
</CreateItem>
<!-- Run the SourceAnalysis MSBuild task. -->
<SourceAnalysisTask
<!-- Run the StyleCop MSBuild task. -->
<StyleCopTask
ProjectFullPath="$(MSBuildProjectFile)"
SourceFiles="@(SourceAnalysisFiles)"
AdditionalAddinPaths="@(SourceAnalysisAdditionalAddinPaths)"

11
src/AddIns/Misc/SourceAnalysis/Src/AnalysisIdeOptionsPanel.cs

@ -61,9 +61,16 @@ namespace MattEverson.SourceAnalysis @@ -61,9 +61,16 @@ namespace MattEverson.SourceAnalysis
void ModifyStyleCopSettingsClick(object sender, EventArgs e)
{
var executable = "\"" + StyleCopWrapper.FindStyleCopPath() + "\\SourceAnalysisSettingsEditor.exe\"";
var executable = Path.Combine(StyleCopWrapper.FindStyleCopPath(), "StyleCopSettingsEditor.exe");
var parameters = StyleCopWrapper.GetMasterSettingsFile();
using(Process p = Process.Start(executable, parameters))
if (!File.Exists(executable)) {
LoggingService.Debug("StyleCopSettingsEditor.exe: " + executable);
MessageService.ShowWarning("Unable to find the StyleCop Settings editor. Please specify the StyleCop location in Tools Options.");
return;
}
using(Process p = Process.Start("\"" + executable + "\"", parameters))
{
// No need to wait for the settings dialog to close - we can leave it open.
}

14
src/AddIns/Misc/SourceAnalysis/Src/AnalysisProjectOptionsPanel.cs

@ -59,16 +59,22 @@ namespace MattEverson.SourceAnalysis { @@ -59,16 +59,22 @@ namespace MattEverson.SourceAnalysis {
settingsFile = CopyFromMaster();
}
else {
MessageBox.Show("No settings file found to modify.");
MessageService.ShowWarning("No settings file found to modify.");
return;
}
}
var executable = "\"" + StyleCopWrapper.FindStyleCopPath() + "\\SourceAnalysisSettingsEditor.exe\"";
var executable = Path.Combine(StyleCopWrapper.FindStyleCopPath(), "StyleCopSettingsEditor.exe");
var parameters = "\"" + settingsFile + "\"";
using(Process p = Process.Start(executable, parameters)) {
// No need to wait for the settings dialog to close - we can leave it open.
if (!File.Exists(executable)) {
LoggingService.Debug("StyleCopSettingsEditor.exe: " + executable);
MessageService.ShowWarning("Unable to find the StyleCop Settings editor. Please specify the StyleCop location in Tools Options.");
return;
}
using(Process p = Process.Start("\"" + executable + "\"", parameters)) {
// No need to wait for the settings dialog to close - we can leave it open.
}
}
private bool ConfirmReplaceMissingFile() {

2
src/AddIns/Misc/SourceAnalysis/Src/StyleCopWrapper.cs

@ -22,7 +22,7 @@ namespace MattEverson.SourceAnalysis @@ -22,7 +22,7 @@ namespace MattEverson.SourceAnalysis
if (string.IsNullOrEmpty(styleCopPath))
return false;
else
return File.Exists(Path.Combine(styleCopPath, "Microsoft.SourceAnalysis.dll"));
return File.Exists(Path.Combine(styleCopPath, "Microsoft.StyleCop.dll"));
}
public static string FindStyleCopPath()

Loading…
Cancel
Save