Commits

Mathias Kluba  committed 7af91e3

use spaces instead of tabs

  • Participants
  • Parent commits cfe3e1a

Comments (0)

Files changed (1)

File sonar/sonar-plugin-dotnet-core/src/main/java/org/sonar/plugin/dotnet/core/ProjectDependenciesSensor.java

 
 public class ProjectDependenciesSensor implements Sensor {
 
-	private final static Logger log = LoggerFactory
-			.getLogger(BinaryDependenciesSensor.class);
+  private final static Logger log = LoggerFactory.getLogger(BinaryDependenciesSensor.class);
 
-	private final SonarIndex index;
+  private final SonarIndex index;
 
-	public ProjectDependenciesSensor(SonarIndex index) {
-		this.index = index;
-	}
+  public ProjectDependenciesSensor(SonarIndex index) {
+    this.index = index;
+  }
 
-	@Override
-	public void analyse(Project project, SensorContext context) {
+  @Override
+  public void analyse(Project project, SensorContext context) {
 
-		try {
-			VisualStudioSolution solution = VisualUtils.getSolution(project);
-			List<VisualStudioProject> projects = solution.getProjects();
+    try {
+      VisualStudioSolution solution = VisualUtils.getSolution(project);
+      List<VisualStudioProject> projects = solution.getProjects();
 
-			// resolve dependencies for each projects of the solution
-			for (VisualStudioProject vsProject : projects) {
+      // resolve dependencies for each projects of the solution
+      for (VisualStudioProject vsProject : projects) {
 
-				// find the referenced project in the Maven modules
-				Resource<?> subProject = VisualUtils.getProjectFromName(project,
-						vsProject.getAssemblyName());				
+        // find the referenced project in the Maven modules
+        Resource<?> subProject = VisualUtils.getProjectFromName(project, vsProject.getAssemblyName());
 
-				// resolve project references
-				List<ProjectReference> projectReferences = vsProject
-						.getProjectReferences();
-				for (ProjectReference projectReference : projectReferences) {
+        // resolve project references
+        List<ProjectReference> projectReferences = vsProject.getProjectReferences();
 
-					// find the referenced project in the solution
-					VisualStudioProject vsReferencedProject = solution
-							.getProject(projectReference.getGuid());
+        for (ProjectReference projectReference : projectReferences) {
 
-					Resource<?> referencedProject = VisualUtils.getProjectFromName(
-							project, vsReferencedProject.getAssemblyName());
+          // find the referenced project in the solution
+          VisualStudioProject vsReferencedProject = solution.getProject(projectReference.getGuid());
 
-					Resource<?> savedReferencedPrj = context
-							.getResource(referencedProject);
-					if (savedReferencedPrj == null) {
-						log.info("Saving resource"+savedReferencedPrj.toString());
-						context.saveResource(referencedProject);
-						savedReferencedPrj = context.getResource(referencedProject);
-					}
-					referencedProject = savedReferencedPrj;
-					
-					Dependency dependency = new Dependency(subProject, referencedProject);
-					dependency.setUsage("compile");
-					dependency.setWeight(1);
-					context.saveDependency(dependency);
-					log.info("Saving dependency"+dependency.toString());
-					
+          Resource<?> referencedProject = VisualUtils.getProjectFromName(project, vsReferencedProject.getAssemblyName());
+
+          Resource<?> savedReferencedPrj = context.getResource(referencedProject);
+          if (savedReferencedPrj == null) {
+            log.info("Saving resource"+savedReferencedPrj.toString());
+            context.saveResource(referencedProject);
+            savedReferencedPrj = context.getResource(referencedProject);
+          }
+          referencedProject = savedReferencedPrj;
+
+          Dependency dependency = new Dependency(subProject, referencedProject);
+          dependency.setUsage("compile");
+          dependency.setWeight(1);
+          context.saveDependency(dependency);
+          log.info("Saving dependency"+dependency.toString());
+
 /*
-					String json = "[{\"i\":"+referencedProject.getId()+
-						",\"n\":\""+referencedProject.getName()+
-						"\",\"q\":\""+referencedProject.getQualifier()+"\",\"v\":[{}]";
-					
-					Measure measure = new Measure(CoreMetrics.DEPENDENCY_MATRIX, json);
-				    measure.setPersistenceMode(PersistenceMode.DATABASE);
-				    context.saveMeasure(subProject, measure);
-				    log.info("Saving measure"+measure.toString());*/
-				    
-				    // TODO: do it also for PRJ > Folder/Package > File dependencies
-				}
+          String json = "[{\"i\":"+referencedProject.getId()+
+            ",\"n\":\""+referencedProject.getName()+
+            "\",\"q\":\""+referencedProject.getQualifier()+"\",\"v\":[{}]";
 
-			}
+          Measure measure = new Measure(CoreMetrics.DEPENDENCY_MATRIX, json);
+          measure.setPersistenceMode(PersistenceMode.DATABASE);
+          context.saveMeasure(subProject, measure);
+          log.info("Saving measure"+measure.toString());*/
 
-		} catch (DotNetProjectException e) {
-			log.error("Error during binary dependency analysis", e);
-		}
-	}
+          // TODO: do it also for PRJ > Folder/Package > File dependencies
+        }
 
-	@Override
-	public boolean shouldExecuteOnProject(Project project) {
-		String packaging = project.getPackaging();
-		// We only accept the "sln" packaging
-		return "sln".equals(packaging);
-	}
+      }
+
+    } catch (DotNetProjectException e) {
+      log.error("Error during binary dependency analysis", e);
+    }
+  }
+
+  @Override
+  public boolean shouldExecuteOnProject(Project project) {
+    String packaging = project.getPackaging();
+    // We only accept the "sln" packaging
+    return "sln".equals(packaging);
+  }
 
 }