Skip to content

Commit

Permalink
Fixed linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
coordt committed Feb 10, 2024
1 parent bde894d commit 9515afc
Show file tree
Hide file tree
Showing 37 changed files with 57 additions and 26 deletions.
9 changes: 3 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: 'v0.2.0'
rev: 'v0.2.1'
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
Expand Down Expand Up @@ -45,7 +45,7 @@ repos:
args: [--no-strict-optional, --ignore-missing-imports]
additional_dependencies: ["pydantic>2.0", "toml", "types-all"]
- repo: https://github.com/jsh9/pydoclint
rev: 0.3.9
rev: 0.4.0
hooks:
- id: pydoclint
args:
Expand All @@ -55,9 +55,6 @@ repos:
hooks:
- id: interrogate
exclude: test.*
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.27.4
hooks:
- id: check-azure-pipelines

ci:
autofix_prs: false
1 change: 1 addition & 0 deletions bumpversion/__main__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Main entrypoint for module."""

from bumpversion.cli import cli

cli()
1 change: 1 addition & 0 deletions bumpversion/aliases.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Utilities for handling command aliases."""

from typing import List, Optional

import rich_click as click
Expand Down
1 change: 1 addition & 0 deletions bumpversion/bump.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Version changing methods."""

import shlex
from pathlib import Path
from typing import TYPE_CHECKING, ChainMap, List, Optional
Expand Down
1 change: 1 addition & 0 deletions bumpversion/cli.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""bump-my-version Command line interface."""

from pathlib import Path
from typing import List, Optional

Expand Down
1 change: 1 addition & 0 deletions bumpversion/config/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Configuration management."""

from __future__ import annotations

from typing import TYPE_CHECKING, Union
Expand Down
1 change: 1 addition & 0 deletions bumpversion/config/models.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Bump My Version configuration models."""

from __future__ import annotations

import re
Expand Down
1 change: 1 addition & 0 deletions bumpversion/config/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Helper functions for the config module."""

from __future__ import annotations

import glob
Expand Down
1 change: 1 addition & 0 deletions bumpversion/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Custom exceptions for BumpVersion."""

from typing import Optional

from click import Context, UsageError
Expand Down
1 change: 1 addition & 0 deletions bumpversion/indented_logger.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""A logger adapter that adds an indent to the beginning of each message."""

import logging
from contextvars import ContextVar
from typing import Any, MutableMapping, Optional, Tuple
Expand Down
1 change: 1 addition & 0 deletions bumpversion/show.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Functions for displaying information about the version."""

import dataclasses
from io import StringIO
from pprint import pprint
Expand Down
1 change: 1 addition & 0 deletions bumpversion/ui.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Utilities for user interface."""

import logging

import click
Expand Down
1 change: 1 addition & 0 deletions bumpversion/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""General utilities."""

import datetime
import string
from collections import ChainMap
Expand Down
1 change: 1 addition & 0 deletions bumpversion/version_part.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module for managing Versions and their internal parts."""

import re
from typing import Any, Dict, List, MutableMapping, Optional, Tuple

Expand Down
1 change: 1 addition & 0 deletions bumpversion/versioning/conventions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Standard version conventions."""

from bumpversion.versioning.models import VersionComponentSpec, VersionSpec

# Adapted from https://packaging.python.org/en/latest/specifications/version-specifiers/
Expand Down
1 change: 1 addition & 0 deletions bumpversion/versioning/functions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Generators for version parts."""

import re
from typing import List, Optional, Union

Expand Down
1 change: 1 addition & 0 deletions bumpversion/versioning/models.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Models for managing versioning of software projects."""

from __future__ import annotations

from collections import defaultdict, deque
Expand Down
1 change: 1 addition & 0 deletions bumpversion/versioning/serialization.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Functions for serializing and deserializing version objects."""

import re
from copy import copy
from operator import itemgetter
Expand Down
1 change: 1 addition & 0 deletions bumpversion/visualize.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Visualize the bumpversion process."""

from dataclasses import dataclass
from typing import List, Optional

Expand Down
1 change: 1 addition & 0 deletions bumpversion/yaml_dump.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""A simple YAML dumper to avoid extra dependencies."""

import datetime
from collections import UserDict
from io import StringIO
Expand Down
1 change: 1 addition & 0 deletions docsrc/conf.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Sphinx configuration.
"""

# flake8: noqa
import os
import sys
Expand Down
39 changes: 19 additions & 20 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -147,22 +147,6 @@ color = true
line-length = 119

[tool.ruff]
# Enable pycodestyle (`E`) and Pyflakes (`F`) codes by default.
# "UP" "TRY" "PLR"
select = ["E", "W", "F", "I", "N", "B", "BLE", "C", "D", "E", "F", "I", "N", "S", "T", "W", "RUF", "NPY", "PD", "PGH", "ANN", "C90", "PLC", "PLE", "PLW", "TCH"]
ignore = [
"ANN002", "ANN003", "ANN101", "ANN102", "ANN204", "ANN401",
"S101", "S104",
"D105", "D106", "D107", "D200", "D212",
"PD011",
"PLW1510",
]

