From ad6582b62e12c2770010ed299ced69bfd11bd00d Mon Sep 17 00:00:00 2001 From: Mikhail Golubev Date: Thu, 12 Jan 2017 14:02:00 +0300 Subject: [PATCH] PY-10182 Pass --hang-closing to pycodestyle.py if it's enabled in settings --- .../validation/Pep8ExternalAnnotator.java | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/python/src/com/jetbrains/python/validation/Pep8ExternalAnnotator.java b/python/src/com/jetbrains/python/validation/Pep8ExternalAnnotator.java index 215f37837ed9..180274dcb514 100644 --- a/python/src/com/jetbrains/python/validation/Pep8ExternalAnnotator.java +++ b/python/src/com/jetbrains/python/validation/Pep8ExternalAnnotator.java @@ -125,14 +125,16 @@ public class Pep8ExternalAnnotator extends ExternalAnnotator ignoredErrors; private final int margin; + private final boolean hangClosingBrackets; public State(String interpreterPath, String fileText, HighlightDisplayLevel level, - List ignoredErrors, int margin) { + List ignoredErrors, int margin, boolean hangClosingBrackets) { this.interpreterPath = interpreterPath; this.fileText = fileText; this.level = level; this.ignoredErrors = ignoredErrors; this.margin = margin; + this.hangClosingBrackets = hangClosingBrackets; } } @@ -179,20 +181,22 @@ public class Pep8ExternalAnnotator extends ExternalAnnotator ignoredErrors = Lists.newArrayList(inspection.ignoredErrors); - if (!currentSettings.getCustomSettings(PyCodeStyleSettings.class).SPACE_AFTER_NUMBER_SIGN) { + if (!customSettings.SPACE_AFTER_NUMBER_SIGN) { ignoredErrors.add("E262"); // Block comment should start with a space ignoredErrors.add("E265"); // Inline comment should start with a space } - if (!currentSettings.getCustomSettings(PyCodeStyleSettings.class).SPACE_BEFORE_NUMBER_SIGN) { + if (!customSettings.SPACE_BEFORE_NUMBER_SIGN) { ignoredErrors.add("E261"); // At least two spaces before inline comment } - final int margin = currentSettings.getRightMargin(file.getLanguage()); - return new State(homePath, file.getText(), profile.getErrorLevel(key, file), ignoredErrors, margin); + final int margin = commonSettings.getRightMargin(file.getLanguage()); + return new State(homePath, file.getText(), profile.getErrorLevel(key, file), + ignoredErrors, margin, customSettings.HANG_CLOSING_BRACKETS); } private static void reportMissingInterpreter() { @@ -214,6 +218,9 @@ public class Pep8ExternalAnnotator extends ExternalAnnotator