Skip to content

clippy annotation reporter #1049

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
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
2,935 changes: 2,935 additions & 0 deletions .github/actions/clippy-annotation-reporter/Cargo.lock

Large diffs are not rendered by default.

28 changes: 28 additions & 0 deletions .github/actions/clippy-annotation-reporter/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[package]
name = "clippy-annotation-reporter"
rust-version = "1.78.0"
edition = "2021"
version = "0.1.0"

[dependencies]
clap = { version = "4.3", features = ["derive", "env"] }
octocrab = "0.44"
anyhow = "1.0"
regex = "1.9"
tokio = { version = "1", features = ["macros", "rt-multi-thread"] }
serde_json = "1.0"
log = "0.4"
env_logger = "0.10"
# Octocrab has a defined MSRV < 1.78 and depends on url 2.5.4 which also has a defined MSRV < 1.78 but url has a dependency on `idna` has a MSRV of 1.81. Not sure what is going on here.
url = "=2.5.2"
toml = "0.8.22"
mockall = "0.13.1"

[dev-dependencies]
httpmock = "0.6"
http = "1.1.0"
tempfile = "3.20.0"

# TODO: Remove this when move to separate repo
[workspace]
members = ["."]
56 changes: 56 additions & 0 deletions .github/actions/clippy-annotation-reporter/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: 'Clippy Annotation Reporter'
description: 'Reports changes in Clippy allow annotations'
author: 'Datadog'

inputs:
github-token:
description: 'GitHub token for PR comment access'
required: true
default: ${{ github.token }}
allow-annotation-rules:
description: 'Comma-separated list of clippy rules to track'
required: false
default: 'unwrap_used,expect_used,todo,unimplemented,panic,unreachable'
base-branch:
description: 'Base branch to compare against'
required: false
default: 'origin/main'
log_level:
description: 'Log level (error, warn, info, debug, trace)'
required: false
default: 'info'

runs:
using: 'composite'
steps:
- name: Set up Rust
shell: bash
run: rustup install stable && rustup default stable

- name: Fetch all branches
shell: bash
run: |
git fetch --all
echo "Available branches:"
git branch -a

- name: Build annotation reporter
shell: bash
run: |
cd ${{ github.action_path }}
cargo build --release
- name: Debug step
shell: bash
run: |
FILE_PATH="data-pipeline/src/trace_exporter/mod.rs"
- name: Run annotation reporter
shell: bash
run: |
${{ github.action_path }}/target/release/clippy-annotation-reporter \
--token "${{ inputs.github-token }}" \
--rules "${{ inputs.allow-annotation-rules }}" \
--repo "${{ github.repository }}" \
--pr "${{ github.event.number }}" \
--base-branch "${{ inputs.base_branch }}"
env:
GITHUB_TOKEN: ${{ inputs.github-token }}
8 changes: 8 additions & 0 deletions .github/actions/clippy-annotation-reporter/rustfmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
unstable_features = true

format_macro_matchers = true
format_code_in_doc_comments=true
wrap_comments = true
max_width=100
comment_width=100
doc_comment_code_block_width=100
Loading
Loading