aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Strapp <matt@mattstrapp.net>2024-11-01 15:48:34 -0500
committerMatt Strapp <matt@mattstrapp.net>2024-11-01 15:48:34 -0500
commite55df04e362624e2f98274077a29ee65c8453070 (patch)
tree13dbd578b42446da62925bc4477af2ac14f9a7c7
parentcodeowners: correct the order (diff)
downloadlocusts-e55df04e362624e2f98274077a29ee65c8453070.tar
locusts-e55df04e362624e2f98274077a29ee65c8453070.tar.gz
locusts-e55df04e362624e2f98274077a29ee65c8453070.tar.bz2
locusts-e55df04e362624e2f98274077a29ee65c8453070.tar.lz
locusts-e55df04e362624e2f98274077a29ee65c8453070.tar.xz
locusts-e55df04e362624e2f98274077a29ee65c8453070.tar.zst
locusts-e55df04e362624e2f98274077a29ee65c8453070.zip
Lint ourselves
Signed-off-by: Matt Strapp <matt@mattstrapp.net>
-rw-r--r--.github/workflows/beam.yml6
-rw-r--r--.github/workflows/deno.yml4
-rw-r--r--.github/workflows/docker.yml4
-rw-r--r--.github/workflows/dotnet.yml10
-rw-r--r--.github/workflows/go.yml4
-rw-r--r--.github/workflows/jvm.yml8
-rw-r--r--.github/workflows/lint.yml90
-rw-r--r--.github/workflows/node.yml6
-rw-r--r--.github/workflows/ruby.yml8
-rw-r--r--.github/workflows/rust.yml10
-rw-r--r--src/Locusts.cs16
-rw-r--r--src/locusts.py10
-rw-r--r--src/test_locusts.py7
-rw-r--r--tests/Locusts.cs2
14 files changed, 56 insertions, 129 deletions
diff --git a/.github/workflows/beam.yml b/.github/workflows/beam.yml
index a155c5d..c8785d7 100644
--- a/.github/workflows/beam.yml
+++ b/.github/workflows/beam.yml
@@ -13,8 +13,8 @@ on:
- "**.beam"
jobs:
- build-and-test:
- name: Build and Test
+ lint-build-and-test:
+ name: Lint, Build and Test
runs-on: ubuntu-latest
strategy:
fail-fast: false
@@ -35,7 +35,7 @@ jobs:
run: mix test
publish:
name: Publish to hex.pm
- needs: build-and-test
+ needs: lint-build-and-test
# Only run on this on proper semver (vX.Y.Z) tags
if: ${{ github.ref_type == 'tag' && startsWith(github.ref_name, 'v') }}
runs-on: ubuntu-latest
diff --git a/.github/workflows/deno.yml b/.github/workflows/deno.yml
index 357000b..3376864 100644
--- a/.github/workflows/deno.yml
+++ b/.github/workflows/deno.yml
@@ -26,6 +26,10 @@ jobs:
uses: denoland/setup-deno@v2
with:
deno-version: v2.x
+ - name: Lint
+ run: |
+ deno lint
+ deno fmt --check
- name: Test
run: deno test src/packages/locusts/mod.ts
- name: Publish on Tag
diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml
index 9ae23f1..c35c7d4 100644
--- a/.github/workflows/docker.yml
+++ b/.github/workflows/docker.yml
@@ -29,6 +29,10 @@ jobs:
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
+ - name: Lint
+ uses: hadolint/hadolint-action@v3.1.0
+ with:
+ dockerfile: Dockerfile
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml
index 3b2fecb..6c525bd 100644
--- a/.github/workflows/dotnet.yml
+++ b/.github/workflows/dotnet.yml
@@ -15,8 +15,8 @@ on:
- ".github/workflows/dotnet.yml"
jobs:
- build-and-test:
- name: Build and Test
+ build-lint-and-test:
+ name: Lint, Build and Test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
@@ -30,12 +30,14 @@ jobs:
uses: actions/setup-dotnet@v4
- name: Install dependencies
run: dotnet restore
+ - name: Lint
+ run: dotnet format --verify-no-changes
- name: Test
run: dotnet test --no-restore
publish-preview:
name: Publish Preview NuGet to GitHub Packages
- needs: build-and-test
+ needs: build-lint-and-test
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
runs-on: ubuntu-latest
permissions:
@@ -61,7 +63,7 @@ jobs:
publish-release:
name: Publish Release NuGet to NuGet.org
- needs: build-and-test
+ needs: build-lint-and-test
# Only run on this on proper semver (vX.Y.Z) tags
if: ${{ github.ref_type == 'tag' && startsWith(github.ref_name, 'v') }}
runs-on: ubuntu-latest
diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml
index da0bda4..6fbe548 100644
--- a/.github/workflows/go.yml
+++ b/.github/workflows/go.yml
@@ -13,8 +13,8 @@ on:
- ".github/workflows/go.yml"
jobs:
- build-and-test:
- name: Build and Test
+ lint-build-and-test:
+ name: Lint, Build and Test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
diff --git a/.github/workflows/jvm.yml b/.github/workflows/jvm.yml
index f3f9db7..2ea4fbc 100644
--- a/.github/workflows/jvm.yml
+++ b/.github/workflows/jvm.yml
@@ -17,8 +17,8 @@ on:
- ".github/workflows/jvm.yml"
jobs:
- build-and-test:
- name: Build and Test
+ lint-build-and-test:
+ name: Lint, Build and Test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
@@ -41,7 +41,7 @@ jobs:
publish-snapshot:
name: Publish Snapshot to GitHub Packages
- needs: build-and-test
+ needs: lint-build-and-test
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
runs-on: ubuntu-latest
permissions:
@@ -71,7 +71,7 @@ jobs:
publish-release:
name: Publish Packages to Maven Central and GitHub Packages
- needs: build-and-test
+ needs: lint-build-and-test
# Only run on this on proper semver (vX.Y.Z) tags
if: ${{ github.ref_type == 'tag' && startsWith(github.ref_name, 'v') }}
runs-on: ubuntu-latest
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
deleted file mode 100644
index 09e2970..0000000
--- a/.github/workflows/lint.yml
+++ /dev/null
@@ -1,90 +0,0 @@
-# MegaLinter GitHub Action configuration file
-# More info at https://megalinter.io
-name: Lint with MegaLinter
-
-on:
- # Trigger mega-linter at every push. Action will also be visible from Pull Requests to main
- push: # Comment this line to trigger action only on pull-requests (not recommended if you don't pay for GH Actions)
- pull_request:
- branches: [master]
-
-env: # Comment env block if you don't want to apply fixes
- # Apply linter fixes configuration
- APPLY_FIXES: all # When active, APPLY_FIXES must also be defined as environment variable (in github/workflows/mega-linter.yml or other CI tool)
- APPLY_FIXES_EVENT: pull_request # Decide which event triggers application of fixes in a commit or a PR (pull_request, push, all)
- APPLY_FIXES_MODE: commit # If APPLY_FIXES is used, defines if the fixes are directly committed (commit) or posted in a PR (pull_request)
-
-concurrency:
- group: ${{ github.ref }}-${{ github.workflow }}
- cancel-in-progress: true
-
-jobs:
- megalinter:
- name: MegaLinter
- runs-on: ubuntu-latest
- permissions:
- # Give the default GITHUB_TOKEN write permission to commit and push, comment issues & post new PR
- # Remove the ones you do not need
- contents: write
- issues: write
- pull-requests: write
- steps:
- # Git Checkout
- - name: Checkout Code
- uses: actions/checkout@v4
- with:
- token: ${{ secrets.GITHUB_TOKEN }}
- fetch-depth: 0 # If you use VALIDATE_ALL_CODEBASE = true, you can remove this line to improve performances
-
- # MegaLinter
- - name: MegaLinter
- id: ml
- # You can override MegaLinter flavor used to have faster performances
- # More info at https://megalinter.io/flavors/
- uses: oxsecurity/megalinter@v8
- env:
- # All available variables are described in documentation
- # https://megalinter.io/configuration/
- VALIDATE_ALL_CODEBASE: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} # Validates all source when push on main, else just the git diff with main. Override with true if you always want to lint all sources
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- # ADD YOUR CUSTOM ENV VARIABLES HERE OR DEFINE THEM IN A FILE .mega-linter.yml AT THE ROOT OF YOUR REPOSITORY
- # DISABLE: COPYPASTE,SPELL # Uncomment to disable copy-paste and spell checks
-
- # Upload MegaLinter artifacts
- - name: Archive production artifacts
- if: success() || failure()
- uses: actions/upload-artifact@v4
- with:
- name: MegaLinter reports
- path: |
- megalinter-reports
- mega-linter.log
-
- # Create pull request if applicable (for now works only on PR from same repository, not from forks)
- - name: Create Pull Request with applied fixes
- id: cpr
- if: steps.ml.outputs.has_updated_sources == 1 && (env.APPLY_FIXES_EVENT == 'all' || env.APPLY_FIXES_EVENT == github.event_name) && env.APPLY_FIXES_MODE == 'pull_request' && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository) && !contains(github.event.head_commit.message, 'skip fix')
- uses: peter-evans/create-pull-request@v7
- with:
- token: ${{ secrets.GITHUB_TOKEN }}
- commit-message: "[MegaLinter] Apply linters automatic fixes"
- title: "[MegaLinter] Apply linters automatic fixes"
- labels: bot
- - name: Create PR output
- if: steps.ml.outputs.has_updated_sources == 1 && (env.APPLY_FIXES_EVENT == 'all' || env.APPLY_FIXES_EVENT == github.event_name) && env.APPLY_FIXES_MODE == 'pull_request' && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository) && !contains(github.event.head_commit.message, 'skip fix')
- run: |
- echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
- echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"
-
- # Push new commit if applicable (for now works only on PR from same repository, not from forks)
- - name: Prepare commit
- if: steps.ml.outputs.has_updated_sources == 1 && (env.APPLY_FIXES_EVENT == 'all' || env.APPLY_FIXES_EVENT == github.event_name) && env.APPLY_FIXES_MODE == 'commit' && github.ref != 'refs/heads/main' && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository) && !contains(github.event.head_commit.message, 'skip fix')
- run: sudo chown -Rc $UID .git/
- - name: Commit and push applied linter fixes
- if: steps.ml.outputs.has_updated_sources == 1 && (env.APPLY_FIXES_EVENT == 'all' || env.APPLY_FIXES_EVENT == github.event_name) && env.APPLY_FIXES_MODE == 'commit' && github.ref != 'refs/heads/main' && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository) && !contains(github.event.head_commit.message, 'skip fix')
- uses: stefanzweifel/git-auto-commit-action@v5
- with:
- branch: ${{ github.event.pull_request.head.ref || github.head_ref || github.ref }}
- commit_message: "[MegaLinter] Apply linters fixes"
- commit_user_name: megalinter-bot
- commit_user_email: nicolas.vuillamy@ox.security \ No newline at end of file
diff --git a/.github/workflows/node.yml b/.github/workflows/node.yml
index 066986f..03cac87 100644
--- a/.github/workflows/node.yml
+++ b/.github/workflows/node.yml
@@ -23,8 +23,8 @@ on:
- "**.svelte"
jobs:
- build-and-test:
- name: Build and Test
+ lint-build-and-test:
+ name: Lint, Build and Test
runs-on: ${{ matrix.os }}
strategy:
matrix:
@@ -49,5 +49,5 @@ jobs:
cache: "pnpm"
- name: Check formatting
run: pnpm lint
- - name: Build and Test
+ - name: Lint, Build and Test
run: pnpm build && pnpm test
diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml
index b359a28..8ec504e 100644
--- a/.github/workflows/ruby.yml
+++ b/.github/workflows/ruby.yml
@@ -19,7 +19,7 @@ on:
- ".github/workflows/ruby.yml"
jobs:
- build-and-test:
+ lint-build-and-test:
runs-on: ubuntu-latest
name: Ruby
steps:
@@ -29,12 +29,12 @@ jobs:
with:
ruby-version: ruby
bundler-cache: true
- - name: Build and test with Rake
+ - name: Lint, Build and Test with Rake
run: bundle exec rake
publish-preview:
runs-on: ubuntu-latest
- needs: build-and-test
+ needs: lint-build-and-test
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
name: Publish Preview to GitHub Package Registry
permissions:
@@ -64,7 +64,7 @@ jobs:
publish-release:
name: Push gem to RubyGems.org
- needs: build-and-test
+ needs: lint-build-and-test
# Only run on this on proper semver (vX.Y.Z) tags
if: ${{ github.ref_type == 'tag' && startsWith(github.ref_name, 'v') }}
runs-on: ubuntu-latest
diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml
index d95200a..2f86db0 100644
--- a/.github/workflows/rust.yml
+++ b/.github/workflows/rust.yml
@@ -13,8 +13,8 @@ on:
- ".github/workflows/rust.yml"
jobs:
- build-and-test:
- name: Build and Test
+ lint-build-test:
+ name: Lint, Lint, Build and Test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
@@ -24,12 +24,16 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
+ - name: Lint
+ run: |
+ cargo fmt --all --check
+ cargo clippy
- name: Test
run: cargo test --verbose
publish:
name: Publish to crates.io
- needs: build-and-test
+ needs: lint-build-test
# Only run on this on proper semver (vX.Y.Z) tags
if: ${{ github.ref_type == 'tag' && startsWith(github.ref_name, 'v') }}
runs-on: ubuntu-latest
diff --git a/src/Locusts.cs b/src/Locusts.cs
index c35a38c..354ee85 100644
--- a/src/Locusts.cs
+++ b/src/Locusts.cs
@@ -5,16 +5,16 @@
/// </summary>
public static class Locusts
{
- /// <summary>
- /// Introduce locusts into your codebase.
- /// </summary>
- /// <remarks>
- /// This method will introduce locusts into your codebase.
+ /// <summary>
+ /// Introduce locusts into your codebase.
+ /// </summary>
+ /// <remarks>
+ /// This method will introduce locusts into your codebase.
///
/// Locusts are not included with this library, you must provide your own.
- /// </remarks>
- public static void IntroduceLocusts()
+ /// </remarks>
+ public static void IntroduceLocusts()
{
// Method intentionally left empty.
}
-}
+} \ No newline at end of file
diff --git a/src/locusts.py b/src/locusts.py
index f050133..c3d10ca 100644
--- a/src/locusts.py
+++ b/src/locusts.py
@@ -1,6 +1,8 @@
+"""Here be locusts."""
+
def introduce_locusts():
- """
- Introduce locusts into your codebase.
+ """
+ Introduce locusts into your codebase.
- Note that locusts are not included with this package, you must provide your own.
- """
+ Note that locusts are not included with this package, you must provide your own.
+ """
diff --git a/src/test_locusts.py b/src/test_locusts.py
index 68e6df7..8026315 100644
--- a/src/test_locusts.py
+++ b/src/test_locusts.py
@@ -1,9 +1,10 @@
+""""Run tests for locusts.py."""
import unittest
from locusts import introduce_locusts
class TestLocusts(unittest.TestCase):
- def test_introduce_locusts(self):
- self.assertIsNone(introduce_locusts())
+ def test_introduce_locusts(self):
+ self.assertIsNone(introduce_locusts())
if __name__ == '__main__':
- unittest.main() \ No newline at end of file
+ unittest.main()
diff --git a/tests/Locusts.cs b/tests/Locusts.cs
index a220043..0ec1f7a 100644
--- a/tests/Locusts.cs
+++ b/tests/Locusts.cs
@@ -7,6 +7,6 @@ public class Test
public void TestLocusts()
{
Locusts.IntroduceLocusts();
- Assert.IsTrue(1==1);
+ Assert.IsTrue(1 == 1);
}
} \ No newline at end of file