Skip to content

Commit

Permalink
Merge pull request #115 from leinardi/master
Browse files Browse the repository at this point in the history
Release 0.16.2
  • Loading branch information
leinardi authored Oct 16, 2023
2 parents c4e238c + 2d90535 commit ef091d7
Show file tree
Hide file tree
Showing 12 changed files with 192 additions and 124 deletions.
77 changes: 52 additions & 25 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,73 +1,100 @@
**[0.16.2] 2023-10-16**

- Fix compatibility issues

**[0.16.1] 2023-10-09**

- Fix several compatibility issues

**[0.16.0] 2023-08-31**

- Fixed #63: Remote Interpreter
- Fixed #110: Support for mypy using WSL interpreter
- Respect mypy path field and don't force usage of project interpreter

**[0.15.0] 2023-04-24**

- Fixed #107: Icons not visible in new Jetbrains UI
- New: Min IDEA version raised from PC-2021.2 to PC-2022.1.4
- Several dependency updates

**[0.14.0] 2022-02-26**

- Change default inspection level to ERROR (thanks to @intgr)
- New: Make plugin hot-reloadable (thanks to @intgr)
- New: Show notification when Mypy exits abnormally (thanks to @intgr)
- New: Improved executable auto-detection on Windows
- Several dependency updates

**[0.12.1] 2021-12-06**

- New: Minimum compatibility version raised to 201.8743

**[0.12.0] 2021-12-05**

