use of com.jscs.cli.data.LintResult in project jscs-plugin by idok.
the class JscsRunnerTest method testSimpleLintJSX.
@Test
public void testSimpleLintJSX() {
String file = JSCS_PLUGIN_ROOT + "/testData/jsx.js";
JscsSettings settings = createSettings(file);
settings.esprima = "esprima-fb";
LintResult result = JscsRunner.lint(settings);
System.out.println(result.errorOutput);
System.out.println(result.jscsLint.file.name);
System.out.println("found " + result.jscsLint.file.errors.size() + " issues");
for (JscsLint.Issue err : result.jscsLint.file.errors) {
System.out.println(err.message);
}
assertEquals("File should match", file, result.jscsLint.file.name);
assertEquals("Should be no errors", 0, result.jscsLint.file.errors.size());
}
use of com.jscs.cli.data.LintResult in project jscs-plugin by idok.
the class JscsRunnerTest method testSimpleLintES6.
@Test
public void testSimpleLintES6() {
String file = JSCS_PLUGIN_ROOT + "/testData/es6.js";
JscsSettings settings = createSettings(file);
settings.esnext = true;
LintResult result = JscsRunner.lint(settings);
System.out.println(result.errorOutput);
System.out.println(result.jscsLint.file.name);
System.out.println("found " + result.jscsLint.file.errors.size() + " issues");
for (JscsLint.Issue err : result.jscsLint.file.errors) {
System.out.println(err.message);
}
assertEquals("File should match", file, result.jscsLint.file.name);
assertEquals("Should be no errors", 0, result.jscsLint.file.errors.size());
}
use of com.jscs.cli.data.LintResult in project jscs-plugin by idok.
the class JscsRunnerTest method testSimpleLint2.
// @Test
// public void testSimpleLint() {
// JscsSettings settings = createSettings(JSCS_PLUGIN_ROOT + "/testData/eq.js");
// ProcessOutput out;
// try {
// out = JscsRunner.lint(settings);
//// System.out.println(settings);
// System.out.println(out.getStdout());
// assertEquals("Exit code should be 1", 1, out.getExitCode());
// } catch (ExecutionException e) {
// e.printStackTrace();
// }
// }
@Test
public void testSimpleLint2() {
JscsSettings settings = createSettings(JSCS_PLUGIN_ROOT + "/testData/test.js");
LintResult result = JscsRunner.lint(settings);
System.out.println(result.errorOutput);
System.out.println(result.jscsLint.file.name);
System.out.println("found " + result.jscsLint.file.errors.size() + " issues");
for (JscsLint.Issue err : result.jscsLint.file.errors) {
System.out.println(err.message);
}
assertEquals("Exit code should be 1", JSCS_PLUGIN_ROOT + "/testData/test.js", result.jscsLint.file.name);
}
use of com.jscs.cli.data.LintResult in project jscs-plugin by idok.
the class JscsRunner method lint.
public static LintResult lint(@NotNull JscsSettings settings) {
LintResult result = new LintResult();
try {
GeneralCommandLine commandLine = createCommandLineLint(settings);
ProcessOutput out = execute(commandLine, TIME_OUT);
// if (out.getExitCode() == 0) {
// } else {
result.errorOutput = out.getStderr();
try {
result.jscsLint = JscsLint.read(out.getStdout());
} catch (Exception e) {
//result.errorOutput = out.getStdout();
}
// }
} catch (Exception e) {
e.printStackTrace();
result.errorOutput = e.toString();
}
return result;
}
use of com.jscs.cli.data.LintResult in project jscs-plugin by idok.
the class JscsRunner method fix.
public static LintResult fix(@NotNull JscsSettings settings) {
LintResult result = new LintResult();
try {
GeneralCommandLine commandLine = createCommandLineLint(settings);
commandLine.addParameter("--fix");
ProcessOutput out = execute(commandLine, TIME_OUT);
result.errorOutput = out.getStderr();
try {
result.jscsLint = JscsLint.read(out.getStdout());
} catch (Exception e) {
LOG.error(e);
//result.errorOutput = out.getStdout();
}
} catch (Exception e) {
e.printStackTrace();
result.errorOutput = e.toString();
}
return result;
}
Aggregations