ci: Added code style check (#29)
Co-authored-by: FroVolod <frol_off@meta.ua>
This commit is contained in:
parent
c32b1ff860
commit
974ac426bf
4 changed files with 31 additions and 6 deletions
28
.github/workflows/code_style.yml
vendored
Normal file
28
.github/workflows/code_style.yml
vendored
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
name: Code Style
|
||||
on:
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
codestyle:
|
||||
name: Code Style (fmt + clippy)
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
- name: Install Rust
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
override: true
|
||||
profile: minimal
|
||||
components: rustfmt
|
||||
- name: Check formatting
|
||||
run: |
|
||||
cargo fmt --all -- --check
|
||||
- name: Install libudev-dev
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install --assume-yes libudev-dev
|
||||
- name: Check lints (cargo clippy)
|
||||
run: cargo clippy -- -D warnings
|
||||
|
||||
|
|
@ -4,7 +4,6 @@ use syn;
|
|||
|
||||
use crate::LONG_VEC_MUTLIPLE_OPT;
|
||||
|
||||
|
||||
pub fn is_skip_interactive_input(field: &syn::Field) -> bool {
|
||||
field
|
||||
.attrs
|
||||
|
|
|
|||
|
|
@ -428,12 +428,12 @@ fn for_cli_field(
|
|||
quote!()
|
||||
} else {
|
||||
let ty = &field.ty;
|
||||
if field.attrs.iter().any(|attr|
|
||||
if field.attrs.iter().any(|attr|
|
||||
attr.path.is_ident("interactive_clap") &&
|
||||
attr.tokens.clone().into_iter().any(
|
||||
|attr_token|
|
||||
matches!(
|
||||
attr_token,
|
||||
attr_token,
|
||||
proc_macro2::TokenTree::Group(group) if group.stream().to_string() == LONG_VEC_MUTLIPLE_OPT
|
||||
)
|
||||
)
|
||||
|
|
|
|||
|
|
@ -56,7 +56,6 @@ fn test_vec_multiple_opt() {
|
|||
|
||||
let interactive_clap_codegen = crate::derives::interactive_clap::impl_interactive_clap(&input);
|
||||
insta::assert_snapshot!(pretty_codegen(&interactive_clap_codegen));
|
||||
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
@ -73,7 +72,7 @@ fn test_vec_multiple_opt_to_cli_args() {
|
|||
}
|
||||
|
||||
#[test]
|
||||
// testing correct panic msg isn't really very compatible with
|
||||
// testing correct panic msg isn't really very compatible with
|
||||
// `proc-macro-error` crate
|
||||
#[should_panic]
|
||||
fn test_vec_multiple_opt_err() {
|
||||
|
|
@ -86,5 +85,4 @@ fn test_vec_multiple_opt_err() {
|
|||
|
||||
let interactive_clap_codegen = crate::derives::interactive_clap::impl_interactive_clap(&input);
|
||||
insta::assert_snapshot!(pretty_codegen(&interactive_clap_codegen));
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue