Skip to content

Instantly share code, notes, and snippets.

@theArjun
Last active August 29, 2022 06:07
Show Gist options
  • Select an option

  • Save theArjun/419ee6f63cb6ff3bcd0c54655e9660e4 to your computer and use it in GitHub Desktop.

Select an option

Save theArjun/419ee6f63cb6ff3bcd0c54655e9660e4 to your computer and use it in GitHub Desktop.
ISORT, Yapf and Flake8 Configuration
Name: flake8
-- Files to Watch
File Type: Python
Scope: Project Files
-- Tools to Run on Changes
Program: $PyInterpreterDirectory$\python
Arguments: -m flake8 $FilePath$ --config=setup.cfg --ignore=E133 --format='%(path)s:%(row)d,%(col)d:%(code)s:%(text)s:https://lintlyci.github.io/Flake8Rules/rules/%(code)s.html'
Output paths to refresh: $FilePath$
Working directory: $ProjectFileDir$
-- Advanced Options
Uncheck :
-[] Auto-save edited files to trigger the watcher
-[] Trigger the watcher on external changes
Name: isort
-- Files to Watch
File Type: Python
Scope: Project Files
-- Tools to Run on Changes
Program: $PyInterpreterDirectory$\python
Arguments: -m isort $FilePath$
Output paths to refresh: $FilePath$
Working directory: $ProjectFileDir$
-- Advanced Options
Uncheck :
-[] Auto-save edited files to trigger the watcher
-[] Trigger the watcher on external changes
[yapf]
based_on_style = google
spaces_before_comment = 2
indent_width = 4
split_before_logical_operator = true
column_limit = 80
space_between_ending_comma_and_closing_bracket = True
split_arguments_when_comma_terminated = True
split_before_closing_bracket = True
no_spaces_around_selected_binary_operators = set()
[flake8]
################### PROGRAM ################################
# Specify the number of subprocesses that Flake8 will use to run checks in parallel.
jobs = auto
################### OUTPUT #################################
########## VERBOSITY ##########
# Increase the verbosity of Flake8’s output.
verbose = 1
# Decrease the verbosity of Flake8’s output.
quiet = 0
########## FORMATTING ##########
# Select the formatter used to display errors to the user.
format = default
# Print the total number of errors.
count = True
# Print the source code generating the error/warning in question.
show-source = True
# Count the number of occurrences of each error/warning code and print a report.
statistics = True
########## TARGETS ##########
# Redirect all output to the specified file.
output-file = .flake8.log
# Also print output to stdout if output-file has been configured.
tee = True
################### FILE PATTERNS ##########################
# Provide a comma-separated list of glob patterns to exclude from checks.
exclude =
.env,
.venv,
.git,
# python cache
__pycache__,
# Provide a comma-separate list of glob patterns to include for checks.
filename =
*.py
################### LINTING ################################
########## ENVIRONMENT ##########
# Provide a custom list of builtin functions, objects, names, etc.
# builtins =
########## OPTIONS ##########
# Report all errors, even if it is on the same line as a `# NOQA` comment.
disable-noqa = False
# Set the maximum length that any line (with some exceptions) may be.
max-line-length = 79
# Set the maximum allowed McCabe complexity value for a block of code.
max-complexity = 10
# Toggle whether pycodestyle should enforce matching the indentation of the opening bracket’s line.
# incluences E131 and E133
hang-closing = True
########## RULES ##########
# ERROR CODES
#
# E/W - PEP8 errors/warnings (pycodestyle)
# F - linting errors (pyflakes)
# C - McCabe complexity error (mccabe)
#
# W503 - line break before binary operator
# Specify a list of codes to ignore.
# ignore =
# Specify the list of error codes you wish Flake8 to report.
select =
E,
W,
F,
C
# Enable off-by-default extensions.
# enable-extensions =
########## DOCSTRING ##########
# Enable PyFlakes syntax checking of doctests in docstrings.
doctests = True
# Specify which files are checked by PyFlakes for doctest syntax.
# include-in-doctest =
# Specify which files are not to be checked by PyFlakes for doctest syntax.
# exclude-in-doctest =
[isort]
# Maximum length (columns) for a line of program code.
line_length = 79
# Number of blank lines to separate imports from following statements.
lines_after_imports = 2
# Filenames that isort should not process.
# skip =
# Names of sections that group import statements.
# The order in this sequence specifies the order the sections should appear.
sections =
FUTURE
STDLIB
FRAMEWORK
THIRDPARTY
FIRSTPARTY
LOCALFOLDER
# Name of section for any import statement of a package not known to isort.
default_section = THIRDPARTY
# Package names that are known for the FRAMEWORK section.
known_framework = django, rest_framework
# Package names that are known for the THIRDPARTY section.
# known_third_party =
# Package names that are known for the FIRSTPARTY section.
known_first_party = users, product, management, core, scripts, utils, vendor, order
# Text for indentation of continuation lines.
indent = ' '
# The multi-line import statement style (integer code).
# See the isort documentation for the meaning of each code.
multi_line_output = 3
# Sort imports by length (not alphanumeric)?
length_sort = false
# Add a trailing comma on the list of from import names?
include_trailing_comma = true
# For continuation lines, wrap lines in parenthesis?
use_parentheses = true
# Sort from import statements before import statements?
# This is not the ideal behaviour; see the issue reported at
# <URL:https://github.com/timothycrosley/isort/issues/609>.
from_first = false
# Force multiple names imported with from to be separate statements?
force_single_line = false
# Force from imports to be grid wrapped regardless of line length?
force_grid_wrap = true
# Format import statements as a visually-balanced grid?
balanced_wrapping = false
# Combine an import as onto the same line?
combine_as_imports = true
Name: yapf
-- Files to Watch
File Type: Python
Scope: Project Files
-- Tools to Run on Changes
Program: $PyInterpreterDirectory$\python
Arguments: -m yapf -i $FilePath$
Output paths to refresh: $FilePath$
Working directory: $ProjectFileDir$
-- Advanced Options
Uncheck :
-[] Auto-save edited files to trigger the watcher
-[] Trigger the watcher on external changes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment