Skip to content

Commit

Permalink
Deps updates (#170)
Browse files Browse the repository at this point in the history
* #169 - Updated Dockerfile + docs

* #169 - Updated misc maven deps - no problems

* #169 - Updated maven build to use Boot 3.3.5

* #169 - Updated Gradle build deps

* #169 - Uplift Snakeyaml to v2.2

* #169 - Lombok + Intellisense cleanup

* #169 - Added Lombok to domain objects

* #169 - Added Lombok + cleanup

* #169 - Repo cleanup

* #169 - Use parametrised log statements

* #169 - Use parameterised log statements

* #169 - Use parameterised log statements

* chore: #169 - Use Lombok + parameterised logging

* Some Intellisense cleanup too.

* chore: #169 - Spring 6.1 RequestParam fix

* Since Spring 6.1, RequestParam names are no longer "auto discovered" via Spring magic... you need to specify them or use compiler flags. See: https://github.com/spring-projects/spring-framework/wiki/Spring-Framework-6.1-Release-Notes#parameter-name-retention
* Cleanup of builds files too.

* docs: #169 - Added Code of Conduct & adopt semantic commits

* chore: #169 - Added missing javadoc

* docs: Commit example tweak

* Follow the GitHub convention of using putting the ticket number at end of commit msg.

* docs: Commit example tweak (#169)

* Follow the GitHub convention of using putting the ticket number at end of commit msg.

* chore: Use parameterised logging (#169)

* test: Replace deprecated test class (#169)

* chore: Use parameterised logging (#169)

* chore: Use Lombok + parameterise logging (#169)

* Some misc test code cleanup too.

* chore: Fix Sonar URL whines (#169)

* test: Fix Sonar test whines (#169)

* test: Fix more Sonar test whines (#169)

* test: Fix last Sonar test whines (#169)

* test: Fix deprecated mock usage (#169)

---------

Co-authored-by: gazbert <[email protected]>
  • Loading branch information
gazbert and gazbert authored Nov 14, 2024
1 parent f9a2a4a commit 550c1e4
Show file tree
Hide file tree
Showing 121 changed files with 1,423 additions and 2,983 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ A clear and concise description of what the bug is.
Steps to reproduce the behavior:
1. I configured the bot to run against Bitstamp...
2. I started the bot successfully...
3. When the bot tried to send a buy order, it shutdown with xyz error ...
3. When the bot tried to send a buy order, it shut down with xyz error ...

**Expected behavior**
A clear and concise description of what you expected to happen.
Expand Down
15 changes: 15 additions & 0 deletions .github/ISSUE_TEMPLATE/code_of_conduct_breach.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
name: Code of Conduct breach
about: Report any breaches of the Contributor Covenant.
title: ''
labels: ''
assignees: ''

---

**Code of Conduct**

We support and adopt the [Contributor Covenant](https://www.contributor-covenant.org/) for the BX-bot project.

If you feel that the behaviour of another developer has breached this covenant,
please raise an issue here.
Binary file removed .mvn/wrapper/maven-wrapper.jar
Binary file not shown.
5 changes: 3 additions & 2 deletions .mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.6/apache-maven-3.9.6-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar
wrapperVersion=3.3.2
distributionType=only-script
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip
133 changes: 133 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@

# Contributor Covenant Code of Conduct

## Our Pledge

We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, caste, color, religion, or sexual
identity and orientation.

We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.

## Our Standards

Examples of behavior that contributes to a positive environment for our
community include:

* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the overall
community

Examples of unacceptable behavior include:

* The use of sexualized language or imagery, and sexual attention or advances of
any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email address,
without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Enforcement Responsibilities

Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.

Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.

## Scope

This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official email address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
[BX-bot Issues](https://github.com/gazbert/bxbot/issues).
All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the
reporter of any incident.

## Enforcement Guidelines

Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:

### 1. Correction

**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.

**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.

### 2. Warning

**Community Impact**: A violation through a single incident or series of
actions.

**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or permanent
ban.

### 3. Temporary Ban

**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.

**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.

### 4. Permanent Ban

**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.

**Consequence**: A permanent ban from any sort of public interaction within the
community.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.1, available at
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].

Community Impact Guidelines were inspired by
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].

For answers to common questions about this code of conduct, see the FAQ at
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
[https://www.contributor-covenant.org/translations][translations].

[homepage]: https://www.contributor-covenant.org
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
[Mozilla CoC]: https://github.com/mozilla/diversity
[FAQ]: https://www.contributor-covenant.org/faq
[translations]: https://www.contributor-covenant.org/translations
19 changes: 11 additions & 8 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,13 @@ To work on something, whether a new feature or a bug fix:
git checkout -b my-new-feature-or-bugfix-branch
```
5. Write some code! Commit to that branch locally, and regularly push your work to the same
branch on the server. Commit messages must have a short description no longer than 50 characters
followed by a blank line and a longer, more descriptive message that includes reference to
issue(s) being addressed so that they will be automatically closed on a merge e.g.
```Closes #1234``` or ```Fixes #1234``` - see
branch on the server. When writing a commit message please use
[Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) that include references to
issue being addressed, so that they will be automatically closed on a merge e.g.
```fix: Fixed the NullPointer bug (#123)``` - see
[here](https://help.github.com/articles/closing-issues-via-commit-messages/) for more details.
When writing a commit message please follow
[these conventions](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html).

6. Any code changes that affect documentation (e.g. README.MD) should be accompanied by
6. Any code changes that affect documentation (e.g. README.md) should be accompanied by
corresponding changes (or additions) to the documentation and tests. This will ensure that if
the merged PR is reversed, all traces of the change will be reversed as well.

Expand Down Expand Up @@ -91,4 +89,9 @@ The following conventions should be followed:
* We like static analysis: the build uses [JaCoCo](https://www.jacoco.org/jacoco/) to enforce code
coverage and [SpotBugs](https://spotbugs.github.io/) to weed out bugs.
[Sonarcloud](https://sonarcloud.io/dashboard?id=gazbert_bxbot) is used for analysing and
maintaining the quality of our code. Please maintain this, or better still, help improve it!
maintaining the quality of our code. Please maintain this, or better still, help improve it!

## Code of Conduct
We want the BX-bot project to be a friendly and collaborative development experience for everyone.

We adopt and support the [Contributor Covenant](https://www.contributor-covenant.org/).
9 changes: 5 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
FROM eclipse-temurin:21.0.2_13-jdk
FROM eclipse-temurin:21-jdk

# Install editor for folks to play around with the config.
RUN apt-get update
RUN apt-get install -y maven
RUN apt-get install -y vim

COPY . bxbot-staging

WORKDIR ./bxbot-staging
RUN mvn clean package

RUN ./mvnw clean package
RUN cp ./bxbot-app/target/bxbot-app-*-dist.tar.gz /

WORKDIR /
Expand Down
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
[![Gradle CI](https://github.com/gazbert/bxbot/actions/workflows/gradle.yml/badge.svg?branch=main)](https://github.com/gazbert/bxbot/actions/workflows/gradle.yml)
[![Maven CI](https://github.com/gazbert/bxbot/actions/workflows/maven.yml/badge.svg?branch=main)](https://github.com/gazbert/bxbot/actions/workflows/maven.yml)
[![Sonarcloud Status](https://sonarcloud.io/api/project_badges/measure?project=gazbert_bxbot&metric=alert_status)](https://sonarcloud.io/dashboard?id=gazbert_bxbot)
[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](code_of_conduct.md)
[![Join the chat at https://gitter.im/BX-bot/Lobby](https://badges.gitter.im/BX-bot/Lobby.svg)](https://gitter.im/BX-bot/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

## What is BX-bot?
Expand Down Expand Up @@ -109,7 +110,10 @@ and evaluate the bot, Docker is the way to go.
1. Usage: `./bxbot.sh [start|stop|status]`
1. You can detach from the container and leave the bot running using the `CTRL-p` `CTRL-q` key sequence.
1. To re-attach to the Docker container, run `docker container ls` to get the CONTAINER ID.
Then run: `docker container attach <CONTAINER ID>`
Then run: `docker container attach <CONTAINER ID>`

You could modify the [Dockerfile](./Dockerfile) to containerise the bot and deploy to Kubernetes. The config can
be externalised using a Docker [volume](https://docs.docker.com/engine/storage/) mount.

## Build Guide
If you plan on developing the bot, you'll need JDK 21 installed on your dev box.
Expand Down Expand Up @@ -291,7 +295,7 @@ You specify which markets you want to trade on in the
- id: ltcusd
name: LTC/BTC
baseCurrency: LTC
baseCurrency: LTC[CONTRIBUTING.md](CONTRIBUTING.md)
counterCurrency: BTC
enabled: false
tradingStrategyId: scalping-strategy
Expand Down
37 changes: 19 additions & 18 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ buildscript {
}

dependencies {
classpath('io.spring.gradle:dependency-management-plugin:1.1.4')
classpath('org.springframework.boot:spring-boot-gradle-plugin:3.1.11')
classpath('io.spring.gradle:dependency-management-plugin:1.1.6')
classpath('org.springframework.boot:spring-boot-gradle-plugin:3.3.5')
}
}

plugins {
id 'org.sonarqube' version '5.0.0.4638' // https://plugins.gradle.org/plugin/org.sonarqube
id 'org.sonarqube' version '5.1.0.4882' // https://plugins.gradle.org/plugin/org.sonarqube
id 'jacoco'
id 'com.github.spotbugs' version '5.2.5' // https://plugins.gradle.org/plugin/com.github.spotbugs
id 'com.github.spotbugs' version '6.0.26' // https://plugins.gradle.org/plugin/com.github.spotbugs
}

buildScan {
Expand All @@ -23,11 +23,11 @@ buildScan {
}

ext.versions = [
springBootVersion : '3.1.11',
springCloudVersion : '4.0.5',
springBootVersion : '3.3.5',
springCloudVersion : '4.1.4',

// Should be same as dependency used by springBootVersion
springCoreVersion : '6.0.19',
springCoreVersion : '6.1.14',

hibernateVaildatorVersion: '8.0.1.Final',
jjwtVersion : '0.11.5'
Expand Down Expand Up @@ -56,43 +56,44 @@ ext.libraries = [
spring_cloud_starter : dependencies.create("org.springframework.cloud:spring-cloud-starter:" + ext.versions.springCloudVersion) {
exclude module: "spring-boot-starter-logging"
},

spring_tx : dependencies.create("org.springframework:spring-tx:" + ext.versions.springCoreVersion),

jjwt_api : dependencies.create("io.jsonwebtoken:jjwt-api:" + ext.versions.jjwtVersion),
jjwt_impl : dependencies.create("io.jsonwebtoken:jjwt-impl:" + ext.versions.jjwtVersion),
jjwt_jackson : dependencies.create("io.jsonwebtoken:jjwt-jackson:" + ext.versions.jjwtVersion),

google_guava : dependencies.create("com.google.guava:guava:33.1.0-jre"),
google_gson : dependencies.create("com.google.code.gson:gson:2.10.1"),
h2 : dependencies.create("com.h2database:h2:2.2.224"),
google_guava : dependencies.create("com.google.guava:guava:33.3.1-jre"),
google_gson : dependencies.create("com.google.code.gson:gson:2.11.0"),
h2 : dependencies.create("com.h2database:h2:2.3.232"),

jakarta_mail_api : dependencies.create("jakarta.mail:jakarta.mail-api:2.1.3"),
jakarta_mail_sun : dependencies.create("org.eclipse.angus:angus-mail:2.0.3"),

jakarta_xml_api : dependencies.create("jakarta.xml.bind:jakarta.xml.bind-api:4.0.2"),

snake_yaml : dependencies.create("org.yaml:snakeyaml:1.33"),
snake_yaml : dependencies.create("org.yaml:snakeyaml:2.2"),

springdoc_openapi_ui : dependencies.create("org.springdoc:springdoc-openapi-starter-webmvc-ui:2.2.0"),
springdoc_openapi_ui : dependencies.create("org.springdoc:springdoc-openapi-starter-webmvc-ui:2.6.0"),

lombok : dependencies.create("org.projectlombok:lombok:1.18.32"),
lombok : dependencies.create("org.projectlombok:lombok:1.18.34"),

validation_api : dependencies.create("jakarta.validation:jakarta.validation-api:3.0.2"),
hibernate_validator : dependencies.create("org.hibernate.validator:hibernate-validator:" + ext.versions.hibernateVaildatorVersion),
hibernate_validator_annotation_processor: dependencies.create("org.hibernate.validator:hibernate-validator-annotation-processor:" + ext.versions.hibernateVaildatorVersion),

powermock_junit : dependencies.create("org.powermock:powermock-module-junit4:2.0.9"),
powermock_api_easymock : dependencies.create("org.powermock:powermock-api-easymock:2.0.9"),
easymock : dependencies.create("org.easymock:easymock:5.2.0"),
easymock : dependencies.create("org.easymock:easymock:5.4.0"),

// JUnit 4 still as Powermock does not play with Junit 5: https://github.com/powermock/powermock/issues/929
junit_vintage_engine : dependencies.create("org.junit.vintage:junit-vintage-engine:5.10.2"),
junit_vintage_engine : dependencies.create("org.junit.vintage:junit-vintage-engine:5.11.3"),

spring_boot_starter_test : dependencies.create("org.springframework.boot:spring-boot-starter-test:" + ext.versions.springBootVersion) {
exclude module: "spring-boot-starter-logging"
},
spring_security_test : dependencies.create("org.springframework.security:spring-security-test:6.1.8"),
awaitility : dependencies.create("org.awaitility:awaitility:4.2.1")
spring_security_test : dependencies.create("org.springframework.security:spring-security-test:6.3.4"),
awaitility : dependencies.create("org.awaitility:awaitility:4.2.2")
]

allprojects {
Expand Down Expand Up @@ -167,7 +168,7 @@ subprojects {
ignoreFailures = false
excludeFilter = file("${rootDir}/etc/spotbugs-exclude-filter.xml")
reportsDir = file("$project.buildDir/reports/spotbugs")
effort = "max"
effort = com.github.spotbugs.snom.Effort.MAX
}
spotbugsMain {
reports {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,14 @@
import com.gazbert.bxbot.exchange.api.AuthenticationConfig;
import java.util.HashMap;
import java.util.Map;
import lombok.Setter;

/**
* Exchange API Authentication config.
*
* @author gazbert
*/
@Setter
public class AuthenticationConfigImpl implements AuthenticationConfig {

private Map<String, String> items;
Expand All @@ -54,13 +56,4 @@ public String getItem(String name) {
Map<String, String> getItems() {
return items;
}

/**
* Sets the config items.
*
* @param items the config items.
*/
public void setItems(Map<String, String> items) {
this.items = items;
}
}
Loading

0 comments on commit 550c1e4

Please sign in to comment.