Skip to content

Commit cad01be

Browse files
authored
Merge pull request #68 from rust-practice/develop
Update Main
2 parents 129e588 + 20adebd commit cad01be

36 files changed

+2649
-173
lines changed

.cargo/config.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[alias]
2+
i = "install --path . --features=tool"
3+
g = "run --features=tool -- leet gen"
4+
t = "test --all-features"

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: 'bug'
6+
assignees: ''
7+
8+
---
9+
10+
**Describe the bug**
11+
12+
<!-- A clear and concise description of what the bug is. -->
13+
14+
**Leetcode problem**
15+
16+
<!-- Link to example problem on leetcode where the bug manifests if applicable. If not just put N/A -->
17+
18+
**To Reproduce**
19+
20+
<!-- Steps / command to reproduce the behavior. Example `cargo leet gen https://leetcode.com/problems/all-nodes-distance-k-in-binary-tree/`-->
21+
22+
``
23+
24+
**Error Message**
25+
26+
<!-- If applicable please provide a copy of the error received or a screenshot of the error -->
27+
28+
```
29+
```
30+
31+
**Expected behavior**
32+
33+
<!-- A clear and concise description of what you expected to happen. Not necessary if error was received. -->
34+
35+
**Environment Info:**
36+
37+
<!-- Use `cargo version` at command line to get version of cargo. e.g. "cargo 1.70.0 (ec8a8a0ca 2023-04-25)" -->
38+
39+
- Cargo Version:
40+
41+
**Additional context**
42+
43+
<!-- Add any other context about the problem here. -->
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
name: Missing Type
3+
about: Report the missing type so we can try to add it
4+
title: ''
5+
labels: 'bug'
6+
assignees: ''
7+
8+
---
9+
10+
**Leetcode problem**
11+
12+
<!-- Link to example problem on leetcode where the type is being used-->
13+
14+
**Error Message**
15+
16+
<!-- Please provide a copy of the error received or a screenshot of the error -->
17+
18+
```
19+
```

.github/workflows/general.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
- uses: dtolnay/rust-toolchain@stable
2323
- uses: Swatinem/rust-cache@v2
2424
- name: Run tests
25-
run: cargo test
25+
run: cargo test --all-features
2626

2727
fmt:
2828
name: Rustfmt

.github/workflows/release_check.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Release Build Confirmation
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
types: [ opened, synchronize, reopened ]
9+
branches:
10+
- main
11+
env:
12+
CARGO_TERM_COLOR: always
13+
14+
jobs:
15+
release_compile:
16+
name: Release Compile
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v3
20+
- uses: dtolnay/rust-toolchain@stable
21+
- uses: Swatinem/rust-cache@v2
22+
- name: Run Release Compile
23+
run: cargo check --all-features --release

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/target

.vscode/settings.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"cSpell.words": [
3+
"Vecbool",
4+
"Veci"
5+
],
6+
"editor.formatOnSave": true,
7+
"files.autoSave": "onFocusChange",
8+
"rust-analyzer.cargo.features": "all" // Sets the features used by rust analyzer
9+
}

CONTRIBUTING.md

