I would like to suggest to add a LuaFormatter configuration to the repository and include it under the Setup dev environment for contributing headline in the README.md. (I just saw that the Readme needs some rework anyway :D )
This is a configuration (config file description) which I quickly created, reading @ryanplusplus comments from #420:
I would like to suggest to add a LuaFormatter configuration to the repository and include it under the
Setup dev environment for contributing
headline in the README.md. (I just saw that the Readme needs some rework anyway :D )This is a configuration (config file description) which I quickly created, reading @ryanplusplus comments from #420:
Diff of high-scores_spec.lua after running LuaFormatter on it
```diff index 336f6db..1672557 100644 --- a/exercises/practice/high-scores/high-scores_spec.lua +++ b/exercises/practice/high-scores/high-scores_spec.lua @@ -9,7 +9,7 @@ describe('high-scores', function() if #a ~= #b then return false end - + for i = 1, #a do if a[i] ~= b[i] then return false @@ -25,90 +25,90 @@ describe('high-scores', function() end) it('Table of scores', function() - local values = {30, 50, 20, 70} - local scores = high_scores{values} - local expected = {30, 50, 20, 70} + local values = { 30, 50, 20, 70 } + local scores = high_scores { values } + local expected = { 30, 50, 20, 70 } assert.True(same_values_in_order(expected, scores:scores())) end) it('Latest score', function() - local values = {100, 0, 90, 30} - local scores = high_scores{values} + local values = { 100, 0, 90, 30 } + local scores = high_scores { values } local expected = 30 assert.equal(expected, scores:latest()) end) it('Personal best', function() - local values = {40, 100, 70} - local scores = high_scores{values} + local values = { 40, 100, 70 } + local scores = high_scores { values } local expected = 100 assert.equal(expected, scores:personal_best()) end) it('Personal top three from a list of scores', function() - local values = {10, 30, 90, 30, 100, 20, 10, 0, 30, 40, 40, 70, 70} - local scores = high_scores{values} - local expected = {100, 90, 70} + local values = { 10, 30, 90, 30, 100, 20, 10, 0, 30, 40, 40, 70, 70 } + local scores = high_scores { values } + local expected = { 100, 90, 70 } assert.True(same_values_in_order(expected, scores:personal_top_three())) end) it('Personal top highest to lowest', function() - local values = {20, 10, 30} - local scores = high_scores{values} - local expected = {30, 20, 10} + local values = { 20, 10, 30 } + local scores = high_scores { values } + local expected = { 30, 20, 10 } assert.True(same_values_in_order(expected, scores:personal_top_three())) end) it('Personal top when there is a tie', function() - local values = {40, 20, 40, 30} - local scores = high_scores{values} - local expected = {40, 40, 30} + local values = { 40, 20, 40, 30 } + local scores = high_scores { values } + local expected = { 40, 40, 30 } assert.True(same_values_in_order(expected, scores:personal_top_three())) end) it('Personal top when there are less than 3', function() - local values = {30, 70} - local scores = high_scores{values} - local expected = {70, 30} + local values = { 30, 70 } + local scores = high_scores { values } + local expected = { 70, 30 } assert.True(same_values_in_order(expected, scores:personal_top_three())) end) it('Personal top when there is only one', function() - local values = {40} - local scores = high_scores{values} - local expected = {40} + local values = { 40 } + local scores = high_scores { values } + local expected = { 40 } assert.True(same_values_in_order(expected, scores:personal_top_three())) end) it('Latest score after personal top scores', function() - local values = {70, 50, 20, 30} - local scores = high_scores{values} + local values = { 70, 50, 20, 30 } + local scores = high_scores { values } local _ = scores:personal_top_three() local expected = 30 assert.equal(expected, scores:latest()) end) it('Scores after personal top scores', function() - local values = {30, 50, 20, 70} - local scores = high_scores{values} + local values = { 30, 50, 20, 70 } + local scores = high_scores { values } local _ = scores:personal_top_three() - local expected = {30, 50, 20, 70} + local expected = { 30, 50, 20, 70 } assert.True(same_values_in_order(expected, scores:scores())) end) it('Latest score after personal best', function() - local values = {20, 70, 15, 25, 30} - local scores = high_scores{values} + local values = { 20, 70, 15, 25, 30 } + local scores = high_scores { values } local _ = scores:personal_best() local expected = 30 assert.equal(expected, scores:latest()) end) it('Scores after personal best', function() - local values = {20, 70, 15, 25, 30} - local scores = high_scores{values} + local values = { 20, 70, 15, 25, 30 } + local scores = high_scores { values } local _ = scores:personal_best() - local expected = {20, 70, 15, 25, 30} + local expected = { 20, 70, 15, 25, 30 } assert.True(same_values_in_order(expected, scores:scores())) end) ```