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

feat: linter formatter #32

Merged
merged 9 commits into from
Jan 2, 2025
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
60 changes: 60 additions & 0 deletions .cspell.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{
"words": [
"amannn",
"appdir",
"argcomplete",
"bierner",
"blockinfile",
"bpruitt",
"ccache",
"charliermarsh",
"containerd",
"customizer",
"cyclonedds",
"danielrichter",
"dconf",
"dotenvx",
"exfatprogs",
"fcitx",
"fdisk",
"flameshot",
"gparted",
"hardinfo",
"hwclock",
"insertafter",
"isort",
"jorgebucaran",
"keeweb",
"keymap",
"keyrings",
"kolourpaint",
"libfuse",
"libxcb",
"lichtblick",
"lineinfile",
"localectl",
"logind",
"mozc",
"ncdu",
"nemo",
"nsswitch",
"orbstack",
"pipx",
"pytest",
"rerunfailures",
"rustup",
"shellcheck",
"shellenv",
"shfmt",
"SHLVL",
"sqlitebrowser",
"usbubuntu",
"usbuntu",
"vcstool",
"venv",
"winbind",
"XMODIFIERS",
"xset",
"zstd"
]
}
11 changes: 7 additions & 4 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@ root = true
charset = utf-8
end_of_line = lf
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true

[*.yml]
indent_size = 2
[*.md]
trim_trailing_whitespace = false

[*.py]
indent_size = 4
13 changes: 13 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
## Types of PR

- [ ] New Features
- [ ] Upgrade of existing features
- [ ] Bugfix

## Description

## How to review this PR

All required checks by github actions have been passed.

## Others
16 changes: 16 additions & 0 deletions .github/workflows/lint-pull-request.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: lint-pull-request

on:
pull_request_target:
types:
- opened
- edited
- synchronize

jobs:
lint-pull-request:
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19 changes: 19 additions & 0 deletions .github/workflows/pre-commit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: pre-commit

on:
pull_request:
workflow_dispatch:

jobs:
pre-commit:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5

- name: Run pre-commit
uses: pre-commit/[email protected]
14 changes: 14 additions & 0 deletions .github/workflows/spell-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: spell-check

on:
pull_request:
workflow_dispatch:

jobs:
spell-check:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Run spell-check
uses: streetsidesoftware/cspell-action@v6
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
.vscode/
11 changes: 11 additions & 0 deletions .markdownlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# See https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md for all rules.
default: true
MD013: false
MD024:
siblings_only: true
MD029:
style: ordered
MD033: false
MD041: false
MD046: false
MD049: false
52 changes: 52 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
ci:
autofix_commit_msg: "style(pre-commit): autofix"

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-json
- id: check-merge-conflict
- id: check-toml
- id: check-xml
- id: check-yaml
args: [--unsafe]
- id: detect-private-key
- id: end-of-file-fixer
- id: mixed-line-ending
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md]

- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.43.0
hooks:
- id: markdownlint
args: [-c, .markdownlint.yaml, --fix]

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.1.0
hooks:
- id: prettier

- repo: https://github.com/adrienverge/yamllint
rev: v1.35.1
hooks:
- id: yamllint

- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.10.0.1
hooks:
- id: shellcheck

- repo: https://github.com/scop/pre-commit-shfmt
rev: v3.10.0-2
hooks:
- id: shfmt
args: [-w, -s, -i=4]

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.0 # Match the version used by the vscode extension. Otherwise, the editor and the command may say different things.
hooks:
- id: ruff
args: [--fix]
- id: ruff-format
1 change: 1 addition & 0 deletions .shellcheckrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
disable=SC1071
12 changes: 12 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"recommendations": [
"charliermarsh.ruff",
"bierner.markdown-mermaid",
"bpruitt-goddard.mermaid-markdown-syntax-highlighting"
],
"unwantedRecommendations": [
"ms-python.isort",
"ms-python.black-formatter",
"ms-python.flake8"
]
}
29 changes: 29 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"cSpell.languageSettings": [
{
"languageId": "c,cpp,python",
"allowCompoundWords": false
}
],
"editor.formatOnSave": false,
"[python]": {
"editor.tabSize": 4,
"editor.formatOnType": true,
"editor.formatOnPaste": false,
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll": "explicit",
"source.organizeImports": "explicit",
"source.organizeImports.ruff": "explicit"
},
"editor.defaultFormatter": "charliermarsh.ruff"
},
"python.autoComplete.extraPaths": [
"${workspaceFolder}/.venv/lib/**/site-packages/",
"${workspaceFolder}/projects/**/src/"
],
"python.analysis.extraPaths": [
"${workspaceFolder}/.venv/lib/**/site-packages/",
"${workspaceFolder}/projects/**/src/"
]
}
22 changes: 22 additions & 0 deletions .yamllint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
extends: default

ignore: |
*.param.yaml

rules:
braces:
level: error
max-spaces-inside: 1 # To format with Prettier
comments:
level: error
min-spaces-from-content: 1 # To be compatible with C++ and Python
document-start:
level: error
present: false # Don't need document start markers
line-length: disable # Delegate to Prettier
truthy:
level: error
check-keys: false # To allow 'on' of GitHub Actions
quoted-strings:
level: error
required: only-when-needed # To keep consistent style
1 change: 0 additions & 1 deletion ansible/mac.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
---
- name: setup local machine
hosts: localhost
connection: local
Expand Down
10 changes: 4 additions & 6 deletions ansible/roles/browser/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@

- name: brave apt key
become: yes
become: true
block:
- ansible.builtin.get_url:
url: https://brave-browser-apt-release.s3.brave.com/brave-browser-archive-keyring.gpg
dest: /usr/share/keyrings/brave-browser-archive-keyring.gpg

- ansible.builtin.apt_repository:
repo: "deb [signed-by=/usr/share/keyrings/brave-browser-archive-keyring.gpg] https://brave-browser-apt-release.s3.brave.com/ stable main"
repo: deb [signed-by=/usr/share/keyrings/brave-browser-archive-keyring.gpg] https://brave-browser-apt-release.s3.brave.com/ stable main
state: present


- name: install brave using apt
become: yes
become: true
ansible.builtin.apt:
name:
- brave-browser
update_cache: yes
update_cache: true
Loading
Loading