diff --git a/.flake8 b/.flake8 deleted file mode 100644 index 4994bd6..0000000 --- a/.flake8 +++ /dev/null @@ -1,16 +0,0 @@ -# See: -# -# https://pycodestyle.readthedocs.io/en/latest/intro.html#error-codes (E, W) -# https://flake8.pycqa.org/en/latest/user/error-codes.html (F) -# https://github.com/PyCQA/flake8-bugbear -# -# for error codes. And -# -# https://flake8.pycqa.org/en/latest/user/violations.html#selecting-violations-with-flake8 -# -# for error classes selected below. - -[flake8] -max-line-length = 88 -select = C,E,F,W,B,B950 -ignore = E501, W503 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 322f262..b616a7a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -21,22 +21,11 @@ repos: hooks: - id: black - - repo: https://github.com/PyCQA/flake8 - rev: 3.9.2 + - repo: https://github.com/charliermarsh/ruff-pre-commit + # Ruff version. + rev: "v0.0.191" hooks: - - id: flake8 - pass_filenames: true - - - repo: https://github.com/pycqa/isort - rev: 5.10.1 - hooks: - - id: isort - - - repo: https://github.com/asottile/pyupgrade - rev: v2.37.3 - hooks: - - id: pyupgrade - args: [--py38-plus] + - id: ruff - repo: https://github.com/pre-commit/mirrors-prettier rev: v2.7.1 diff --git a/pyproject.toml b/pyproject.toml index 95d41d4..32a2c05 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,3 +39,6 @@ Source = "https://github.com/scientific-python/yaml2ics" [tool.flit.sdist] exclude = ["tests/*"] + +[tool.ruff] +select = ["F", "E", "W", "I", "UP"] diff --git a/yaml2ics.py b/yaml2ics.py index a18e406..77ad7f3 100644 --- a/yaml2ics.py +++ b/yaml2ics.py @@ -33,8 +33,8 @@ def datetime2utc(date): # See RFC2445, 4.8.5 REcurrence Component Properties -# This function can be used to add a list of e.g. exception dates (EXDATE) or recurrence dates (RDATE) -# to a reoccurring event +# This function can be used to add a list of e.g. exception dates (EXDATE) or +# recurrence dates (RDATE) to a reoccurring event def add_recurrence_property( event: ics.Event, property_name, dates: map, tz: datetime.tzinfo = None ): @@ -76,7 +76,8 @@ def event_from_yaml(event_yaml: dict, tz: datetime.tzinfo = None) -> ics.Event: if not len(interval) == 1: print( - "Error: interval must specify seconds, minutes, hours, days, weeks, months, or years only", + "Error: interval must specify seconds, minutes, hours, days, " + "weeks, months, or years only", file=sys.stderr, ) sys.exit(-1) @@ -84,7 +85,8 @@ def event_from_yaml(event_yaml: dict, tz: datetime.tzinfo = None) -> ics.Event: interval_measure = list(interval.keys())[0] if interval_measure not in interval_type: print( - "Error: expected interval to be specified in seconds, minutes, hours, days, weeks, months, or years only", + "Error: expected interval to be specified in seconds, minutes, " + "hours, days, weeks, months, or years only", file=sys.stderr, ) sys.exit(-1) @@ -93,7 +95,8 @@ def event_from_yaml(event_yaml: dict, tz: datetime.tzinfo = None) -> ics.Event: print("Error: must specify end date for repeating events", file=sys.stderr) sys.exit(-1) - # This causes zero-length events, I guess overriding whatever duration might have been specified. + # This causes zero-length events, I guess overriding whatever duration + # might have been specified # event.end = d.get('end', None) rrule = dateutil.rrule.rrule(