use of org.python.pydev.shared_core.progress.NullProgressMonitorWrapper in project Pydev by fabioz.
the class PyLintVisitor method startVisit.
/**
* When we start visiting some resource, we create the process which will do the PyLint analysis.
*/
@Override
public void startVisit() {
if (resource == null || PyLintPreferences.usePyLint(resource) == false || (document == null && !(resource instanceof IContainer))) {
deleteMarkers();
return;
}
IProject project = resource.getProject();
PythonNature pythonNature = PythonNature.getPythonNature(project);
if (pythonNature == null) {
deleteMarkers();
return;
}
File pyLintLocation = PyLintPreferences.getPyLintLocation(pythonNature, resource);
if (pyLintLocation == null || !FileUtils.enhancedIsFile(pyLintLocation)) {
deleteMarkers();
return;
}
try {
// PyLint can only be used for python projects
if (pythonNature.getInterpreterType() != IInterpreterManager.INTERPRETER_TYPE_PYTHON) {
deleteMarkers();
return;
}
} catch (Exception e) {
deleteMarkers();
return;
}
synchronized (lock) {
if (pyLintRunnable != null) {
// (we should be analyzing multiple resources in a single call).
return;
}
if (project != null) {
if (resource instanceof IFile) {
IFile file = (IFile) resource;
IPath location = file.getLocation();
if (location != null) {
pyLintRunnable = new PyLintAnalysis(resource, document, location, new NullProgressMonitorWrapper(monitor), pyLintLocation);
try {
IExternalCodeAnalysisStream out = PyLintPreferences.getConsoleOutputStream(resource);
pyLintRunnable.createPyLintProcess(out);
} catch (final Exception e) {
Log.log(e);
}
}
} else if (resource instanceof IContainer) {
IContainer dir = (IContainer) resource;
IPath location = dir.getLocation();
if (location != null) {
pyLintRunnable = new PyLintAnalysis(resource, null, location, new NullProgressMonitorWrapper(monitor), pyLintLocation);
try {
IExternalCodeAnalysisStream out = PyLintPreferences.getConsoleOutputStream(resource);
pyLintRunnable.createPyLintProcess(out);
} catch (final Exception e) {
Log.log(e);
}
}
}
}
}
}
use of org.python.pydev.shared_core.progress.NullProgressMonitorWrapper in project Pydev by fabioz.
the class MypyVisitor method startVisit.
/**
* When we start visiting some resource, we create the process which will do the Mypy analysis.
*/
@Override
public void startVisit() {
if (resource == null || MypyPreferences.useMypy(resource) == false || (document == null && !(resource instanceof IContainer))) {
deleteMarkers();
return;
}
IProject project = resource.getProject();
PythonNature pythonNature = PythonNature.getPythonNature(project);
if (pythonNature == null) {
deleteMarkers();
return;
}
File mypyLocation = MypyPreferences.getMypyLocation(pythonNature);
if (mypyLocation == null || !FileUtils.enhancedIsFile(mypyLocation)) {
if (mypyLocation == null) {
Log.log("Unable to find mypy. Project: " + project.getName());
} else {
Log.log("mypy location does not exist: " + mypyLocation);
}
deleteMarkers();
return;
}
try {
// Mypy can only be used for python projects
if (pythonNature.getInterpreterType() != IInterpreterManager.INTERPRETER_TYPE_PYTHON) {
deleteMarkers();
return;
}
} catch (Exception e) {
deleteMarkers();
return;
}
synchronized (lock) {
if (mypyRunnable != null) {
// (we should be analyzing multiple resources in a single call).
return;
}
if (project != null) {
if (resource instanceof IFile) {
IFile file = (IFile) resource;
IPath location = file.getLocation();
if (location != null) {
mypyRunnable = new MypyAnalysis(resource, document, location, new NullProgressMonitorWrapper(monitor), mypyLocation);
try {
IExternalCodeAnalysisStream out = MypyPreferences.getConsoleOutputStream(project);
mypyRunnable.createMypyProcess(out);
} catch (final Exception e) {
Log.log(e);
}
}
} else if (resource instanceof IContainer) {
IContainer dir = (IContainer) resource;
IPath location = dir.getLocation();
if (location != null) {
mypyRunnable = new MypyAnalysis(resource, null, location, new NullProgressMonitorWrapper(monitor), mypyLocation);
try {
IExternalCodeAnalysisStream out = MypyPreferences.getConsoleOutputStream(project);
mypyRunnable.createMypyProcess(out);
} catch (final Exception e) {
Log.log(e);
}
}
}
}
}
}
use of org.python.pydev.shared_core.progress.NullProgressMonitorWrapper in project Pydev by fabioz.
the class Flake8Visitor method startVisit.
/**
* When we start visiting some resource, we create the process which will do the Flake8 analysis.
*/
@Override
public void startVisit() {
if (resource == null || Flake8Preferences.useFlake8(resource) == false || (document == null && !(resource instanceof IContainer))) {
deleteMarkers();
return;
}
IProject project = resource.getProject();
PythonNature pythonNature = PythonNature.getPythonNature(project);
if (pythonNature == null) {
deleteMarkers();
return;
}
File flake8Location = Flake8Preferences.getFlake8Location(pythonNature);
if (flake8Location == null || !FileUtils.enhancedIsFile(flake8Location)) {
if (flake8Location == null) {
Log.log("Unable to find flake8. Project: " + project.getName());
} else {
Log.log("flake8 location does not exist: " + flake8Location);
}
deleteMarkers();
return;
}
try {
// Flake8 can only be used for python projects
if (pythonNature.getInterpreterType() != IInterpreterManager.INTERPRETER_TYPE_PYTHON) {
deleteMarkers();
return;
}
} catch (Exception e) {
deleteMarkers();
return;
}
synchronized (lock) {
if (flake8Runnable != null) {
// (we should be analyzing multiple resources in a single call).
return;
}
if (project != null) {
if (resource instanceof IFile) {
IFile file = (IFile) resource;
IPath location = file.getLocation();
if (location != null) {
flake8Runnable = new Flake8Analysis(resource, document, location, new NullProgressMonitorWrapper(monitor), flake8Location);
try {
IExternalCodeAnalysisStream out = Flake8Preferences.getConsoleOutputStream(project);
flake8Runnable.createFlake8Process(out);
} catch (final Exception e) {
Log.log(e);
}
}
} else if (resource instanceof IContainer) {
IContainer dir = (IContainer) resource;
IPath location = dir.getLocation();
if (location != null) {
flake8Runnable = new Flake8Analysis(resource, null, location, new NullProgressMonitorWrapper(monitor), flake8Location);
try {
IExternalCodeAnalysisStream out = Flake8Preferences.getConsoleOutputStream(project);
flake8Runnable.createFlake8Process(out);
} catch (final Exception e) {
Log.log(e);
}
}
}
}
}
}
Aggregations