From 4e3f38f0a6585424fd3eb7e6f97897b565d69201 Mon Sep 17 00:00:00 2001 From: esteele Date: Sun, 7 Feb 2016 10:34:01 -0500 Subject: [PATCH] Add flake8lint-import-order's application-import-names option --- Flake8Lint.py | 7 ++++++- Flake8Lint.sublime-settings | 12 ++++++++---- README.md | 5 +++++ lint.py | 7 +++++-- 4 files changed, 24 insertions(+), 7 deletions(-) diff --git a/Flake8Lint.py b/Flake8Lint.py index 76cfa2f..2c8a8c2 100644 --- a/Flake8Lint.py +++ b/Flake8Lint.py @@ -47,7 +47,8 @@ 'python_interpreter', 'builtins', 'pyflakes', 'pep8', 'pydocstyle', 'naming', 'debugger', 'import_order', 'import_order_style', 'complexity', 'pep8_max_line_length', 'select', 'ignore', 'ignore_files', - 'use_flake8_global_config', 'use_flake8_project_config', + 'use_flake8_global_config', 'use_flake8_project_config', + 'application_import_names' ) FLAKE8_SETTINGS_KEYS = ( 'ignore', 'select', 'ignore_files', 'pep8_max_line_length' @@ -215,6 +216,10 @@ def setup(self): else: self.import_order_style = 'cryptography' + # get local import names + self.application_import_names = self.settings.get( + 'application_import_names', []) + # turn off complexity check (set number > 0 to check complexity level) try: self.complexity = int(self.settings.get('complexity', -1)) diff --git a/Flake8Lint.sublime-settings b/Flake8Lint.sublime-settings index 453d36d..b721e40 100644 --- a/Flake8Lint.sublime-settings +++ b/Flake8Lint.sublime-settings @@ -40,10 +40,10 @@ // report successfull (passed) lint "report_on_success": false, - // blink gutter marks on success (will not blink with live mode check) - // this icon is not depends on 'gutter_marks' settings - // please, be careful: this may cause performance issues on ST2 - "blink_gutter_marks_on_success": true, + // blink gutter marks on success (will not blink with live mode check) + // this icon is not depends on 'gutter_marks' settings + // please, be careful: this may cause performance issues on ST2 + "blink_gutter_marks_on_success": true, // load global flake8 config ("~/.config/flake8") "use_flake8_global_config": true, @@ -76,6 +76,10 @@ // import order style: "cryptography" or "google" // See also: https://github.com/public/flake8-import-order#configuration "import-order-style": "cryptography", + // Import names that should be considered local to your application + // See also: https://github.com/public/flake8-import-order#configuration + "application-import-names": [], + // turn off complexity check (set number > 0 to check complexity level) "complexity": -1, diff --git a/README.md b/README.md index 59d87a3..06a62e0 100644 --- a/README.md +++ b/README.md @@ -134,6 +134,10 @@ Default "Python Flake8 Lint" plugin config: Preferences->Package // import order style: "cryptography" or "google" // See also: https://github.com/public/flake8-import-order#configuration "import-order-style": "cryptography", + // Import names that should be considered local to your application + // See also: https://github.com/public/flake8-import-order#configuration + "application-import-names": [], + // turn off complexity check (set number > 0 to check complexity level) "complexity": -1, @@ -199,6 +203,7 @@ You could define per-project config for "Python Flake8 Lint". Use Project