Pass `zimports` arguments to `zimports.el`.
hongyi-zhao opened this issue · 3 comments
hongyi-zhao commented
How can I pass the zimports
arguments listed here to zimports.el
?
Regards,
HZ
schmir commented
There's currently no good way to do that via elisp. But you can add a setup.cfg
, that can be used to configure zimports. Mine has the following
[flake8]
max-line-length = 99
exclude =
.git
.nox
import-order-style = smarkets
application-import-names = tests
But I guess you did see that in the link you gave. Why doesn't this suffice?
hongyi-zhao commented
Why doesn't this suffice?
I mean the optional arguments of zimports
listed there, namely, the following ones:
-m APPLICATION_IMPORT_NAMES, --application-import-names APPLICATION_IMPORT_NAMES
comma separated list of names that should be
considered local to the application. reads from
[flake8] application-import-names by default.
-p APPLICATION_PACKAGE_NAMES, --application-package-names APPLICATION_PACKAGE_NAMES
comma separated list of names that should be
considered local to the organization. reads from
[flake8] application-package-names by default.
--style STYLE import order styling, reads from [flake8] import-
order-style by default, or defaults to 'google'
--multi-imports If set, multiple imports can exist on one line
-k, --keep-unused keep unused imports even though detected as unused.
Implies keep-unused-type-checking
-kt, --keep-unused-type-checking
keep unused imports even though detected as unused in
type checking blocks. zimports does not detect type usage
in comments or when used as string
--heuristic-unused HEURISTIC_UNUSED
Remove unused imports only if number of imports is
less than <HEURISTIC_UNUSED> percent of the total
lines of code. Ignored in type checking blocks
--statsonly don't write or display anything except the file stats
-e, --expand-stars Expand star imports into the names in the actual
module, which can then have unused names removed.
Requires modules can be imported
--diff don't modify files, just dump out diffs
--stdout dump file output to stdout
As you can see, they are far from being fully included in the flake8 configuration file mentioned above.
schmir commented
I've added a commit, which should allow you to pass additional arguments. Update to the latest version and run M-x customize-group, choose zimports and change zimports args.