Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate pre-commit #3592

Merged
merged 7 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ body:
value: |
⚠️ Do not open issues for Windows executables not working in Bottles, if not installed through our installers. Bottles is a Wine prefix manager. If a Windows application doesn't work, it could be a Wine problem or a misconfiguration of the Wine prefix. Please visit [WineHQ](https://www.winehq.org) and [ProtonDB](https://www.protondb.com) for more information on the software you are trying to run. For additional support, use the [Programs](https://github.com/bottlesdevs/programs) repository.
⚠️ Do not open issues for bugs outside of [Bottles on Flathub](https://flathub.org/apps/details/com.usebottles.bottles), as we do not support packages from third-party repositories. If you can reproduce the bug(s) using Bottles on Flathub, then we will provide support, otherwise we will close the issue.
- type: textarea
id: what-happened
attributes:
Expand Down
4 changes: 2 additions & 2 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Description
Please include a summary of the change and which issue is fixed (if available).
Please include a summary of the change and which issue is fixed (if available).
Please also include relevant motivation and context.

Fixes #(issue)
Expand All @@ -11,7 +11,7 @@ Fixes #(issue)
- [ ] This change requires a documentation update

# How Has This Been Tested?
Please describe the tests that you ran to verify your changes.
Please describe the tests that you ran to verify your changes.
Provide instructions so we can reproduce.
- [ ] Test A
- [ ] Test B
14 changes: 14 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: pre-commit

on:
pull_request:
push:
branches: [main]

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: pre-commit/[email protected]
37 changes: 0 additions & 37 deletions .github/workflows/pylint-checker.yml

This file was deleted.

54 changes: 0 additions & 54 deletions .github/workflows/pylint-commenter.yml

This file was deleted.

28 changes: 0 additions & 28 deletions .github/workflows/pytest.yml

This file was deleted.

33 changes: 33 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-xml
# - id: check-json
# - id: pretty-format-json
# args: ["--autofix", "--no-sort-keys", "--indent", "4"]
- id: check-added-large-files

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.2
hooks:
# - id: ruff
# args: [ "--fix" ]
- id: ruff-format

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.13.0
hooks:
- id: mypy
args: ["--pretty"]
additional_dependencies: ["pygobject-stubs", "types-PyYAML", "types-Markdown", "types-requests", "types-pycurl", "types-chardet", "pytest-stub", "types-orjson", "pathvalidate", "requirements-parser"]

- repo: https://github.com/PyCQA/autoflake
rev: v2.3.1
hooks:
- id: autoflake
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@
"request": "attach"
}
]
}
}
2 changes: 1 addition & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@
"type": "shell"
}
]
}
}
1 change: 0 additions & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,4 +123,3 @@ Additional language was incorporated and modified from the following Codes of Co
* [Mozilla Community Participation Guidelines](https://www.mozilla.org/en-US/about/governance/policies/participation/) is licensed [Creative Commons Attribution-ShareAlike 3.0 Unported License](https://creativecommons.org/licenses/by-sa/3.0/).
* [Python Mentors Code of Conduct](http://pythonmentors.com/)
* [Speak Up! Community Code of Conduct](http://web.archive.org/web/20141109123859/http://speakup.io/coc.html), licensed under a [Creative Commons Attribution 3.0 Unported License](http://creativecommons.org/licenses/by/3.0/)

6 changes: 3 additions & 3 deletions CODING_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ python ./utils/flatpak-pip-generator.py --runtime org.gnome.Sdk -r requirements.

### `po/POTFILES`

List of source files containing translatable strings.
List of source files containing translatable strings.
Regenerate this file when you added/moved/removed/renamed files
that contains translatable strings.

Expand All @@ -59,8 +59,8 @@ EOF

### `po/bottles.pot` and `po/*.po`

We have a main pot file, which is template for other `.po` files
And for each language listed in `po/LINGUAS` we have a corresponding `.po` file
We have a main pot file, which is template for other `.po` files
And for each language listed in `po/LINGUAS` we have a corresponding `.po` file
Regenerate these files when any translatable string added/changed/removed

```bash
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
<hr />

<a href="https://docs.usebottles.com">Documentation</a> ·
<a href="https://forum.usebottles.com">Forums</a> ·
<a href="https://discord.gg/wF4JAdYrTR">Discord</a> ·
<a href="https://forum.usebottles.com">Forums</a> ·
<a href="https://discord.gg/wF4JAdYrTR">Discord</a> ·
<a href="https://usebottles.com/funding">Funding</a>
</div>

Expand Down
1 change: 0 additions & 1 deletion bottles/backend/globals.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

import os
import shutil
from functools import lru_cache
from pathlib import Path
from typing import Dict
from bottles.backend.utils import yaml, json
Expand Down
3 changes: 1 addition & 2 deletions bottles/backend/managers/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import shutil
import tarfile
from functools import lru_cache
from typing import Union, Optional
from typing import Optional

import pycurl

Expand All @@ -45,7 +45,6 @@

# noinspection PyTypeChecker
class ComponentManager:

def __init__(self, manager, offline: bool = False):
self.__manager = manager
self.__repo = manager.repository_manager.get_repo("components", offline)
Expand Down
1 change: 0 additions & 1 deletion bottles/backend/managers/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@


class ConfigManager(object):

def __init__(
self,
config_file: Optional[str] = None,
Expand Down
1 change: 0 additions & 1 deletion bottles/backend/managers/dependency.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@


class DependencyManager:

def __init__(self, manager, offline: bool = False):
self.__manager = manager
self.__repo = manager.repository_manager.get_repo("dependencies", offline)
Expand Down
1 change: 0 additions & 1 deletion bottles/backend/managers/epicgamesstore.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@


class EpicGamesStoreManager:

@staticmethod
def find_dat_path(config: BottleConfig) -> Union[str, None]:
"""
Expand Down
1 change: 0 additions & 1 deletion bottles/backend/managers/importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@


class ImportManager:

def __init__(self, manager):
self.manager = manager

Expand Down
1 change: 0 additions & 1 deletion bottles/backend/managers/installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@


class InstallerManager:

def __init__(self, manager, offline: bool = False):
self.__manager = manager
self.__repo = manager.repository_manager.get_repo("installers", offline)
Expand Down
1 change: 0 additions & 1 deletion bottles/backend/managers/origin.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@


class OriginManager:

@staticmethod
def find_manifests_path(config: BottleConfig) -> Union[str, None]:
"""
Expand Down
1 change: 0 additions & 1 deletion bottles/backend/managers/runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@


class RuntimeManager:

@staticmethod
@lru_cache
def get_runtimes(_filter: str = "bottles"):
Expand Down
1 change: 0 additions & 1 deletion bottles/backend/managers/sandbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@


class SandboxManager:

def __init__(
self,
envs: Optional[dict] = None,
Expand Down
1 change: 0 additions & 1 deletion bottles/backend/managers/steamgriddb.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@


class SteamGridDBManager:

@staticmethod
def get_game_grid(name: str, config: BottleConfig):
try:
Expand Down
1 change: 0 additions & 1 deletion bottles/backend/managers/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@


class TemplateManager:

@staticmethod
def new(env: str, config: BottleConfig):
env = env.lower()
Expand Down
1 change: 0 additions & 1 deletion bottles/backend/managers/thumbnail.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@


class ThumbnailManager:

@staticmethod
def get_path(config: BottleConfig, uri: str):
if uri.startswith("grid:"):
Expand Down
1 change: 0 additions & 1 deletion bottles/backend/managers/ubisoftconnect.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@


class UbisoftConnectManager:

@staticmethod
def find_conf_path(config: BottleConfig) -> Union[str, None]:
"""
Expand Down
1 change: 0 additions & 1 deletion bottles/backend/models/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

# noinspection PyDataclass
class DictCompatMixIn:

@staticmethod
def yaml_serialize_handler(dumper, data):
dict_repr = data.to_dict()
Expand Down
1 change: 0 additions & 1 deletion bottles/backend/utils/display.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class DisplayUtils:

@staticmethod
@lru_cache
def get_x_display():
Expand Down
3 changes: 2 additions & 1 deletion bottles/backend/utils/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from typing import Union
from array import array


class FileUtils:
"""
This class provide some useful methods to work with files.
Expand Down Expand Up @@ -124,7 +125,7 @@ def chattr_f(directory: str) -> bool:
if os.path.isdir(directory) and len(os.listdir(directory)) == 0:
fd = os.open(directory, os.O_RDONLY)
try:
arg = array('L', [0])
arg = array("L", [0])
fcntl.ioctl(fd, FS_IOC_GETFLAGS, arg, True)
arg[0] |= FS_CASEFOLD_FL
fcntl.ioctl(fd, FS_IOC_SETFLAGS, arg, True)
Expand Down
Loading
Loading