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

add ESLint, PyLint, prettier, black, flake8, isort to pre-commit #102

Merged
merged 10 commits into from
Nov 19, 2023
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
27 changes: 27 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
module.exports = {
env: {
browser: true,
es2021: true,
},
extends: ["standard-with-typescript", "plugin:react/recommended"],
overrides: [
{
env: {
node: true,
},
files: [".eslintrc.{js,cjs}"],
parserOptions: {
sourceType: "script",
},
},
],
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
},
plugins: ["react"],
rules: {
"react/jsx-uses-react": "error",
"react/jsx-uses-vars": "error",
},
};
2 changes: 2 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[flake8]
max-line-length = 120
4 changes: 1 addition & 3 deletions .github/ISSUE_TEMPLATE/BUG-REPORT.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
name: "🐛 Bug Report"
description: Create a new ticket for a bug.
title: "🐛 [BUG] - <title>"
labels: [
"bug"
]
labels: ["bug"]
body:
- type: textarea
id: description
Expand Down
4 changes: 1 addition & 3 deletions .github/ISSUE_TEMPLATE/FEATURE-REQUEST.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
name: "💡 Feature Request"
description: Create a new ticket for a new feature request
title: "💡 [REQUEST] - <title>"
labels: [
"question"
]
labels: ["question"]
body:
- type: input
id: start_date
Expand Down
12 changes: 12 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# Pull Request Template

## Type of Change

<!-- What type of change does your code introduce? -->

- [ ] New feature
- [ ] Bug fix
- [ ] Documentation
Expand All @@ -13,21 +15,31 @@
- Fixes #[Add issue number here.]

## Changes

<!-- Describe your changes in detail, if applicable. -->

_Describe what this Pull Request does_

## Testing

<!-- Describe how the changes can be tested -->

_Describe the testing that has been done or needs to be done_

## Screenshots

<!-- If applicable, add screenshots to help explain your changes -->

_Add any relevant screenshots_

## Dependencies

<!-- List any dependencies that are required for this change -->

_List dependencies_

## Breaking Changes

<!-- Does this PR contain any breaking changes? -->

_Describe any breaking changes_
65 changes: 33 additions & 32 deletions .github/actions/merge-branch/action.yml
Original file line number Diff line number Diff line change
@@ -1,58 +1,59 @@
---
#------------------------------------------------------------------------------
# Run pre-commit
#------------------------------------------------------------------------------
name: Merge
branding:
icon: 'git-pull-request'
color: 'orange'
icon: "git-pull-request"
color: "orange"
inputs:
github-token:
description: 'The GitHub token to use for authentication'
description: "The GitHub token to use for authentication"
required: true
type: string
source-branch:
description: 'The branch to merge from'
description: "The branch to merge from"
required: false
type: string
default: 'main'
default: "main"
target-branch:
description: 'The branch to merge to'
description: "The branch to merge to"
required: true
type: string

python-version:
description: 'The version of Python to use, such as 3.11.0'
description: "The version of Python to use, such as 3.11.0"
required: true
type: string

runs:
using: "composite"
steps:
- name: Checkout code
id: checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- name: Checkout code
id: checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false

- name: Remember current branch
shell: bash
run: |
echo "CURRENT_BRANCH=$(git branch --show-current)" >> $GITHUB_ENV
- name: Remember current branch
shell: bash
run: |
echo "CURRENT_BRANCH=$(git branch --show-current)" >> $GITHUB_ENV

- name: Merge
id: merge
shell: bash
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git checkout ${{ inputs.source-branch }}
git pull
git checkout ${{ inputs.target-branch }}
git merge -Xtheirs ${{ inputs.source-branch }}
git push https://${{ inputs.github-token }}@github.com/${{ github.repository }}.git HEAD:${{ inputs.target-branch }}
- name: Merge
id: merge
shell: bash
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git checkout ${{ inputs.source-branch }}
git pull
git checkout ${{ inputs.target-branch }}
git merge -Xtheirs ${{ inputs.source-branch }}
git push https://${{ inputs.github-token }}@github.com/${{ github.repository }}.git HEAD:${{ inputs.target-branch }}

- name: Checkout current branch
shell: bash
run: |
git checkout ${{ env.CURRENT_BRANCH }}
- name: Checkout current branch
shell: bash
run: |
git checkout ${{ env.CURRENT_BRANCH }}
97 changes: 49 additions & 48 deletions .github/actions/tests/pre-commit/action.yml
Original file line number Diff line number Diff line change
@@ -1,68 +1,69 @@
---
#------------------------------------------------------------------------------
# Run pre-commit
#------------------------------------------------------------------------------
name: Test pre-commit
branding:
icon: 'git-pull-request'
color: 'orange'
icon: "git-pull-request"
color: "orange"
inputs:
python-version:
description: 'The version of Python to use, such as 3.11.0'
description: "The version of Python to use, such as 3.11.0"
required: true
type: string

runs:
using: "composite"
steps:
- name: Checkout code
id: checkout
uses: actions/checkout@v4
- name: Checkout code
id: checkout
uses: actions/checkout@v4

- name: Check for pre-commit in requirements
shell: bash
run: |
if ! grep -q "pre-commit" ./requirements.txt; then
echo "pre-commit not found in requirements.txt" >&2
exit 1
fi
- name: Check for pre-commit in requirements
shell: bash
run: |
if ! grep -q "pre-commit" ./requirements.txt; then
echo "pre-commit not found in requirements.txt" >&2
exit 1
fi

- name: Check for black in requirements
shell: bash
run: |
if ! grep -q "black" ./requirements.txt; then
echo "black not found in requirements.txt" >&2
exit 1
fi
- name: Check for black in requirements
shell: bash
run: |
if ! grep -q "black" ./requirements.txt; then
echo "black not found in requirements.txt" >&2
exit 1
fi

- name: Check for flake8 in requirements
shell: bash
run: |
if ! grep -q "flake8" ./requirements.txt; then
echo "flake8 not found in requirements.txt" >&2
exit 1
fi
- name: Check for flake8 in requirements
shell: bash
run: |
if ! grep -q "flake8" ./requirements.txt; then
echo "flake8 not found in requirements.txt" >&2
exit 1
fi

- name: Check for flake8-coding in requirements
shell: bash
run: |
if ! grep -q "flake8-coding" ./requirements.txt; then
echo "flake8-coding not found in requirements.txt" >&2
exit 1
fi
- name: Check for flake8-coding in requirements
shell: bash
run: |
if ! grep -q "flake8-coding" ./requirements.txt; then
echo "flake8-coding not found in requirements.txt" >&2
exit 1
fi

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ inputs.python-version }}
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ inputs.python-version }}

- name: Install dependencies
shell: bash
run: |
python -m pip install --upgrade pip
pip install -r ./requirements.txt
- name: Install dependencies
shell: bash
run: |
python -m pip install --upgrade pip
pip install -r ./requirements.txt

# see: https://pre-commit.ci/lite.html
- name: pre-commit ci
id: pre-commit-ci
if: always()
uses: pre-commit-ci/[email protected]
# see: https://pre-commit.ci/lite.html
- name: pre-commit ci
id: pre-commit-ci
if: always()
uses: pre-commit-ci/[email protected]
Loading
Loading