Skip to content

Commit

Permalink
Merge pull request #26 from FlowerBlackG/xym
Browse files Browse the repository at this point in the history
CI: NPM Lint & Code-Style Check
  • Loading branch information
john-0u0 authored Jan 2, 2025
2 parents cc4705e + 7e7cad2 commit 0912b79
Show file tree
Hide file tree
Showing 3 changed files with 96 additions and 5 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/code-style-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Code Style Check

on:
push:
branches:
- main # 当代码推送到 main 分支时触发
pull_request:
branches:
- main # 当对 main 分支发起 Pull Request 时触发

jobs:
lint:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3 # 拉取代码仓库内容

- name: Set up Python environment
uses: actions/setup-python@v4 # 设置 Python 环境
with:
python-version: '3.10.13' # 指定 Python 版本

- name: Install flake8
run: pip install flake8 # 安装代码风格检测工具 flake8

- name: Run flake8
run: |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Upload flake8 report
if: failure()
uses: actions/upload-artifact@v3
with:
name: flake8-report
path: flake8-report.txt
50 changes: 50 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: CI

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '16'

- name: Install dependencies
run: |
npm install
- name: Run tests
run: |
npm test
lint:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '16'

- name: Install dependencies
run: |
npm install
- name: Run linter
run: |
npm run lint
14 changes: 9 additions & 5 deletions src/model_server/locator/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,15 @@ def load_model(model_path):


def normalize_string(s):


if not isinstance(s, if) return s
# 当检测到 s 含有 ' 时,进行转义
if s.find("'") != -1:
# if not isinstance(s, if) return s
# # 当检测到 s 含有 ' 时,进行转义
# if s.find("'") != -1:
# s = s.replace("'", "\'")
# return s
if not isinstance(s, str):
return s
# 当检测到 s 含有 ' 时,进行转义
if s.find("'") != -1:
s = s.replace("'", "\'")
return s

Expand Down

0 comments on commit 0912b79

Please sign in to comment.