Skip to content

Commit

Permalink
Merge pull request #1 from thor314/thor-init
Browse files Browse the repository at this point in the history
init project files
  • Loading branch information
thor314 authored May 1, 2024
2 parents 92ca95c + ccec0f0 commit d8f688b
Show file tree
Hide file tree
Showing 17 changed files with 590 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .clippy.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# List of lints:
# https://rust-lang.github.io/rust-clippy/master/index.html

# Don't warn for functions with too many arguments. Default: 7
too-many-arguments-threshold = 10
34 changes: 34 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
name: Bug report
about: Create a report
title: ''
labels: 'bug'
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Context (please complete the following information):**
- OS/Distro + Version:
- Linux: `lsb_release -a`
- Apple: `sw_vers -productVersion`
- Output of `cargo --version`:
- This crate version:

**Additional context**
Add any other context about the problem here.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea
title: ''
labels: 'feature-request'
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
8 changes: 8 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<!---
Thank you for contributing! Please fill out the template below, and remove or add any
information as you feel neccesary.
--->

This PR fixes/closes issue #N

It changes the following:
17 changes: 17 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Auto-update dependencies.
# last updated 2024-03-04
# demo: https://github.com/dependabot/demo/blob/main/.github/dependabot.yml
---
version: 2
updates:
# look for updates to github actions every week
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
# look for updates to Cargo.toml dependencies every week
# docs: https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#package-ecosystem
- package-ecosystem: cargo
directory: "/"
schedule:
interval: "weekly"
43 changes: 43 additions & 0 deletions .github/settings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# These settings are synced to GitHub by https://probot.github.io/apps/settings/
# Requires sign up, and allowing Probot to manage your repos.

repository:
# name: ronkathon # sets the repo name
description: ronkathon
# homepage: docs.rs/ronkathon
private: false
has_issues: true
has_projects: false
has_wiki: false
has_downloads: false
default_branch: main
allow_squash_merge: true
allow_merge_commit: false
allow_rebase_merge: false

# # Labels: define labels for Issues and Pull Requests
# labels:
# - name: bug
# color: CC0000
# - name: feature
# color: 336699
# - name: first-timers-only
# # include the old name to rename and existing label
# oldname: Help Wanted

# # Collaborators: give specific users access to this repository.
# collaborators:
# - username: bkeepers
# # Note: Only valid on organization-owned repositories.
# # The permission to grant the collaborator. Can be one of:
# # * `pull` - can pull, but not push to or administer this repository.
# # * `push` - can pull and push, but not administer this repository.
# # * `admin` - can pull, push and administer this repository.
# permission: push

# - username: hubot
# permission: pull
# - username:
# permission: pull


53 changes: 53 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Rust template: https://github.com/actions/starter-workflows/blob/main/ci/rust.yml
# Resources: https://docs.github.com/en/actions
# Examples: https://github.com/actions/starter-workflows
# Process: make small changes, push them, check the Actions tab on github
# also see templates https://github.com/rust-github/template/tree/main/.github/workflows
name: Rust
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

env:
CARGO_TERM_COLOR: always # pretty colors

jobs:
lint:
name: lint project
runs-on: ubuntu-latest
strategy:
matrix:
toolchain:
- nightly
steps:
- uses: actions/checkout@v4
- run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
- run: rustup component add clippy
- run: cargo clippy -- -Dwarnings
test:
name: test project
runs-on: ubuntu-latest
strategy:
matrix:
toolchain:
- nightly
steps:
- uses: actions/checkout@v4
- run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
- run: cargo test --all-features --verbose

fmt:
name: fmt project
runs-on: ubuntu-latest
strategy:
matrix:
toolchain:
- nightly
steps:
- uses: actions/checkout@v4
- run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
- run: rustup component add rustfmt
- run: cargo fmt --all -- --check

27 changes: 27 additions & 0 deletions .github/workflows/dependabot_automerge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Set permissions to auto-merge updates.
# set 2024-03-04
# https://docs.github.com/en/code-security/dependabot/working-with-dependabot/automating-dependabot-with-github-actions#enable-auto-merge-on-a-pull-request

