Skip to content

Commit

Permalink
Dev (#3)
Browse files Browse the repository at this point in the history
Work in progress.
  • Loading branch information
lindsaygelle authored Jul 27, 2023
1 parent 3e94004 commit a223464
Show file tree
Hide file tree
Showing 22 changed files with 228 additions and 172 deletions.
81 changes: 57 additions & 24 deletions .github/BRANCH_NAMING_CONVENTION.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,69 @@
# Branch naming convention
# Branch Naming Convention

## Branch naming
This document outlines the branch naming convention to be followed for our project/repository. Consistent and descriptive branch names help us maintain a clear and organized codebase.

> Please note for new pull requests create new branches from current `dev` branch only.
## Types of Branches

Branch name should include type of your contribution and context. Please follow next pattern for naming your branches:
### 1. Feature Branches

```bash
feature/add-some-feature
technical/some-technical-improvements
bugfix/fix-some-bug-name
```
Feature branches are used to develop new features or enhancements. They should be created from the `main` branch.

## Before PR actions
Naming Convention: `feature/descriptive-feature-name`

### Squash commits
Example: `feature/user-authentication`

Please squash all branch commits into the one before opening your PR from your fork. It's simple to do with the git:
### 2. Bugfix Branches

```bash
git rebase -i [hash your first commit of your branch]~1
git rebase -i 6467fe36232401fa740af067cfd8ac9ec932fed2~1 # example
```
Bugfix branches are used to address and fix bugs or issues in the code. They should be created from the `main` branch.

### Add commit description
Naming Convention: `bugfix/descriptive-bug-description`

Please complete your commit description following next pattern:
Example: `bugfix/navigation-bar-overflow`

```code
Technical/Add info files # should be the same name as your branch name
### 3. Hotfix Branches

* Added license, changelog, contributing, code of conduct docs
* Added GitHub templates
* Updated project license link
```
Hotfix branches are used to address critical issues that need immediate attention and cannot wait for the next regular release. They should be created from the `main` branch.

Naming Convention: `hotfix/descriptive-hotfix-description`

Example: `hotfix/critical-security-vulnerability`

## Special Cases

### 1. Release Branches

Release branches are used to prepare the codebase for a new release. They are created from the `main` branch when the code is ready for deployment. They might be prefixed with the release version.

Naming Convention: `release/version`

Example: `release/1.0.0`

### 2. Main Branch

The main branch is the primary branch of the repository and represents the latest stable version of the project.

Branch Name: `main`

## General Guidelines

- Use lowercase letters for branch names.
- Use hyphens to separate words in the branch names (e.g., `feature/new-feature`).
- Keep branch names concise and descriptive.
- Avoid using abbreviations or acronyms unless they are widely understood in the context of the project.

## Examples

### Good Examples

- `feature/user-profile`
- `bugfix/login-page-styling`
- `hotfix/404-page-error`

### Bad Examples

- `f/newfeature` (too short and lacks descriptive information)
- `fix` (not descriptive enough)

Remember to always follow this branch naming convention to ensure clarity and consistency in our code repository.

If you have any questions or need further clarification, feel free to reach out to the team.
81 changes: 19 additions & 62 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,68 +1,25 @@
<!-- Thanks for sending a pull request! Here are some tips for you:
### Description
[Provide a brief description of the changes in this pull request.]

1. If this is your first time contributing to this project, please read our contributor guidelines: [Link to contributor guidelines]
2. Please label this pull request according to what type of change you are addressing.
3. Ensure you have added or run the appropriate tests for your PR.
4. If you want *faster* PR reviews, please follow our best practices: [Link to best practices]
5. If the PR is unfinished, please mark it accordingly.
-->
### Related Issue
[Reference any related issue(s) or feature request(s) here. For example: "Closes #123"]

#### What type of PR is this?
### Changes Made
[Explain the changes you made in this pull request. Include any relevant details about code modifications, added features, or bug fixes.]

<!--
Add one of the following kinds:
/kind bug
/kind cleanup
/kind documentation
/kind feature
### Screenshots (if applicable)
[If your changes include visual updates or additions, provide screenshots to showcase them.]

Optionally add one or more of the following kinds if applicable:
/kind api-change
/kind deprecation
/kind failing-test
/kind flake
/kind regression
-->
### How to Test
[Explain how reviewers or others can test your changes. Include specific steps, commands, or scenarios to verify the functionality.]

#### What this PR does / why we need it:
### Checklist
- [ ] I have followed the coding style guidelines of the project.
- [ ] My code passes all existing unit tests.
- [ ] I have added new unit tests to cover the changes where applicable.
- [ ] I have updated the documentation to reflect the changes.
- [ ] My changes do not introduce any new warnings or errors.
- [ ] I have tested my changes thoroughly.

#### Which issue(s) this PR fixes:
<!--
*Automatically closes linked issue when PR is merged.
Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`.
_If PR is about `failing-tests or flakes`, please post the related issues/tests in a comment and do not use `Fixes`_*
-->
Fixes #

#### Special notes for your reviewer:

#### Does this PR introduce a user-facing change?
<!--
If no, just write "NONE" in the release-note block below.
If yes, a release note is required:
Enter your extended release note in the block below. If the PR requires additional action from users switching to the new release, include the string "action required".
-->
```release-note
```

#### Additional documentation e.g., usage docs, etc.:

<!--
This section can be blank if this pull request does not require a release note.
When adding links which point to resources within git repositories, like
KEPs or supporting documentation, please reference a specific commit and avoid
linking directly to the master branch. This ensures that links reference a
specific point in time, rather than a document that may change over time.
See here for guidance on getting permanent links to files: https://help.github.com/en/articles/getting-permanent-links-to-files
Please use the following format for linking documentation:
- [KEP]: <link>
- [Usage]: <link>
- [Other doc]: <link>
-->
```docs
```
### Additional Notes
[Include any additional information, context, or notes that might be helpful for reviewers.]
23 changes: 19 additions & 4 deletions .github/SECURITY.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,22 @@
## Security
# Security Policy

If you discover a security issue, please bring it to my attention!
## Reporting a Vulnerability
We take the security of our project seriously. If you believe you have found a security vulnerability in this repository, please help by following responsible disclosure practices.

### Reporting a Vulnerability
**Please do not submit a regular issue or a pull request for security-related matters.**

If you have information about a security issue, or vulnerability in this package, kindly send your report.
Instead, please report the vulnerability directly. We will strive to provide a timeline for resolution and disclosure of the vulnerability.

Please include the following details in your report:

- A clear description of the vulnerability, including steps to reproduce it.
- The affected versions of the project.
- Any additional information that could help us understand and mitigate the issue.

## Scope
This security policy applies only to the code present in this repository. If you have identified a vulnerability in a third-party library or dependency used by this project, please follow responsible disclosure practices and report it to the maintainers of that project.

## Security Updates
We strive to keep our project dependencies up-to-date. However, as with any software, vulnerabilities may be discovered over time. Please keep an eye on this repository and our releases for any security updates.

Thank you for helping to keep our project safe and secure!
2 changes: 1 addition & 1 deletion .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- "ubuntu-latest"
steps:
- uses: "actions/checkout@v3"
- uses: "actions/setup-go@v3"
- uses: "actions/setup-go@v4"
with:
go-version: "1.20"
check-latest: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- "windows-latest"
steps:
- uses: "actions/checkout@v3"
- uses: "actions/setup-go@v3"
- uses: "actions/setup-go@v4"
with:
go-version: "${{ matrix.go }}"
- run: "go test"
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ repos:
hooks:
- id: codespell
exclude: |
(?x)^.*(\.json)$
(?x)^.*(\.go)$
22 changes: 18 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
FROM alpine:3.14.1
# Use the latest Alpine as the base image
FROM alpine:latest

COPY --from=golang:1.16-alpine /usr/local/go/ /usr/local/go/

# Install necessary dependencies for building Go applications
RUN apk add --no-cache ca-certificates git

# Set the latest Go version as an environment variable
ENV GO_VERSION=1.20.0

# Download and install the latest Go binary
RUN wget -q https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz && \
tar -C /usr/local -xzf go${GO_VERSION}.linux-amd64.tar.gz && \
rm go${GO_VERSION}.linux-amd64.tar.gz

# Add Go binaries to the system path
ENV PATH="/usr/local/go/bin:${PATH}"

# Set the working directory
WORKDIR /go/src/github.com/lindsaygelle/nook

# Copy the application source code into the container
COPY . .

RUN go mod download all
# Download and cache the Go module dependencies
RUN go mod download
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ docker run -it --rm --name nook nook
## Docker-compose
A [`docker-compose.yml`](./docker-compose.yml) file has also been added for convenience.

## Usage
# Usage
The nook package can be used as the starting point for your own Animal Crossing program. By default all current Animal Crossing characters are provided. These can be imported by referencing the type of animal and the characters name.

Accessing individual villagers:
Expand Down
7 changes: 5 additions & 2 deletions animal.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package nook

// Animal is the animal type of an Animal Crossing character.
// Animal represents the animal type of an Animal Crossing character.
type Animal struct {
Key Key
// Key is a unique identifier for the animal type.
Key Key

// Name contains the names of the animal type in different languages.
Name Languages
}
2 changes: 1 addition & 1 deletion animal/README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Animal
Animal exports the various type of animals found in the Animal Crossing series.
Animal exports the various type of animals found in the Animal Crossing series.
14 changes: 9 additions & 5 deletions birthday.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@ import (
"time"
)

// Birthday is the Animal Crossing characters birthday information.
// Birthday represents the birthday information of an Animal Crossing character.
type Birthday struct {
Day uint8
// Day is the day of the month when the character's birthday falls.
Day uint8

// Month is the month of the year when the character's birthday falls.
Month time.Month
}

// Ok returns a boolean indicating whether the Birthday information is complete.
func (v Birthday) Ok() bool {
return (v.Day != 0) && (v.Month != 0)
// Ok returns a boolean indicating whether the Birthday information is complete and valid.
// It checks if both the Day and Month fields have been set.
func (b Birthday) Ok() bool {
return (b.Day != 0) && (b.Month != 0)
}
24 changes: 18 additions & 6 deletions character.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,25 @@
package nook

// Character is a representation of the common attributes for Animal Crossing characters.
// Character is a composite type that combines various attributes of an Animal Crossing character.
type Character struct {
// Animal represents the animal type of the character.
Animal

// Birthday contains the birthday information of the character.
Birthday Birthday
Code Code
Key Key
Gender Gender
Name Languages
Special bool

// Code is a unique identifier for the character.
Code Code

// Key is a unique identifier for the character.
Key Key

// Gender represents the gender of the character.
Gender Gender

// Name contains the names of the character in different languages.
Name Languages

// Special indicates whether the character is special or has a unique role.
Special bool
}
2 changes: 1 addition & 1 deletion character/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Character
Character exports the `nook.Key` references for all `nook.Character` instances.

The character package also contains all Animal Crossing characters, organised into their own separate packages grouped by animal type.
The character package also contains all Animal Crossing characters, organised into their own separate packages grouped by animal type.

This was a requirement due to some Animal Crossing characters sharing the same name. It was also a preference when trying to adopt the most scalable
and hassle free approach when extending and maintaining the numerous characters that are being added to, and modified with each installment to the series. It also allowed for each character to be placed within its own file, relative to the animal type it has. This makes it easier to extend and test each character, without hundreds of lines of code being grouped into a single file.
Expand Down
12 changes: 7 additions & 5 deletions code.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
package nook

// Code is the unique identifier assigned to an Animal Crossing character.
// Codes are based on the data mined from the various Animal Crossing games.
// Code represents the unique identifier assigned to an Animal Crossing character.
// These codes are based on data mined from various Animal Crossing games.
type Code struct {
// Value holds the actual unique identifier code.
Value string
}

// Ok returns a boolean indicating whether the Code information is complete.
func (v Code) Ok() bool {
return v.Value != ""
// Ok returns a boolean indicating whether the Code information is complete and valid.
// It checks if the Value field has been set, meaning the code is not an empty string.
func (c Code) Ok() bool {
return c.Value != ""
}
3 changes: 2 additions & 1 deletion gender.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package nook

// Gender is the gender of an Animal Crossing character.
// Gender represents the gender of an Animal Crossing character.
type Gender struct {
// Name contains the gender name of the character in different languages.
Name Languages
}
Loading

0 comments on commit a223464

Please sign in to comment.