You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+12-12Lines changed: 12 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -27,7 +27,7 @@ For general guidelines about contributing to Exercism see the [Exercism contribu
27
27
28
28
Hi! Thanks for contributing to the Exercism Java track!
29
29
30
-
Before opening your pull request, please review the [track policies](https://github.com/exercism/java/blob/master/POLICIES.md) and make sure your changes comply with them all.
30
+
Before opening your pull request, please review the [track policies](https://github.com/exercism/java/blob/main/POLICIES.md) and make sure your changes comply with them all.
31
31
This helps us focus our review time on the more important aspects of your contributions.
32
32
33
33
Also please only address one issue per pull request and reference the issue in your pull request. This makes it easier for us to review it, and it means that if we request changes to the fix for one issue, it won't prevent to a fix for another issue being merged.
@@ -48,7 +48,7 @@ To submit a fix for an existing exercise or port an exercise to Java with the le
48
48
(see [exercism.io: Installing Java](https://exercism.org/docs/tracks/java/installation))
49
49
-**Setup a branch on a fork of [exercism/java](https://github.com/exercism/java) on your computer.**
50
50
51
-
See [GitHub Help: Forking](https://help.github.com/articles/fork-a-repo/). Use those instructions (in conjunction with the [Git Basics doc](https://github.com/exercism/docs/blob/master/contributing/git-basics.md)) to:
51
+
See [GitHub Help: Forking](https://help.github.com/articles/fork-a-repo/). Use those instructions (in conjunction with the [Contributing via GitHub](https://github.com/exercism/docs/tree/main/building/github#contributing-via-github)) to:
52
52
* "fork" a repository on GitHub;
53
53
- install `git`;
54
54
- "clone" a copy of your fork;
@@ -164,7 +164,7 @@ The easiest way to achieve this is simply use the `bin/journey-test.sh` script.
164
164
The easiest way to add a new exercise to the Java track is to port an exercise from another track.
165
165
That means that you take an exercise that has already been implemented in another language and you implement it in this track.
166
166
167
-
To add a completely new exercise you need to open a pull request to the [problem specifications repository](https://github.com/exercism/problem-specifications/tree/master/exercises).
167
+
To add a completely new exercise you need to open a pull request to the [problem specifications repository](https://github.com/exercism/problem-specifications/tree/main/exercises).
168
168
Any completely new exercise needs to be added and accepted there before it can be added to the Java track.
169
169
170
170
There is a [general Exercism guide for porting an exercise to a new language](https://github.com/exercism/docs/blob/master/you-can-help/implement-an-exercise-from-specification.md).
@@ -186,7 +186,7 @@ This list is in alphabetical order so please add your exercise so that it mainta
186
186
187
187
* Please add an exercise submodule for your exercise.
188
188
See [The Problem Submodules](#the-problem-submodules) section for what needs to be in this.
189
-
See the [POLICIES doc](https://github.com/exercism/java/blob/master/POLICIES.md#starter-implementations) for an explanation of when you need to add a starter implementation.
189
+
See the [POLICIES doc](https://github.com/exercism/java/blob/main/POLICIES.md#starter-implementations) for an explanation of when you need to add a starter implementation.
190
190
The `build.gradle` file can just be copied from any other exercise submodule.
191
191
The `README.md` file can be generated using [configlet](https://github.com/exercism/configlet/releases).
192
192
You can do this by:
@@ -203,16 +203,16 @@ If there is canonical data for your exercise then you should follow this when ma
203
203
We aim to follow the canonical data as closely as possible in our tests to ensure thorough test coverage.
204
204
If there is canonical data available you also need to create a file at `exercises/exercise-slug/.meta/version` specifying the canonical data version you have implemented (e.g. `1.0.0`).
205
205
The canonical data version can be found at the top of the canonical data file for that exercise.
206
-
See other exercises, e.g. [acronym](https://github.com/exercism/java/tree/master/exercises/acronym/.meta), for an example `version` file.
206
+
See other exercises, e.g. [acronym](https://github.com/exercism/java/tree/main/exercises/practice/acronym/.meta), for an example `version` file.
207
207
208
-
* Make sure you've followed the [track policies](https://github.com/exercism/java/blob/master/POLICIES.md), especially the ones for exercise added/updated.
208
+
* Make sure you've followed the [track policies](https://github.com/exercism/java/blob/main/POLICIES.md), especially the ones for exercise added/updated.
209
209
210
210
Hopefully that should be enough information to help you port an exercise to the Java track.
211
211
Feel free to open an issue or post in the [Gitter exercism/java room](https://gitter.im/exercism/java) if you have any questions and we'll try and answer as soon as we can.
212
212
213
213
## Updating the READMEs
214
214
215
-
The `README.md` files are generated from the exercise descriptions in [problem specifications](https://github.com/exercism/problem-specifications/tree/master/exercises).
215
+
The `README.md` files are generated from the exercise descriptions in [problem specifications](https://github.com/exercism/problem-specifications/tree/main/exercises).
216
216
They need to be regenerated regularly so that any changes to the descriptions in problem specifications propagate to our READMEs.
217
217
This can be done using [configlet](https://github.com/exercism/configlet/releases):
218
218
@@ -224,14 +224,14 @@ This can be done using [configlet](https://github.com/exercism/configlet/release
224
224
225
225
## Checking tests are up to date
226
226
227
-
The tests for each exercise should follow the canonical data in [problem specifications](https://github.com/exercism/problem-specifications/tree/master/exercises) as closely as possible.
227
+
The tests for each exercise should follow the canonical data in [problem specifications](https://github.com/exercism/problem-specifications/tree/main/exercises) as closely as possible.
228
228
The canonical data can change quite regularly, in which case the [canonical data version](https://github.com/exercism/problem-specifications#test-data-versioning) for that exercise will be updated.
229
229
230
-
We keep track of which version of the canonical data each exercise implements in a version file, for example: https://github.com/exercism/java/blob/master/exercises/two-fer/.meta/version.
230
+
We keep track of which version of the canonical data each exercise implements in a version file, for example: https://github.com/exercism/java/blob/main/exercises/practice/two-fer/.meta/version.
231
231
Not all exercises have canonical data in problem specifications.
232
232
For those that don't we don't add a version file.
233
233
234
-
We have [a script](https://github.com/exercism/java/blob/master/scripts/canonical_data_check.sh) which can check if these version are up to date with the ones in problem specification.
234
+
We have [a script](https://github.com/exercism/java/blob/main/scripts/canonical_data_check.sh) which can check if these version are up to date with the ones in problem specification.
235
235
This script can be used to check if any version files, tests and reference implementations need updating.
236
236
237
237
To run this script:
@@ -242,7 +242,7 @@ To run this script:
242
242
243
243
## Checking tests are up to date and submit new issues
244
244
245
-
There is [a script which allows you to submit new issues](https://github.com/exercism/java/blob/master/scripts/create_issues_versionchange_canonical.sh) to this repo with generic title, description and labels if a change in version was detected.
245
+
There is [a script which allows you to submit new issues](https://github.com/exercism/java/blob/main/scripts/create_issues_versionchange_canonical.sh) to this repo with generic title, description and labels if a change in version was detected.
## Checking exercises are implemented and submit new issues
273
273
274
-
There is [a script](https://github.com/exercism/java/blob/master/scripts/create_issues_new_exercise.sh) which allows you to easily check if there are any exercism exercises which haven't been implemented in the Java track, and create issues for those exercises if there are any.
274
+
There is [a script](https://github.com/exercism/java/blob/main/scripts/create_issues_new_exercise.sh) which allows you to easily check if there are any exercism exercises which haven't been implemented in the Java track, and create issues for those exercises if there are any.
275
275
276
276
Before you may submit a new issue, the script
277
277
1. Checks whether the exercise exists in the Java track (compared to exercism/problem-specifications)
> - Exercises of difficulty 4 or lower: provide stubs for all required constructors and methods. This means that you need to provide stubs for those constructors or methods that are necessary to pass all tests. E.g. stubs for private methods may be skipped.
37
37
Stubs should include the following body:
38
38
`throw new UnsupportedOperationException("Delete this statement and write your own implementation.");`
39
-
> - Exercises of difficulty 5 or higher: copy the StubTemplate.java file (provided [here](https://github.com/exercism/java/tree/master/_template/src/main/java)) and rename it to fit the exercise. For example, for the exercise linked-list the file could be named LinkedList.java. Then either (1) add hints to the hints.md file (which gets merged into the README.md for the exercise) or (2) provide stubs as above for exercises that demand complicated method signatures.
39
+
> - Exercises of difficulty 5 or higher: copy the StubTemplate.java file (provided [here](https://github.com/exercism/java/tree/main/_template/src/main/java)) and rename it to fit the exercise. For example, for the exercise linked-list the file could be named LinkedList.java. Then either (1) add hints to the hints.md file (which gets merged into the README.md for the exercise) or (2) provide stubs as above for exercises that demand complicated method signatures.
> If you're testing a class called `SomeClassName` then your test class should be called `SomeClassNameTest`.
105
105
106
-
> The exception to this is if the tests are split into several test classes where each test class tests different functionality. In that case each class should be named `SomeClassNameFunctionalityTest` where `Functionality` is the name of the functionality to be tested in that class. See the [clock exercise](https://github.com/exercism/java/tree/master/exercises/clock) as an example.
106
+
> The exception to this is if the tests are split into several test classes where each test class tests different functionality. In that case each class should be named `SomeClassNameFunctionalityTest` where `Functionality` is the name of the functionality to be tested in that class. See the [clock exercise](https://github.com/exercism/java/tree/main/exercises/practice/clock) as an example.
> Therefore a hints.md file should be added to the .meta directory for every exercise with difficulty 5.
117
117
> This file should explain what they need to do when there is no starter implementation.
118
-
> The files should all be the same so you can copy it from any other exercise with difficulty 5, e.g. [flatten-array](https://github.com/exercism/java/tree/master/exercises/flatten-array/.meta/hints.md).
118
+
> The files should all be the same so you can copy it from any other exercise with difficulty 5, e.g. [flatten-array](https://github.com/exercism/java/tree/main/exercises/pratice/flatten-array/.meta/hints.md).
119
119
120
120
> We add the file to every exercise with difficulty 5 because the structure of the track means that we don't know which exercise will be the first one without starter implementation that a user will be faced with.
> The [canonical data](https://github.com/exercism/problem-specifications/tree/master/exercises) for each exercise intentionally doesn't deal with error handling.
134
+
> The [canonical data](https://github.com/exercism/problem-specifications/tree/main/exercises) for each exercise intentionally doesn't deal with error handling.
135
135
> When an error has occured or a method can't return anything, the canonical data will just mark that as `"expected": null`.
136
136
> This is because error handling varies from language to language, so the canonical data is leaving it up to each language track to decide how to deal with those situations.
137
137
> It doesn't mean that the method needs to return `null`.
> It's considered best practice to deal with errors and unexpected circumstances by throwing exceptions.
143
143
> If you throw an exception then you force the user to deal with the problem.
144
-
> You can either define your own exception (see [the triangle exercise](https://github.com/exercism/java/blob/master/exercises/triangle/.meta/src/reference/java/TriangleException.java) for an example) or use a predefined one (see [the collatz-conjecture exercise](https://github.com/exercism/java/blob/master/exercises/collatz-conjecture/src/test/java/CollatzCalculatorTest.java) for an example).
144
+
> You can either define your own exception (see [the triangle exercise](https://github.com/exercism/java/blob/main/exercises/practice/triangle/.meta/src/reference/java/TriangleException.java) for an example) or use a predefined one (see [the collatz-conjecture exercise](https://github.com/exercism/java/blob/main/exercises/practice/collatz-conjecture/src/test/java/CollatzCalculatorTest.java) for an example).
145
145
146
146
> Another option is to use [Optionals](https://docs.oracle.com/javase/8/docs/api/java/util/Optional.html).
147
147
> This can be more suitable if the case you want to deal with isn't an exceptional occurence, but rather an expected scenario, e.g. a search method not finding what it was searching for.
148
-
> See [the word-search exercise](https://github.com/exercism/java/blob/master/exercises/word-search/src/test/java/WordSearcherTest.java) for an example where `Optional` is used.
148
+
> See [the word-search exercise](https://github.com/exercism/java/blob/main/exercises/practice/word-search/src/test/java/WordSearcherTest.java) for an example where `Optional` is used.
> Furthermore, you can make assertions on the state of a domain object after the exception has been thrown.
160
160
> To be consistent, please use `assertThrows` whenever you expect an exception to be thrown.
161
161
162
-
> See [the triangle tests](https://github.com/exercism/java/blob/master/exercises/triangle/src/test/java/TriangleTest.java) for an example of where `assertThrows` is used.
162
+
> See [the triangle tests](https://github.com/exercism/java/blob/main/exercises/practice/triangle/src/test/java/TriangleTest.java) for an example of where `assertThrows` is used.
0 commit comments