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

Switch to StyLua code style #3809

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
6 changes: 6 additions & 0 deletions .github/workflows/build-beta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ jobs:
args: "--no-color -q"
annotate: warning

- uses: JohnnyMorganz/stylua-action@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --check . --output-format=summary
version: v0.15.1

- name: Generate Changelog
run: ./generate_changelog.sh

Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ jobs:
args: "--no-color -q"
annotate: warning

- uses: JohnnyMorganz/stylua-action@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --check . --output-format=summary
version: v0.15.1

- name: Update CurseForge Translations
run: ./update_translations.sh
env:
Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,23 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3
with:
fetch-depth: 200
ref: ${{ github.event.pull_request.head.sha }}

- name: Install and run Luacheck
uses: nebularg/actions-luacheck@v1
with:
args: "--no-color -q"
annotate: warning

- uses: JohnnyMorganz/stylua-action@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --check . --output-format=summary
version: v0.15.1

- name: Update Build Date
run: sed -i "s/@build-time@/`date +%Y%m%d%H%M%S`/" WeakAuras/Init.lua

Expand Down
6 changes: 6 additions & 0 deletions .styluaignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
WeakAurasModelPaths
Libs
babelfish.lua
WeakAuras_Main.lua
WeakAuras_Options.lua
WeakAuras_Templates.lua
29 changes: 15 additions & 14 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@ There are a few things which we require in any contribution:
- This repository comes with a `.editorconfig` file, so the following requirements will be taken care of if you have [EditorConfig](https://editorconfig.org/) installed:
- Tabs consist of 2 spaces.
- Files end with a newline.
- Line endings in addon files must be Windows-Style (CRLF). This is a WoW AddOn, pretty much everyone is going to be running Windows when using or developing WeakAuras.
- No trailing whitespace at the end of a line.
- We use [StyLua](https://github.com/JohnnyMorganz/StyLua) for automatic code formatting. Make sure you apply it to your changes before commiting them. There are extensions for the most common IDEs and editors as well as CLI tools to do that.
- All user-facing strings (`names` and `desc` fields in AceConfig tables, mostly) must be localized:
- We use a locale scraper to find translation phrases and automatically export them to CurseForge for translation. This scraper parses the addon files, looking for tokens that look like: `L["some translation phrase"]`. You must use double quoted strings, and name the localization table (found at `WeakAuras.L`) `L` in your code for this to work properly.
- When writing a new file, avoid using semicolons. When modifying code in an existing file, try to be consistent, but err on the side of no semicolons.
- New features should be indicated by concatenating `WeakAuras.newFeatureString` onto the associated translation phrase. We will remove the new feature indicator approximately 3 months after the first release.

## Pull Requests
Expand All @@ -24,19 +23,19 @@ If you want to help, here's what you need to do:
1. Create a new topic branch (based on the `main` branch) to contain your feature, change, or fix.

```bash
> git checkout -b my-topic-branch
git checkout -b my-topic-branch
```

1. Set `core.autocrlf` to true.

```bash
> git config core.autocrlf true
git config core.autocrlf true
```

1. Set `pull.rebase`to true.

```bash
> git config pull.rebase true
git config pull.rebase true
```

1. Set up your [Git identity](https://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup) so your commits are attributed to your name and email address properly.
Expand All @@ -45,11 +44,13 @@ If you want to help, here's what you need to do:

1. Install an [EditorConfig](https://editorconfig.org/) plugin for your text editor to automatically follow our indenting rules.

1. Install and run [StyLua](https://github.com/JohnnyMorganz/StyLua).

1. Commit and push your changes to your new branch.

```bash
> git commit -a -m "commit-description"
> git push
git commit -a -m "commit-description"
git push
```

1. [Open a Pull Request](https://github.com/WeakAuras/WeakAuras2/pulls) with a clear title and description.
Expand All @@ -65,9 +66,9 @@ If you want to help, here's what you need to do:
- In order to sync your fork with the upstream WeakAuras repository you would do

```bash
> git fetch upstream
> git checkout main
> git rebase upstream/main
git fetch upstream
git checkout main
git rebase upstream/main
```

- You are now all synced up.
Expand All @@ -77,16 +78,16 @@ If you want to help, here's what you need to do:
- In order to sync your pull request with the upstream WeakAuras repository in case there are any conflicts you would do

```bash
> git fetch upstream
> git checkout my-topic-branch
> git rebase upstream/main
git fetch upstream
git checkout my-topic-branch
git rebase upstream/main
```

- In case there are any conflicts, you will now have to [fix them manually](https://help.github.com/articles/resolving-merge-conflicts-after-a-git-rebase/).
- After you're done with that, you are ready to force-push your changes.

```bash
> git push --force
git push --force
```

- Note: Force-pushing is a destructive operation, so make sure you don't lose something in the progress.
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

# WeakAuras

[![Build Status](https://github.com/WeakAuras/WeakAuras2/workflows/CI/badge.svg)](https://github.com/WeakAuras/WeakAuras2/actions?workflow=CI)
[![Build Status](https://github.com/WeakAuras/WeakAuras2/workflows/CI/badge.svg)](https://github.com/WeakAuras/WeakAuras2/actions?workflow=CI) [![Code Style: StyLua](https://img.shields.io/badge/code%20style-stylua-brightgreen.svg)](https://github.com/JohnnyMorganz/StyLua "StyLua")

[![WeakAuras on Discord](https://img.shields.io/badge/discord-weakauras-738bd7.svg?style=flat)](https://discord.gg/weakauras) [![Patreon](https://img.shields.io/badge/patreon-donate-orange.svg)](https://www.patreon.com/weakauras)

![Logo](https://i.imgur.com/wwbxeCG.jpeg)
Expand Down
Loading