如何在 sublime 文本中更改 flake8 的缩进设置? [英] How can i change indentation settings for flake8 in sublime text?

查看:47
本文介绍了如何在 sublime 文本中更改 flake8 的缩进设置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将 Sublime Text 3 与数据包管理器一起使用,并安装了 SublimeLinter,然后安装了 SublimeLinter-flake8.

I am using Sublime Text 3 with the Packet Manager, and installed SublimeLinter and then SublimeLinter-flake8.

我想使用制表符进行缩进,但我不知道如何使用.我实际上找不到任何有效的缩进,因为如果我放一个空格它会说:flake8:E111 - 缩进不是四的倍数,但是当我放四个空格时它会说:flake8:E101 - 缩进包含混合空格和选项卡.

I want to use tabs for indentation, but I can't find out how. I can't actually find any indentation that works, because if I put one space it says: flake8: E111 - indentation is not a multiple of four, but when I put four spaces it says: flake8: E101 - indentation contains mixed spaces and tabs.

我在 Windows 上使用 Python 3.有谁知道如何更改设置?

I am on Windows and using Python 3. Does anyone know how to change the settings?

推荐答案

这在 flake8 文档:

Flake8 支持将其配置存储在以下位置:

Flake8 supports storing its configuration in the following places:

  • 您的顶级用户目录
  • 在您的项目中,setup.cfgtox.ini.flake8 之一.
  • Your top-level user directory
  • In your project in one of setup.cfg, tox.ini, or .flake8.

在命令行设置的值具有最高优先级,然后是项目配置文件中的值,然后是用户目录中的值,最后是默认值.但是,还有其他命令行选项可以改变这一点.

Values set at the command line have highest priority, then those in the project configuration file, then those in your user directory, and finally there are the defaults. However, there are additional command line options which can alter this.

由于这与编辑器无关,因此这应该是首选方法.此外,您可以在项目级别处理配置时保持灵活性.

Since this is editor-agnostic, this should be the favoured approach. Also, you keep flexibility when working with configurations at project-level.

但是,您也可以在 SublimeLinter 配置中指定 flake8 参数,完全按照 中所述SublimeLinter-flake8 的文档.请记住,这是一个非常不灵活的解决方案,因为如果您在项目中使用不同的配置设置,则需要对其进行编辑.

However, you can also specify your flake8 arguments in the SublimeLinter configuration, exactly as described in the documentation for SublimeLinter-flake8. Keep in mind that this is a very unflexible solution since it requires editing if you're using different configuration settings across your projects.

这篇关于如何在 sublime 文本中更改 flake8 的缩进设置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