Skip to content

Commit

Permalink
Revert "Add an 'isort' & 'black' task."
Browse files Browse the repository at this point in the history
  • Loading branch information
zvezdan authored Nov 26, 2019
1 parent d8ff798 commit bce093c
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 206 deletions.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,24 @@
*/
package com.linkedin.gradle.python.extension;

import com.linkedin.gradle.python.extension.internal.DefaultExternalTool;

public class MypyExtension {
private boolean run;
private String[] arguments = null;

public class MypyExtension extends DefaultExternalTool {
public boolean isRun() {
return run;
}

public void setRun(boolean run) {
this.run = run;
}

public void setArguments(String argumentString) {
arguments = argumentString.split("\\s+");
}

public String[] getArguments() {
return arguments;
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,13 @@
package com.linkedin.gradle.python.plugin.internal;

import com.linkedin.gradle.python.PythonExtension;
import com.linkedin.gradle.python.extension.BlackExtension;
import com.linkedin.gradle.python.extension.IsortExtension;
import com.linkedin.gradle.python.extension.MypyExtension;
import com.linkedin.gradle.python.extension.CoverageExtension;
import com.linkedin.gradle.python.tasks.AbstractPythonMainSourceDefaultTask;
import com.linkedin.gradle.python.tasks.AbstractPythonTestSourceDefaultTask;
import com.linkedin.gradle.python.tasks.BlackTask;
import com.linkedin.gradle.python.tasks.CheckStyleGeneratorTask;
import com.linkedin.gradle.python.tasks.Flake8Task;
import com.linkedin.gradle.python.tasks.MypyTask;
import com.linkedin.gradle.python.tasks.IsortTask;
import com.linkedin.gradle.python.tasks.PyCoverageTask;
import com.linkedin.gradle.python.tasks.PyTestTask;
import com.linkedin.gradle.python.util.ExtensionUtils;
Expand All @@ -36,15 +32,13 @@
import org.gradle.api.logging.Logger;
import org.gradle.api.logging.Logging;

import static com.linkedin.gradle.python.util.StandardTextValues.TASK_BLACK;
import static com.linkedin.gradle.python.util.StandardTextValues.TASK_CHECK;
import static com.linkedin.gradle.python.util.StandardTextValues.TASK_CHECKSTYLE;
import static com.linkedin.gradle.python.util.StandardTextValues.TASK_COVERAGE;
import static com.linkedin.gradle.python.util.StandardTextValues.TASK_FLAKE;
import static com.linkedin.gradle.python.util.StandardTextValues.TASK_INSTALL_BUILD_REQS;
import static com.linkedin.gradle.python.util.StandardTextValues.TASK_INSTALL_PROJECT;
import static com.linkedin.gradle.python.util.StandardTextValues.TASK_MYPY;
import static com.linkedin.gradle.python.util.StandardTextValues.TASK_ISORT;
import static com.linkedin.gradle.python.util.StandardTextValues.TASK_PYTEST;

public class ValidationPlugin implements Plugin<Project> {
Expand Down Expand Up @@ -118,7 +112,7 @@ public void apply(final Project project) {
/*
* Run mypy.
*
* This uses the setup.cfg (or mypy.ini) file if present to configure mypy.
* This uses the mypy.ini file if present to configure mypy.
*/
MypyExtension mypy = ExtensionUtils.maybeCreate(project, "mypy", MypyExtension.class);
project.getTasks().create(TASK_MYPY.getValue(), MypyTask.class,
Expand All @@ -128,28 +122,6 @@ public void apply(final Project project) {
project.getTasks().getByName(TASK_CHECK.getValue())
.dependsOn(project.getTasks().getByName(TASK_MYPY.getValue()));

/*
* Run isort.
*/
IsortExtension isort = ExtensionUtils.maybeCreate(project, "isort", IsortExtension.class);
project.getTasks().create(TASK_ISORT.getValue(), IsortTask.class,
task -> task.onlyIf(it -> project.file(settings.srcDir).exists() && isort.isRun()));

// Make task "check" depend on isort task.
project.getTasks().getByName(TASK_CHECK.getValue())
.dependsOn(project.getTasks().getByName(TASK_ISORT.getValue()));

/*
* Run black.
*/
BlackExtension black = ExtensionUtils.maybeCreate(project, "black", BlackExtension.class);
project.getTasks().create(TASK_BLACK.getValue(), BlackTask.class,
task -> task.onlyIf(it -> project.file(settings.srcDir).exists() && black.isRun()));

// Make task "check" depend on black task.
project.getTasks().getByName(TASK_CHECK.getValue())
.dependsOn(project.getTasks().getByName(TASK_BLACK.getValue()));

/*
* Create checkstyle styled report from flake
*/
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ public enum StandardTextValues {
CONFIGURATION_VENV("venv"),
CONFIGURATION_WHEEL("wheel"),
CONFIGURATION_FLAKE8("flake8"),
TASK_BLACK("runBlack"),
TASK_BUILD_DOCS("buildDocs"),
TASK_CLEAN_SAVE_VENV("cleanSaveVenv"),
TASK_CHECK("check"),
Expand All @@ -43,7 +42,6 @@ public enum StandardTextValues {
TASK_INSTALL_PROJECT("installProject"),
TASK_INSTALL_PYTHON_REQS("installPythonRequirements"),
TASK_INSTALL_TEST_REQS("installTestRequirements"),
TASK_ISORT("runIsort"),
TASK_MYPY("runMypy"),
TASK_PACKAGE_DOCS("packageDocs"),
TASK_PACKAGE_JSON_DOCS("packageJsonDocs"),
Expand Down

0 comments on commit bce093c

Please sign in to comment.