Lines changed: 198 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,198 @@
1+
# Contributing
2+
3+
## Where to start
4+
5+
All contributions, bug reports, bug fixes, documentation improvements, enhancements, and ideas are welcome.
6+
7+
The best place to start is to check the [issues](https://github.com/rust-practice/cargo-leet)
8+
for something that interests you.
9+
There are also other options in [discussions](https://github.com/rust-practice/cargo-leet/discussions), so feel free to pick from there as well.
10+
11+
## Bug Reports
12+
13+
Please see the [issue templates](https://github.com/rust-practice/cargo-leet/issues/new/choose) that describe the types of information that we are looking for but no worries just fill it the best you can and we'll go from there.
14+
15+
## Working on the code
16+
17+
### Fork the project
18+
19+
In order to work on the project you will need your own fork. To do this click the "Fork" button on
20+
this project.
21+
22+
Once the project is forked you can work on it directly in github codespaces without needing to install anything by clicking the green button near the top and switching to code spaces.
23+
According to [github docs](https://docs.github.com/en/codespaces/overview#billing-for-codespaces) by default you can only use it up to the free amount so you don't need to worry about charges.
24+
Feel free to check some [notes collected](https://c-git.github.io/github/codespaces/) on how to use codespaces with rust (You don't need trunk for this project).
25+
26+
Alternatively you can clone it to your local machine. The following commands creates the directory cargo-leet and connects your repository to the upstream (main project) repository.
27+
28+
```sh
29+
git clone https://github.com/your-user-name/cargo-leet.git
30+
cd cargo-leet
31+
git remote add upstream [email protected]:rust-practice/cargo-leet.git
32+
```
33+
34+
### Creating a branch
35+
36+
You want your main branch to reflect only production-ready code.
37+
Please base your branch on the develop branch which is the default in cargo-leet repo so create a feature branch for
38+
making your changes.
39+
For example:
40+
41+
```sh
42+
git checkout -b my-new-feature
43+
```
44+
45+
This changes your working directory to the my-new-feature branch. Keep any changes in this branch
46+
specific to one bug or feature so the purpose is clear. You can have many my-new-features and switch
47+
in between them using the git checkout command.
48+
49+
When creating this branch, make sure your develop branch is up to date with the latest upstream
50+
develop version. To update your local develop branch, you can do:
51+
52+
```sh
53+
git checkout develop
54+
git pull upstream develop --ff-only
55+
```
56+
57+
### Code linting, formatting, and tests
58+
59+
You can run linting on your code at any time with:
60+
61+
```sh
62+
cargo clippy
63+
```
64+
65+
To format the code run:
66+
67+
```sh
68+
cargo fmt
69+
```
70+
71+
To run the tests:
72+
73+
Note the following is overridden in `.cargo/config.toml` to run with all features enabled
74+
75+
```sh
76+
cargo t
77+
```
78+
79+
Please run these checks before submitting your pull request.
80+
81+
## Committing your code
82+
83+
Once you have made changes to the code on your branch you can see which files have changed by running:
84+
85+
```sh
86+
git status
87+
```
88+
89+
If new files were created that and are not tracked by git they can be added by running:
90+
91+
```sh
92+
git add .
93+
```
94+
95+
Now you can commit your changes in your local repository:
96+
97+
```sh
98+
git commit -am 'Some short helpful message to describe your changes'
99+
```
100+
101+
## Push your changes
102+
103+
Once your changes are ready and all linting/tests are passing you can push your changes to your forked repository:
104+
105+
```sh
106+
git push origin my-new-feature
107+
```
108+
109+
origin is the default name of your remote repository on GitHub. You can see all of your remote repositories by running:
110+
111+
```sh
112+
git remote -v
113+
```
114+
115+
## Making a Pull Request
116+
117+
After pushing your code to origin it is now on GitHub but not yet part of the cargo-leet project.
118+
When you’re ready to ask for a code review, file a pull request. Before you do, once again make sure
119+
that you have followed all the guidelines outlined in this document regarding code style, tests, and
120+
documentation. You should also double check your branch changes against the branch it was based on by:
121+
122+
1. Navigating to your repository on GitHub
123+
1. Click on Branches
124+
1. Click on the Compare button for your feature branch
125+
1. Select the base and compare branches, if necessary. This will be develop and my-new-feature, respectively.
126+
127+
### Make the pull request
128+
129+
If everything looks good, you are ready to make a pull request. This is how you let the maintainers
130+
of the cargo-leet project know you have code ready to be reviewed. To submit the pull request:
131+
132+
1. Navigate to your repository on GitHub
133+
1. Click on the Pull Request button for your feature branch
134+
1. You can then click on Commits and Files Changed to make sure everything looks okay one last time
135+
1. Write a description of your changes in the Conversation tab
136+
1. Click Send Pull Request
137+
138+
This request then goes to the repository maintainers, and they will review the code.
139+
140+
### Updating your pull request
141+
142+
Changes to your code may be needed based on the review of your pull request.
143+
If this is the case you can make them in your branch, add a new commit to that branch, push it to GitHub, and the pull request will be automatically updated.
144+
Pushing them to GitHub again is done by:
145+
146+
```sh
147+
git push origin my-new-feature
148+
```
149+
150+
This will automatically update your pull request with the latest code and restart the Continuous Integration tests.
151+
152+
Another reason you might need to update your pull request is to solve conflicts with changes that have been merged into the develop branch since you opened your pull request.
153+
154+
To do this, you need to rebase your branch:
155+
156+
```sh
157+
git checkout my-new-feature
158+
git fetch upstream
159+
git rebase upstream/develop
160+
```
161+
162+
There may be some merge conflicts that need to be resolved.
163+
After the feature branch has been update locally, you can now update your pull request by pushing to the branch on GitHub:
164+
165+
```sh
166+
git push origin my-new-feature
167+
```
168+
169+
If you rebased and get an error when pushing your changes you can resolve it with:
170+
171+
```sh
172+
git push origin my-new-feature --force
173+
```
174+
175+
## Delete your merged branch (optional)
176+
177+
Once your feature branch is accepted into upstream, you’ll probably want to get rid of the branch.
178+
First, merge upstream develop into your develop branch so git knows it is safe to delete your branch:
179+
180+
```sh
181+
git fetch upstream
182+
git checkout develop
183+
git merge upstream/develop
184+
```
185+
186+
Then you can do:
187+
188+
```sh
189+
git branch -d my-new-feature
190+
```
191+
192+
Make sure you use a lower-case -d, or else git won’t warn you if your feature branch has not actually been merged.
193+
194+
The branch will still exist on GitHub, so to delete it there do:
195+
196+
```sh
197+
git push origin --delete my-new-feature
198+
```

0 commit comments

Comments
 (0)