Skip to content

Commit

Permalink
Merge pull request #60 from iamtomhewitt/java-fx-develop
Browse files Browse the repository at this point in the history
Overhaul
  • Loading branch information
iamtomhewitt authored Dec 30, 2019
2 parents 5f3fbca + 96a41e6 commit 150f63c
Show file tree
Hide file tree
Showing 1,205 changed files with 9,665 additions and 204,615 deletions.
12 changes: 0 additions & 12 deletions .classpath

This file was deleted.

3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[*]
indent_style = tab
indent_size = 4
20 changes: 6 additions & 14 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
/bin/.gitignore
/bin/bugzilla/
/bin/.gitignore
/build
/install/services/OR service/orservice.jar
/install/services/gui service/guiservice.jar
/install/services/document service/documentservice.jar
/install/services/login service/loginservice.jar
/bin/
/microservices/bugzilla live config service/modules/*.pyc
/microservices/bugzilla live list manager service/python/modules/*.pyc
/microservices/bugzilla live list manager service/modules/*.pyc
/microservices/bugzilla live list manager service/bin
/microservices/bugzilla live OR service/modules/*.pyc
/backend/node_modules/
/target/
/frontend/logs/*

dist/bugzilla-live-backend
dist/bugzilla-live.jar
2 changes: 0 additions & 2 deletions .settings/org.eclipse.core.resources.prefs

This file was deleted.

25 changes: 25 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
matrix:
include:
- language: node_js
node_js:
- stable
dist: trusty
install:
- cd backend && npm install && cd ..
script:
- cd backend && npm test && cd ..
- language: java
jdk:
- openjdk8
script: cd frontend && mvn test
deploy:
provider: releases
api_key:
secure: nXV+tKXXCDEo4zZ/eOdIHzR0ElOa9RLYiLRINiVL/AEp4Dd4ymhKHfCkLFVK/k1t6BiAunshEjr6DHZ1Ij5dJcPHWkxZIi3JVueL331tq6JwMoOsgMv/VPVos/I/6TQGugUTd99Ffiitj4VM/K7FAbf6o7CbpxerkscUSHedS1ljfUN9Yx/CmpZXqFXmX6Jz3JpKK0zE9TPxjV0tOmHnLAsUswZPzg5Kz8nvcZ9F0hhqtL64nYyrJULEH97G+u3NKa4ZD9HqlublaW/QMW2kObpFxTYbrO1BjckekdLlKIKAb8ZlyHoxB0V80RRhG1P4ZhHWOmdjjlPZwqX0RLL0M2kQBbHji+vc9LRqonK1zVIJg3RbzghBE88HBWT6lSkQRxX9/W4sXdPYYCqfPmKv3IqN8FNEYrKFuurStHv7J/OFcix9C+QIgP/fa5GKGDHuWYWXf+Rj8wEzJ7shSBwTVB7s8wbtgs67E+oE5wtrfQdSxWsOPCFzkauEpHWbtQ8/p6MB3aCO9fgxXcFDcP1sRUjA4YZLhIjpG3xeoJs1KSYJm6lMLtkOyGmKIpgCSO5eVhAV3VVrSGajKlPB/XwRUAUOCQrVcUw2lrn6GeziUbGDUW/K4Zb0yZl6guMWnyj9uBd3n/wLXbI+yUIKJLT/gwjK31ZQ53PfX2zITNGkhyo=
file:
- "dist/bugzilla-live.zip"
- "dist/CHANGELOG.md"
skip_cleanup: true
on:
tags: true
repo: iamtomhewitt/bugzilla-live
206 changes: 206 additions & 0 deletions CODESTYLE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,206 @@
# Code Style
The following should be applied throughout the code base.

## Layout

### Braces

``` java
if (something)
{
// Correct
}

if (something) {
// Incorrect
}
```

### Packages

* Always lowercase with a '.' between a word, for example: ```some.package.name```
* Should be split into a folder like structure, such as ```common.config``` and ```common.message```

### Imports

* Organise package imports into the same group.
* No wildcard imports.

### Comments

```java
// Example.
```

```java
/**
* A comment that spans
* across multiple lines.
*/
```

### Documentation

* Documentation should only be used when necessary, for example the method ```getName()``` does not need documenting, but a method like ```sendRequestMessage(request)``` would perhaps need some documentation on where the request is going and what type of request it is.

* Each class should also have a relevant documentation block before it:

``` java
/**
* An abstract class for processing messages in the message folder. <p>
* Each service that implements <code>MessageReceiver</code> has a list of file types it is allowed to process - so that each service
* does not process messages made for other services (e.g. the List service cannot processes messages for the Bug service).
*/
public abstract class MessageReceiver
{
// ...
}
```

## Statements

### Classes

* Written in the `UpperCamelCase` form.
* See the Camel Case Definition section for classes which have acronyms.

### Methods

* Written in the `lowerCamelCase` form. Methods should be self describing and only do one thing, for example `updateUsername()` or `getDatabaseConnection()`. If the method does more than one thing, it needs to be refactored.
* Other examples:

```java
exportHtmlSource(); // NOT: exportHTMLSource();
openDvdPlayer(); // NOT: openDVDPlayer();
```

* Methods should have no more than four parameters. If it requires more, refactor your code (for example, use a Builder).
* Parameters should remain on the same line unless its absolutely necessary to put them on a new line (e.g. readability):

```java
throw new IllegalStateException("Failed to process"
+ " request " + request.getId()
+ " for user " + user.getId()
+ " query: '" + query.getText() + "'");
```

### Constants

* Constants are written in `CONSTANT_CASE`:
```java
private int SOME_VARIABLE = 5;
```

### Variables

* Written in the `lowerCamelCase` form. Variables should be self describing:
```java
private String username = "";
private String primaryAddress = "";
private String newCustomerId = "";
```
* Do not use public variables unless absolutely necessary. Variables should be private with a public `get()` and `set()` method.

### Modifiers

* Modifiers should be specified in the following order as defined by the Java Language Specification:

```java
public protected private abstract default static final transient volatile synchronized native strictfp

