Skip to content

Commit

Permalink
Fixed linting
Browse files Browse the repository at this point in the history
  • Loading branch information
coordt committed Feb 9, 2024
1 parent c8781e0 commit 94a4b7a
Show file tree
Hide file tree
Showing 46 changed files with 63 additions and 19 deletions.
1 change: 1 addition & 0 deletions cookie_composer/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
"""The Cookiecutter Composer."""

__version__: str = "0.12.0"
1 change: 1 addition & 0 deletions cookie_composer/authentication.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""OAuth2 authentication to access protected resources."""

import json
from pathlib import Path
from typing import Optional
Expand Down
1 change: 1 addition & 0 deletions cookie_composer/cc_overrides.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""This overrides the default cookie cutter environment."""

import json
from typing import Any, List, MutableMapping, Optional

Expand Down
1 change: 1 addition & 0 deletions cookie_composer/cli.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Command line setup."""

import logging
from collections import OrderedDict
from pathlib import Path
Expand Down
1 change: 1 addition & 0 deletions cookie_composer/commands/add.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""The implementation of the add command."""

import logging
from pathlib import Path
from typing import Any, MutableMapping, Optional
Expand Down
1 change: 1 addition & 0 deletions cookie_composer/commands/authn.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Authentication subcommands."""

import sys

import rich_click as click
Expand Down
1 change: 1 addition & 0 deletions cookie_composer/commands/link.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""The implementation of the link command."""

from pathlib import Path
from typing import Any, MutableMapping, Optional

Expand Down
1 change: 1 addition & 0 deletions cookie_composer/commands/update.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""The implementation of the update command."""

from pathlib import Path
from tempfile import TemporaryDirectory
from typing import List, Optional
Expand Down
1 change: 1 addition & 0 deletions cookie_composer/composition.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Project configuration and options."""

import logging
from typing import Any, Dict, List, Optional

Expand Down
1 change: 1 addition & 0 deletions cookie_composer/data_merge.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tools for merging data."""

import copy
import logging
from collections import ChainMap, OrderedDict
Expand Down
1 change: 1 addition & 0 deletions cookie_composer/diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Nabbed from Cruft: https://github.com/cruft/cruft/
"""

from pathlib import Path
from re import sub
from subprocess import PIPE, run # nosec
Expand Down
1 change: 1 addition & 0 deletions cookie_composer/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Exceptions raised when bad things happen."""

from typing import Optional

from click.exceptions import UsageError
Expand Down
1 change: 1 addition & 0 deletions cookie_composer/git_commands.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Functions for using git."""

import logging
import shutil
import subprocess
Expand Down
1 change: 1 addition & 0 deletions cookie_composer/io.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Functions for handling input/output operations."""

import copy
from pathlib import Path
from typing import Any, List, MutableMapping, Optional, Union
Expand Down
1 change: 1 addition & 0 deletions cookie_composer/matching.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Matching files and patterns."""

from fnmatch import fnmatch
from pathlib import Path
from typing import List, Union
Expand Down
1 change: 1 addition & 0 deletions cookie_composer/merge_files/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def merge_generic_files(origin: Path, destination: Path, merge_strategy: str):
The function must wrap any errors into a :py:exc:`~cookie_composer.exceptions.MergeError` and raise it.
"""

from pathlib import Path
from typing import Callable, Dict

Expand Down
1 change: 1 addition & 0 deletions cookie_composer/merge_files/ini_file.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Merge two .ini files into one."""

import configparser
from collections import defaultdict
from pathlib import Path
Expand Down
1 change: 1 addition & 0 deletions cookie_composer/merge_files/json_file.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Merge two json files into one."""

from pathlib import Path
from typing import Any

Expand Down
1 change: 1 addition & 0 deletions cookie_composer/merge_files/toml_file.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Merge two toml files into one."""

from pathlib import Path

import toml
Expand Down
1 change: 1 addition & 0 deletions cookie_composer/templates/git_repo.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Utility functions for handling and fetching repo archives in git format."""

import logging
import shutil
from pathlib import Path
Expand Down
1 change: 1 addition & 0 deletions cookie_composer/templates/source.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Entry point for cookiecutter templates."""

