Skip to content

Commit

Permalink
Add: 他言語のlintのWorkflowを追加 (#598)
Browse files Browse the repository at this point in the history
Co-authored-by: qryxip <qryxip@users.noreply.github.com>
  • Loading branch information
sevenc-nanashi and qryxip committed Sep 14, 2023
1 parent 1b8fe84 commit 15ea155
Show file tree
Hide file tree
Showing 10 changed files with 84 additions and 21 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/java_lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: "Lint Java code"

on:
push:
branches:
- main
pull_request:
paths:
- ./crates/voicevox_core_java_api/**/*.java
- ./crates/voicevox_core_java_api/gradle/**
- ./crates/voicevox_core_java_api/gradlew
- ./crates/voicevox_core_java_api/settings.gradle
- ./.github/workflows/java_lint.yml

defaults:
run:
shell: bash
working-directory: ./crates/voicevox_core_java_api

jobs:
java-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v2
with:
java-version: "11"
distribution: "adopt"
- name: Check code style
run: |
./gradlew spotlessCheck --info
40 changes: 40 additions & 0 deletions .github/workflows/python_lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: "Lint Python code"

on:
push:
branches:
- main
pull_request:
paths:
- ./example/python/**/*.py
- ./crates/voicevox_core_python_api/**/*.py
- ./crates/voicevox_core_python_api/requirements*.txt
- ./crates/voicevox_core_python_api/pyproject.toml
- ./.github/workflows/python_lint.yml

defaults:
run:
shell: bash
working-directory: ./crates/voicevox_core_python_api

jobs:
python:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.8"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt
- name: Check code style for voicevox_core_python_api
run: |
black --check .
isort --check .
- name: Check code style for example/python
working-directory: ./example/python
run: |
black --check .
isort --check .
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ public boolean isLoadedVoiceModel(String voiceModelId) {
* @param text テキスト。
* @param styleId スタイルID。
* @return {@link CreateAudioQueryConfigurator}。
*
* @see CreateAudioQueryConfigurator#execute
*/
@Nonnull
Expand All @@ -69,7 +68,6 @@ public CreateAudioQueryConfigurator createAudioQuery(String text, int styleId) {
* @param text テキスト。
* @param styleId スタイルID。
* @return {@link CreateAccentPhrasesConfigurator}。
*
* @see CreateAccentPhrasesConfigurator#execute
*/
@Nonnull
Expand Down Expand Up @@ -137,7 +135,6 @@ public List<AccentPhrase> replaceMoraPitch(List<AccentPhrase> accentPhrases, int
* @param audioQuery {@link AudioQuery}。
* @param styleId スタイルID。
* @return {@link SynthesisConfigurator}。
*
* @see SynthesisConfigurator#execute
*/
@Nonnull
Expand All @@ -151,7 +148,6 @@ public SynthesisConfigurator synthesis(AudioQuery audioQuery, int styleId) {
* @param text テキスト。
* @param styleId スタイルID。
* @return {@link TtsConfigurator}。
*
* @see TtsConfigurator#execute
*/
@Nonnull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import com.google.gson.internal.LinkedTreeMap;
import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.Min;

import java.lang.ref.Cleaner;
import java.util.HashMap;
import javax.annotation.Nonnull;
Expand Down Expand Up @@ -177,7 +176,7 @@ public static class Word {
/**
* UserDict.Wordを作成する。
*
* @param surface 言葉の表層形。
* @param surface 言葉の表層形。
* @param pronunciation 言葉の発音。
* @throws IllegalArgumentException pronunciationが不正な場合。
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
# AudioQueryのkanaを比較して変化するかどうかで判断する。

from uuid import UUID
import pytest

import conftest # noqa: F401
import pytest
import voicevox_core # noqa: F401


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
# どのコードがどの操作を行っているかはコメントを参照。

import os
from uuid import UUID
import tempfile
from uuid import UUID

import pytest
import voicevox_core # noqa: F401

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@
UserDictWord,
UserDictWordType,
)
from ._rust import (
__version__,
from ._rust import ( # noqa: F401
OpenJtalk,
Synthesizer,
UserDict,
VoiceModel,
VoicevoxError,
UserDict,
__version__,
supported_devices,
) # noqa: F401
)

__all__ = [
"__version__",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import pydantic

from ._rust import _validate_pronunciation, _to_zenkaku
from ._rust import _to_zenkaku, _validate_pronunciation


@pydantic.dataclasses.dataclass
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from pathlib import Path
from typing import Dict, Final, List, Literal, Union, TYPE_CHECKING
from typing import TYPE_CHECKING, Dict, Final, List, Literal, Union
from uuid import UUID

import numpy as np
Expand Down
9 changes: 2 additions & 7 deletions example/python/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,8 @@
from typing import Tuple

import voicevox_core
from voicevox_core import (
AccelerationMode,
AudioQuery,
OpenJtalk,
Synthesizer,
VoiceModel,
)
from voicevox_core import (AccelerationMode, AudioQuery, OpenJtalk,
Synthesizer, VoiceModel)


async def main() -> None:
Expand Down

0 comments on commit 15ea155

Please sign in to comment.