Skip to content

Commit 1fe84e4

Browse files
committed
Enforce coding style conventions
1 parent 218c860 commit 1fe84e4

File tree

3 files changed

+33
-11
lines changed

3 files changed

+33
-11
lines changed

.editorconfig

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# https://editorconfig.org
2+
3+
root = true
4+
5+
[*]
6+
end_of_line = lf
7+
insert_final_newline = true
8+
charset = utf-8
9+
indent_style = space
10+
indent_size = 2

CONTRIBUTING.md

+11-6
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ Reporting bugs is a great way to contribute! Whilst we use [Sentry](https://sent
99
If you're comfortable writing code then feel free to [fork](https://github.com/CHTJonas/roombooking/fork) the repo and open a corresponding [pull request](https://github.com/CHTJonas/roombooking/compare). Remember that this is open source software so please consider the other people who will read your code. Make it look nice for them and document your changes in code comments.
1010

1111
## Getting Started
12-
Before you dive in and start contributing you should familiarise yourself with the overall architecture of the project. The Room Booking System is built on top of the [Ruby on Rails](https://rubyonrails.org/) web framework. Rails was picked because it is an easy framework to get started with and because the [Ruby](https://www.ruby-lang.org/en/) is elegant and natural programming language for beginners. Rails is what's called a MVC (model-view-controller) framework and you should make sure you read the [guides](https://guides.rubyonrails.org) before you start hacking at the codebase.
12+
Before you dive in and start contributing you should familiarise yourself with the overall architecture of the project. The Room Booking System is built on top of the [Ruby on Rails](https://rubyonrails.org/) web framework. Rails was picked because it's an easy framework to get started with and because [Ruby](https://www.ruby-lang.org/en/) is an elegant and natural programming language for beginners. Rails is what's called a MVC (model-view-controller) framework and you should make sure you read the [guides](https://guides.rubyonrails.org) before you start hacking the codebase.
1313

14-
The speed of the app is important - web requests shouldn't take longer than around three hundred milliseconds. In order to keep the frontend snappy, as much processing as possible is offloaded to a background job engine. We use [Sidekiq](https://sidekiq.org/) for this purpose. We also use [Redis](https://redis.io/) to cache certain data in-memory for quick retrieval at a later point without the potentially costly time it would take to recompute.
14+
The speed of the app is important - web requests shouldn't take longer than about three or four hundred milliseconds. In order to keep the frontend snappy, as much processing as possible is offloaded to a background job engine. We use [Sidekiq](https://sidekiq.org/) for this purpose. We also use [Redis](https://redis.io/) to cache certain data in-memory for quick retrieval at a later point without the potentially costly time it would take to recompute.
1515

1616
We also use Redis in a few limited circumstances as a persistent key/value store. However the bulk of Room Booking System data is stored in the database for which we use [PostgreSQL](https://www.postgresql.org/).
1717

@@ -24,15 +24,20 @@ We also use Redis in a few limited circumstances as a persistent key/value store
2424
* When changing documentation or HTML text, include [ci skip] in the commit title.
2525

2626
## Coding Conventions
27-
* Indent using two spaces (soft tabs).
28-
* put spaces after list items, operators and method parameters (`[1, 2, 3]` not `[1,2,3]` and `x += 1` not `x+=1`).
29-
* We use HTML+ERB for almost all views.
27+
* Use a single space after list items, operators and method parameters (`[1, 2, 3]` not `[1,2,3]` and `x += 1` not `x+=1`).
28+
* We use HTML+ERB for most dynamic views, and HAML for large static pages.
3029
* Put HTML generators in helpers.
3130
* Put logic in models.
3231
* Put database-querying code in controllers.
3332
* Put complicated workflows in service objects.
3433

35-
## Design Decisions
34+
## Style Conventions
35+
* Use UNIX-style (LF) line endings.
36+
* End every file with a single blank line.
37+
* Use the UTF-8 character set.
38+
* Indent code blocks using two spaces (please don't use tabs).
39+
40+
## Executive Decisions
3641
Whilst this is an open-source project developed for the benefit of the Cambridge theatre community, there will be times in which we make a significant decision regarding how we maintain the project and what we can or cannot support. We reserve the right to make such executive decisions if necessary. Please also note that changes that are cosmetic in nature and do not add anything substantial to the stability, functionality, or testability of the project will generally not be accepted.
3742

3843
## I've got a question!

README.md

+12-5
Original file line numberDiff line numberDiff line change
@@ -51,21 +51,28 @@ To optionally start Sidekiq to process background jobs you can run `bundle exec
5151
Pressing Ctrl+C will interrupt and shutdown either one of these.
5252

5353
## Contributing
54-
Anyone may contribute and bug reports or feature requests are warmly welcomed!
55-
Please read the [contributing guidelines](https://github.com/CHTJonas/roombooking/blob/master/CONTRIBUTING.md) first.
56-
If you think this is something you can code yourself:
54+
Anyone may contribute to the project and bug reports or feature requests are warmly welcomed!
55+
Please familiarise yourself with the [contributing guidelines](https://github.com/CHTJonas/roombooking/blob/master/CONTRIBUTING.md) before you get started.
56+
If you decide you want to write some code yourself:
5757
1. Fork the repo (https://github.com/CHTJonas/roombooking/fork).
58-
2. Create your feature branch (`git checkout -b my-new-feature`).
58+
2. Create a feature branch (`git checkout -b my-new-feature`).
5959
3. Commit your changes (`git commit -am 'Add some feature'`).
6060
4. Push to the branch (`git push -u origin my-new-feature`).
6161
5. Create a new Pull Request.
6262

63-
When you add, change or remove any code please try and add appropriate testing.
63+
When coding, please try to update any tests your code affects or, even better, add new tests where none currently exist!
6464
Don't worry if you're not too sure about this - if you open a Pull Request we can provide some assistance.
6565
To run the full test suite, type the following into your terminal (or append to `docker-compose run --rm web`):
6666
1. `rails test`
6767
2. `rails test:system`
6868

69+
Please ensure your code adheres to the following basic style rules.
70+
You should be able to do this automatically by installing an [EditorConfig compatible](https://editorconfig.org/#download) text editor/IDE, or a plugin.
71+
* Use UNIX-style (LF) line endings.
72+
* End every file with a single blank line.
73+
* Use the UTF-8 character set.
74+
* Indent code blocks using two spaces (please don't use tabs).
75+
6976
Management of the project is meritocratic; those who have a reasonable number of accepted contributions will be granted access to commit straight to the `master` branch of this repository.
7077

7178
## Copyright

0 commit comments

Comments
 (0)