# Allow autofix for all enabled rules (when `--fix`) is provided.
fixable = ["E", "W", "F", "I", "N", "B", "BLE", "C", "D", "E", "F", "I", "N", "S", "T", "W", "RUF", "NPY", "PD", "PGH", "ANN", "C90", "PL", "PLC", "PLE", "PLW", "TCH"]
unfixable = []

# Exclude a variety of commonly ignored directories.
exclude = [
".bzr",
".direnv",
Expand All @@ -189,22 +173,37 @@ exclude = [
# Same as Black.
line-length = 119

[tool.ruff.lint]
select = ["E", "W", "F", "I", "N", "B", "BLE", "C", "D", "E", "F", "I", "N", "S", "T", "W", "RUF", "NPY", "PD", "PGH", "ANN", "C90", "PLC", "PLE", "PLW", "TCH"]
ignore = [
"ANN002", "ANN003", "ANN101", "ANN102", "ANN204", "ANN401",
"S101", "S104",
"D105", "D106", "D107", "D200", "D212",
"PD011",
"PLW1510",
]

fixable = ["E", "W", "F", "I", "N", "B", "BLE", "C", "D", "E", "F", "I", "N", "S", "T", "W", "RUF", "NPY", "PD", "PGH", "ANN", "C90", "PL", "PLC", "PLE", "PLW", "TCH"]
unfixable = []

# Exclude a variety of commonly ignored directories.

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

typing-modules = ["typing", "types", "typing_extensions", "mypy", "mypy_extensions"]

[tool.ruff.per-file-ignores]
[tool.ruff.lint.per-file-ignores]
"tests/*" = ["S101", "PLR0913", "PLR0915", "PGH003", "ANN001", "ANN202", "ANN201", "PLR0912", "TRY301", "PLW0603", "PLR2004", "ANN101", "S106", "TRY201", "ANN003", "ANN002", "S105", "TRY003"]

[tool.ruff.mccabe]
[tool.ruff.lint.mccabe]
# Unlike Flake8, default to a complexity level of 10.
max-complexity = 10

[tool.ruff.isort]
[tool.ruff.lint.isort]
order-by-type = true

[tool.ruff.pydocstyle]
[tool.ruff.lint.pydocstyle]
convention = "google"

[tool.bumpversion]
Expand Down
1 change: 1 addition & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Testing fixtures for Pytest."""

import subprocess
from contextlib import contextmanager
from pathlib import Path
Expand Down
1 change: 1 addition & 0 deletions tests/test_autocast.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for the autocast module."""

import pytest
from pytest import param

Expand Down
1 change: 1 addition & 0 deletions tests/test_bump.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for the bump module."""

from pathlib import Path
from textwrap import dedent
from unittest.mock import MagicMock, patch
Expand Down
1 change: 1 addition & 0 deletions tests/test_cli/test_bump.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests the bump CLI subcommand."""

import shutil
import subprocess
from datetime import datetime
Expand Down
1 change: 1 addition & 0 deletions tests/test_cli/test_replace.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for `bumpversion` package."""

import shutil
import traceback
from pathlib import Path
Expand Down
1 change: 1 addition & 0 deletions tests/test_cli/test_show_bump.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests the show_bump command."""

import shutil
from pathlib import Path

Expand Down
1 change: 1 addition & 0 deletions tests/test_config/test_create.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test the create function in the config module."""

from pathlib import Path
import pytest

Expand Down
1 change: 1 addition & 0 deletions tests/test_config/test_files.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test configuration parsing."""

import difflib
import json
from pathlib import Path
Expand Down
1 change: 1 addition & 0 deletions tests/test_configuredfile.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for the ConfiguredFile class."""

from bumpversion.files import ConfiguredFile, FileChange
from bumpversion.version_part import VersionConfig
from bumpversion.versioning.models import VersionComponentSpec
Expand Down
1 change: 1 addition & 0 deletions tests/test_files.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""File processing tests."""

import os
import shutil
from datetime import datetime, timezone
Expand Down
1 change: 1 addition & 0 deletions tests/test_scm.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests of the VCS module."""

import subprocess
from pathlib import Path

Expand Down
1 change: 1 addition & 0 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for the utils module."""

from itertools import combinations

import pytest
Expand Down
1 change: 1 addition & 0 deletions tests/test_versioning/test_serialization.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for the serialization of versioned objects."""

from bumpversion.versioning.serialization import parse_version, serialize
from bumpversion.versioning.conventions import semver_spec, SEMVER_PATTERN
from bumpversion.versioning.models import Version, VersionSpec, VersionComponentSpec
Expand Down
1 change: 1 addition & 0 deletions tests/test_visualize.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests of the visualize module."""

from pathlib import Path

from bumpversion.visualize import Border, BOX_CHARS, connection_str, lead_string, labeled_line, visualize
Expand Down
1 change: 1 addition & 0 deletions tests/test_yaml.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for the yaml serialization module."""

from pathlib import Path

from bumpversion import yaml_dump
Expand Down

0 comments on commit 9515afc

Please sign in to comment.