name: Dependabot auto-merge
on: pull_request

permissions:
contents: write
pull-requests: write

jobs:
dependabot:
runs-on: ubuntu-latest
if: github.actor == 'dependabot[bot]'
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v1
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Enable auto-merge for Dependabot PRs
if: steps.metadata.outputs.update-type == 'version-update:semver-patch'
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
27 changes: 27 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
### Rust ###
# ref: https://github.com/github/gitignore/blob/main/Rust.gitignore
cgt* # ignore instatiations of my test template

# don't leak secret env vars
.env

# exclude compiled files and binaries
debug/
target/

# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
Cargo.lock

.vscode
.viscode

# These are backup files generated by rustfmt
**/*.rs.bk
# MSVC Windows builds of rustc generate these, which store debugging information
*.pdb

dump

### VIM ###
*.swp
*.swo
44 changes: 44 additions & 0 deletions .rustfmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Opinionated whitespace and tabs. The most important of these are imports and width settings.
# Others may want to borrow or change these to their own liking.
# https://rust-lang.github.io/rustfmt

# version-related
edition = "2021" # redundant, fmt will read Cargo.toml for editor edition year
unstable_features = true
use_try_shorthand = true # replace any `try!` (2015 Rust) with `?`

# misc formatting
condense_wildcard_suffixes = true # replace: (a,b,_,_)=(1, 2, 3, 4); -> (a,b,..)=(1, 2, 3, 4);
format_code_in_doc_comments = true # format code blocks in doc comments
format_macro_matchers = true # $a: ident -> $a:ident
format_strings = true # break and insert newlines for long string literals
match_block_trailing_comma = true # include comma in match blocks after '}'
normalize_comments = true # convert /*..*/ to //.. where possible
reorder_impl_items = true # move `type` and `const` declarations to top of impl block
struct_field_align_threshold = 20 # align struct arguments' types vertically
use_field_init_shorthand = true # struct initialization short {x: x} -> {x}

# reduce whitespace
blank_lines_upper_bound = 1 # default: 1. Sometimes useful to change to 0 to condense a file.
brace_style = "PreferSameLine" # prefer starting `{` without inserting extra \n
fn_single_line = true # if it's a short 1-liner, let it be a short 1-liner
match_arm_blocks = false # remove unnecessary {} in match arms
newline_style = "Unix" # not auto, we won the culture war. \n over \r\n
overflow_delimited_expr = true # prefer ]); to ]\n);
where_single_line = true # put where on a single line if possible

# imports preferences
group_imports = "StdExternalCrate" # create import groupings for std, external libs, and internal deps
imports_granularity = "Crate" # aggressively group imports

# width settings: everything to 100
comment_width = 100 # default: 80
inline_attribute_width = 60 # inlines #[cfg(test)]\nmod test -> #[cfg(test)] mod test
max_width = 100 # default: 100
use_small_heuristics = "Max" # don't ever newline short of `max_width`.
wrap_comments = true # wrap comments at `comment_width`
# format_strings = true # wrap strings at `max_length`

# tabs and spaces
hard_tabs = false # (def: false) use spaces over tabs
tab_spaces = 2 # 2 > 4, it's just math.
20 changes: 20 additions & 0 deletions .taplo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# .toml file formatting settings for `taplo`
# https://taplo.tamasfe.dev/configuration/formatter-options.html

[formatting]
# align entries vertically
align_entries = true
# allow up to 1 consecutive empty line (default: 2)
allowed_blank_lines = 1
# collapse arrays into one line if they fit
array_auto_collapse = true
# default: 80
column_width = 100
# remove whitespace around '='
compact_entries = true
# alphabetically sort entries not separated by line breaks
reorder_keys = false
# align entries vertically (default: true)
# align_comments =false
# expand arrays into multiple lines (default: true)
# array_auto_expand =false
Loading

0 comments on commit d8f688b

Please sign in to comment.