Skip to content

Commit

Permalink
Improve ruff config
Browse files Browse the repository at this point in the history
  • Loading branch information
jsoucheiron committed Feb 16, 2024
1 parent 93b2a42 commit 2b3eaeb
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
5 changes: 3 additions & 2 deletions cfripper/cli.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import logging
import re
import sys
from importlib.metadata import PackageNotFoundError, version
from io import TextIOWrapper
from pathlib import Path
from typing import Dict, List, Optional, Tuple
Expand All @@ -9,7 +10,6 @@
import pycfmodel
from pycfmodel.model.cf_model import CFModel

from cfripper.__version__ import __version__
from cfripper.config.config import Config
from cfripper.config.pluggy.utils import get_all_rules
from cfripper.exceptions import FileEmptyException
Expand All @@ -18,6 +18,7 @@
from cfripper.model.utils import convert_json_or_yaml_to_dict
from cfripper.rule_processor import RuleProcessor


LOGGING_LEVELS = {
"ERROR": logging.ERROR,
"WARNING": logging.WARNING,
Expand Down Expand Up @@ -145,7 +146,7 @@ def validate_aws_principals(ctx: click.Context, param: str, value: str) -> Optio


@click.command()
@click.version_option(prog_name="cfripper", version=__version__)
@click.version_option(prog_name="cfripper", version=version("package-name"))
@click.argument("templates", type=click.File("r"), nargs=-1)
@click.option(
"--resolve/--no-resolve",
Expand Down
19 changes: 19 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,25 @@ line-length = 120
indent-width = 4
target-version = "py38"

[tool.ruff.lint]
select = ["E", "F", "W", "A", "PLC", "PLE", "PLW", "I"]
ignore = ["A002", "E501"]

# Allow fix for all enabled rules (when `--fix`) is provided.
fixable = ["ALL"]
unfixable = []

# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"

[tool.ruff.format]
quote-style = "double"
indent-style = "space"
skip-magic-trailing-comma = false
line-ending = "auto"
docstring-code-format = false
docstring-code-line-length = "dynamic"

[tool.pytest.ini_options]
log_cli = true
log_level = "INFO"
Expand Down

0 comments on commit 2b3eaeb

Please sign in to comment.