from pathlib import Path
from typing import Optional, Tuple
from urllib.parse import urlparse
Expand Down
1 change: 1 addition & 0 deletions cookie_composer/templates/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Templates are a representation of source templates used to generate projects.
"""

import json
import shutil
import tempfile
Expand Down
1 change: 1 addition & 0 deletions cookie_composer/templates/zipfile_repo.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Utility functions for handling and fetching repo archives in zip format."""

import os
import tempfile
from pathlib import Path
Expand Down
1 change: 1 addition & 0 deletions cookie_composer/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Utilities not easily categorized."""

import os
import stat
from contextlib import contextmanager
Expand Down
3 changes: 2 additions & 1 deletion docsrc/conf.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
"""
Sphinx configuration.
"""

import os
import sys
from datetime import date

sys.path.insert(0, os.path.abspath(".."))

import cookie_composer # NOQA: E402
import cookie_composer

project = "Cookie Composer"
author = "Corey Oordt"
Expand Down
35 changes: 17 additions & 18 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -148,20 +148,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", "S603",
"D106", "D107", "D200", "D212",
"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",
Expand Down Expand Up @@ -189,12 +175,25 @@ exclude = [
# Same as Black.
line-length = 119


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

# 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 = []

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", "S603",
"D106", "D107", "D200", "D212",
"PLW1510",
]
typing-modules = ["typing", "types", "typing_extensions", "mypy", "mypy_extensions"]

[tool.ruff.per-file-ignores]
[tool.ruff.lint.per-file-ignores]
"tests/*" = [
"ANN001",
"ANN002",
Expand All @@ -220,14 +219,14 @@ typing-modules = ["typing", "types", "typing_extensions", "mypy", "mypy_extensio
]
"cookie_composer/cc_overrides.py" = ["C901"]

[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 configuration."""

import shutil
from pathlib import Path

Expand Down
1 change: 1 addition & 0 deletions tests/templates/test_git_repo.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test for git_repo template."""

from pathlib import Path

from git import Repo
Expand Down
1 change: 1 addition & 0 deletions tests/templates/test_source.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for the templates.source module."""

from typing import Tuple

from cookiecutter.config import get_user_config
Expand Down
1 change: 1 addition & 0 deletions tests/templates/test_types.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for the template types module."""

import pytest
from pytest import param

Expand Down
1 change: 1 addition & 0 deletions tests/test_authentication.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Authentication tests."""

import json
import os
from typing import Optional
Expand Down
1 change: 1 addition & 0 deletions tests/test_cc_overrides.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests of the cc_overrides module."""

import platform
from collections import OrderedDict

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

import os
import shutil
from pathlib import Path
Expand Down
1 change: 1 addition & 0 deletions tests/test_commands/test_create.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for the commands.create module."""

import os

from cookie_composer.commands import create
Expand Down
1 change: 1 addition & 0 deletions tests/test_commands/test_link.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test the link command."""

import shutil
from pathlib import Path

Expand Down
1 change: 1 addition & 0 deletions tests/test_commands/test_update.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test the update command."""

import os
import re
import shutil
Expand Down
1 change: 1 addition & 0 deletions tests/test_diff.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for the diff module."""

from pathlib import Path
from typing import Tuple

Expand Down
1 change: 1 addition & 0 deletions tests/test_git_commands.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for cookie_composer.git_commands."""

from pathlib import Path
from typing import Optional

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

from pathlib import Path
from typing import Tuple

Expand Down
1 change: 1 addition & 0 deletions tests/test_layers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test layer rendering."""

import json
import os
from collections import OrderedDict
Expand Down
1 change: 1 addition & 0 deletions tests/test_merge_files_helpers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test the merge_files.helpers functions."""

from collections import OrderedDict
from typing import Any

Expand Down
1 change: 1 addition & 0 deletions tests/test_merge_files_ini_file.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test merging INI files."""

import configparser
import shutil
from io import StringIO
Expand Down
1 change: 1 addition & 0 deletions tests/test_merge_files_json_file.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test merging JSON files."""

import json
import shutil

Expand Down
1 change: 1 addition & 0 deletions tests/test_merge_files_toml_file.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test merging TOML files."""

import shutil

import pytest
Expand Down
1 change: 1 addition & 0 deletions tests/test_merge_files_yaml_file.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test merging YAML files."""

import shutil

import pytest
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 pathlib import Path

import pytest
Expand Down

0 comments on commit 94a4b7a

Please sign in to comment.