// Good - static before final
public static final String variable = "";

// Bad - final before static
public final static String variable = "";
```

### Conditions

* Where applicable, use a Ternary operator for simple statements:

```java
int number = 5
boolean isLessThanTen = (number < 10) ? true : false;

// Instead of:

int number = 10;
boolean isLessThanTen;

if (number < 10)
{
isLessThanTen = true;
}
else
{
isLessThanTen = false;
}
```

* Switch statements should always have a default statement:

```java
switch (condition)
{
case someCase:
// do something
break;

case anotherCase:
// do something else
break;

default:
// do a default, perhaps logging or a default value
break
}
```

### Try/Catch

* Clean up with finally:

```java
// Bad - Connection is not closed if sendMessage throws.
if (receivedBadMessage)
{
conn.sendMessage("Bad request.");
conn.close();
}

// Good
if (receivedBadMessage)
{
try
{
conn.sendMessage("Bad request.");
}
finally
{
conn.close();
}
}
```

### Exceptions

* Where appropriate, throw the correct exception instead of just a general `Exception`. If one does not exist, create your own:

```java
class StorageException extends Exception
{
...
}
```

### Camel Case Defined

Camel casing should follow this rule, with the exception of the word ```Bug``` (as this looks like the word ```or```):

| Form | Correct | Incorrect |
|:-----------------------:|:-----------------:|:-----------------:|
| "XML HTTP request" | XmlHttpRequest | XMLHTTPRequest |
| "new customer ID" | newCustomerId | newCustomerID |
| "supports IPv6 on iOS?" | supportsIpv6OnIos | supportsIPv6OnIOS |
| "change Bug request " | changeBugRequest | changeOrRequest |
Loading

0 comments on commit 150f63c

Please sign in to comment.