- Fixed #43: Major performance issues with background scanning (a huge thank you to @intgr for fixing this issue!)
- New: Ability to add suppress comments for Mypy violations via `IntentionAction` (again, thanks to @intgr for the contribution. See #81 for details)
- New: Ability to add suppress comments for Mypy violations via `IntentionAction` (again, thanks to @intgr for the
contribution. See #81 for details)
- New: Min IDEA version raised from 2018 to PC-2021.2.3
- Several dependency updates

**[0.11.2] 2020-04-25**
- Fixed #61: Changed module/project icons to be compatible with EAPs of IDEA 2020.1

- Fixed #61: Changed module/project icons to be compatible with EAPs of IDEA 2020.1

**[0.11.1] 2020-02-04**
- Fixed regression generating several errors in Event Log during inspection

- Fixed regression generating several errors in Event Log during inspection

**[0.11.0] 2020-02-01**
- New: Min IDEA version raised from 2016 to 2018
- New: Improved Mypy custom arguments handling
- New: Tidied up deprecations in the 2018 SDK
- New: Fixed possible deadlock during inspection

- New: Min IDEA version raised from 2016 to 2018
- New: Improved Mypy custom arguments handling
- New: Tidied up deprecations in the 2018 SDK
- New: Fixed possible deadlock during inspection

**[0.10.6] 2019-09-15**
- New: Improved error handling

- New: Improved error handling

**[0.10.5] 2019-09-13**
- New: Improved error handling

- New: Improved error handling

**[0.10.4] 2019-06-23**
- New: Implementing a better virtualenv detection

- New: Implementing a better virtualenv detection

**[0.10.3] 2018-09-25**
- Fix #21: use `follow-imports=silent`


- Fix #21: use `follow-imports=silent`

**[0.10.2] 2018-09-25**
- Fix #15: SyntaxError: Non-UTF-8 code starting with '\x90' when interpreter is set on Windows

- Fix #15: SyntaxError: Non-UTF-8 code starting with '\x90' when interpreter is set on Windows

**[0.10.1] 2018-09-21**
- Fix #12: Mypy absolute path not working on Windows
- New: Mypy auto-detections for Windows


- Fix #12: Mypy absolute path not working on Windows
- New: Mypy auto-detections for Windows

**[0.10.0] 2018-09-17**
- New: Support scanning inside current Virtualenv
- New: Improved Mypy auto-detection
- New: Option to install Mypy if missing
- New: Settings button now opens File | Settings | Mypy
- New: Minimum compatibility version raised to 163.15529
- New: Added ability to optionally specify a mypy config file

- New: Support scanning inside current Virtualenv
- New: Improved Mypy auto-detection
- New: Option to install Mypy if missing
- New: Settings button now opens File | Settings | Mypy
- New: Minimum compatibility version raised to 163.15529
- New: Added ability to optionally specify a mypy config file

**[0.8.1] 2018-09-08**
- Fix #7: Don't show the 'invalid syntax' message for real-time scan

- Fix #7: Don't show the 'invalid syntax' message for real-time scan

**[0.8.0] 2018-09-05**
- Fix #2: Showing better info to the user if Mypy is missing

- Fix #2: Showing better info to the user if Mypy is missing

**[0.7.0] 2018-09-02**
- Initial release

- Initial release
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
version=0.16.0
version=0.16.2
ideVersion=PC-2022.1.4
pythonPlugin=python-ce
sinceBuild=221.6008
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/com/leinardi/pycharm/mypy/MypyPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ public final class MypyPlugin {

private static final Logger LOG = com.intellij.openapi.diagnostic.Logger.getInstance(MypyPlugin.class);

private static final long NO_TIMEOUT = 0L;

private final Set<Future<?>> checksInProgress = new HashSet<>();
private final Project project;

Expand Down Expand Up @@ -141,7 +143,7 @@ public Map<PsiFile, List<Problem>> scanFiles(@NotNull final List<VirtualFile> fi
}

try {
return whenFinished(runAsyncCheck(new ScanFiles(this, files))).get();
return whenFinished(runAsyncCheck(new ScanFiles(this, files)), NO_TIMEOUT).get();
} catch (final Throwable e) {
LOG.warn("ERROR scanning files", e);
return Collections.emptyMap();
Expand Down
65 changes: 27 additions & 38 deletions src/main/java/com/leinardi/pycharm/mypy/checker/Problem.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,10 @@
import com.leinardi.pycharm.mypy.MypyBundle;
import com.leinardi.pycharm.mypy.intentions.TypeIgnoreIntention;
import com.leinardi.pycharm.mypy.mpapi.SeverityLevel;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.jetbrains.annotations.NotNull;

import java.util.Objects;

public class Problem {
private final PsiElement target;
private final SeverityLevel severityLevel;
Expand Down Expand Up @@ -91,47 +90,37 @@ public boolean isSuppressErrors() {

@Override
public String toString() {
return new ToStringBuilder(this)
.append("target", target)
.append("message", message)
.append("severityLevel", severityLevel)
.append("line", line)
.append("column", column)
.append("afterEndOfLine", afterEndOfLine)
.append("suppressErrors", suppressErrors)
.toString();
}

@Override
public int hashCode() {
return new HashCodeBuilder()
.append(target)
.append(message)
.append(severityLevel)
.append(line)
.append(column)
.append(afterEndOfLine)
.append(suppressErrors)
.toHashCode();
return "Problem{" +
"target=" + target +
", severityLevel=" + severityLevel +
", line=" + line +
", column=" + column +
", message='" + message + '\'' +
", afterEndOfLine=" + afterEndOfLine +
", suppressErrors=" + suppressErrors +
'}';
}

@Override
public boolean equals(Object other) {
if (other == this) {
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(other instanceof Problem)) {
if (!(o instanceof Problem)) {
return false;
}
Problem rhs = ((Problem) other);
return new EqualsBuilder()
.append(target, rhs.target)
.append(message, rhs.message)
.append(severityLevel, rhs.severityLevel)
.append(line, rhs.line)
.append(column, rhs.column)
.append(afterEndOfLine, rhs.afterEndOfLine)
.append(suppressErrors, rhs.suppressErrors)
.isEquals();
Problem problem = (Problem) o;
return line == problem.line &&
column == problem.column &&
afterEndOfLine == problem.afterEndOfLine &&
suppressErrors == problem.suppressErrors &&
Objects.equals(target, problem.target) &&
severityLevel == problem.severityLevel &&
Objects.equals(message, problem.message);
}

@Override
public int hashCode() {
return Objects.hash(target, severityLevel, line, column, message, afterEndOfLine, suppressErrors);
}
}
55 changes: 22 additions & 33 deletions src/main/java/com/leinardi/pycharm/mypy/mpapi/Issue.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,12 @@

package com.leinardi.pycharm.mypy.mpapi;

import java.util.Objects;

/**
* An issue as reported by the Mypy tool.
*/

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;

public class Issue {

private final String path;
Expand Down Expand Up @@ -62,42 +60,33 @@ public String getMessage() {

@Override
public String toString() {
return new ToStringBuilder(this)
.append("path", path)
.append("line", line)
.append("column", column)
.append("type", severityLevel)
.append("message", message)
.toString();
return "Issue{" +
"path='" + path + '\'' +
", line=" + line +
", column=" + column +
", severityLevel=" + severityLevel +
", message='" + message + '\'' +
'}';
}

@Override
public int hashCode() {
return new HashCodeBuilder()
.append(path)
.append(line)
.append(column)
.append(severityLevel)
.append(message)
.toHashCode();
}

@Override
public boolean equals(Object other) {
if (other == this) {
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(other instanceof Issue)) {
if (!(o instanceof Issue)) {
return false;
}
Issue rhs = ((Issue) other);
return new EqualsBuilder()
.append(path, rhs.path)
.append(line, rhs.line)
.append(column, rhs.column)
.append(severityLevel, rhs.severityLevel)
.append(message, rhs.message)
.isEquals();
Issue issue = (Issue) o;
return line == issue.line &&
column == issue.column &&
Objects.equals(path, issue.path) &&
severityLevel == issue.severityLevel &&
Objects.equals(message, issue.message);
}

@Override
public int hashCode() {
return Objects.hash(path, line, column, severityLevel, message);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
Expand Down Expand Up @@ -356,7 +357,7 @@ public static List<Issue> parseMypyOutput(@NotNull InputStream inputStream) thro
// Mypy uses 1-based column numbers, IntelliJ expects 0-based
int column = splitPosition.length > 2 ? Integer.parseInt(splitPosition[2].trim()) - 1 : 1;
String[] splitError = rawLine.substring(typeIndexStart).split(":", 2);
SeverityLevel severityLevel = SeverityLevel.valueOf(splitError[0].trim().toUpperCase());
SeverityLevel severityLevel = SeverityLevel.valueOf(splitError[0].trim().toUpperCase(Locale.ROOT));
String message = splitError[1].trim();
issues.add(new Issue(path, line, column, severityLevel, message));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import com.leinardi.pycharm.mypy.checker.Problem;
import com.leinardi.pycharm.mypy.exception.MypyToolException;
import com.leinardi.pycharm.mypy.mpapi.SeverityLevel;
import com.leinardi.pycharm.mypy.util.Strings;
import org.jetbrains.annotations.Nullable;

import javax.swing.Box;
Expand Down Expand Up @@ -71,8 +72,6 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import static org.apache.commons.lang.StringUtils.isBlank;

/**
* The tool window for Mypy scans.
*/
Expand Down Expand Up @@ -234,7 +233,7 @@ public void showToolWindow() {
* @param text the new progress text, or null to clear.
*/
public void setProgressText(@Nullable final String text) {
if (isBlank(text)) {
if (Strings.isBlank(text)) {
progressLabel.setText(" ");
} else {
progressLabel.setText(text);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,11 @@
import com.leinardi.pycharm.mypy.checker.Problem;
import com.leinardi.pycharm.mypy.mpapi.SeverityLevel;
import com.leinardi.pycharm.mypy.util.Icons;
import com.leinardi.pycharm.mypy.util.Strings;
import org.jetbrains.annotations.NotNull;

import javax.swing.Icon;

import static org.apache.commons.lang.StringUtils.isBlank;

/**
* The user object for meta-data on tree nodes in the tool window.
*/
Expand Down Expand Up @@ -158,7 +157,7 @@ public void setIcon(final Icon icon) {
* @param text the file the node represents.
*/
public void setText(final String text) {
if (isBlank(text)) {
if (Strings.isBlank(text)) {
throw new IllegalArgumentException("Text may not be null/empty");
}
this.text = text;
Expand Down
Loading

0 comments on commit ef091d7

Please sign in to comment.