Skip to content
This repository has been archived by the owner on Nov 9, 2022. It is now read-only.

Commit

Permalink
Rename message fields from camelCase to snake_case.
Browse files Browse the repository at this point in the history
The protobuf style guide recommends snake_case:
https://developers.google.com/protocol-buffers/docs/style

Some TODO comments have also been addressed, renaming messages
The sourceId(s) fields have been renamed to ast_node_id(s) as
we're referencing AST nodes, and not source.
  • Loading branch information
aslakhellesoy committed Dec 3, 2019
1 parent 61169b2 commit 620c18b
Show file tree
Hide file tree
Showing 32 changed files with 1,828 additions and 1,828 deletions.
12 changes: 6 additions & 6 deletions src/pickles/compile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ function compileScenario(
const pickle = messages.Pickle.create({
id: newId(),
uri,
sourceIds: [scenario.id],
astNodeIds: [scenario.id],
tags: pickleTags(tags),
name: scenario.name,
language,
Expand Down Expand Up @@ -163,7 +163,7 @@ function compileScenarioOutline(
messages.Pickle.create({
id: newId(),
uri,
sourceIds: [scenario.id, valuesRow.id],
astNodeIds: [scenario.id, valuesRow.id],
name: interpolate(scenario.name, variableCells, valuesRow.cells),
language,
steps,
Expand Down Expand Up @@ -245,17 +245,17 @@ function pickleStep(
valuesRow: messages.GherkinDocument.Feature.ITableRow | null,
newId: NewId
) {
const sourceIds = [step.id]
const astNodeIds = [step.id]
if (valuesRow) {
sourceIds.push(valuesRow.id)
astNodeIds.push(valuesRow.id)
}
const valueCells = valuesRow ? valuesRow.cells : []

return messages.Pickle.PickleStep.create({
id: newId(),
text: interpolate(step.text, variableCells, valueCells),
argument: createPickleArguments(step, variableCells, valueCells),
sourceIds,
astNodeIds,
})
}

Expand All @@ -266,6 +266,6 @@ function pickleTags(tags: messages.GherkinDocument.Feature.ITag[]) {
function pickleTag(tag: messages.GherkinDocument.Feature.ITag) {
return messages.Pickle.PickleTag.create({
name: tag.name,
sourceId: tag.id,
astNodeId: tag.id,
})
}
28 changes: 14 additions & 14 deletions testdata/good/background.feature.pickles.ndjson
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
{
"pickle": {
"astNodeIds": [
"2"
],
"id": "7",
"language": "en",
"name": "minimalistic",
"sourceIds": [
"2"
],
"steps": [
{
"id": "5",
"sourceIds": [
"astNodeIds": [
"0"
],
"id": "5",
"text": "the minimalism inside a background"
},
{
"id": "6",
"sourceIds": [
"astNodeIds": [
"1"
],
"id": "6",
"text": "the minimalism"
}
],
Expand All @@ -27,25 +27,25 @@
}
{
"pickle": {
"astNodeIds": [
"4"
],
"id": "10",
"language": "en",
"name": "also minimalistic",
"sourceIds": [
"4"
],
"steps": [
{
"id": "8",
"sourceIds": [
"astNodeIds": [
"0"
],
"id": "8",
"text": "the minimalism inside a background"
},
{
"id": "9",
"sourceIds": [
"astNodeIds": [
"3"
],
"id": "9",
"text": "the minimalism"
}
],
Expand Down
68 changes: 34 additions & 34 deletions testdata/good/complex_background.feature.pickles.ndjson
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
{
"pickle": {
"astNodeIds": [
"2"
],
"id": "13",
"language": "en",
"name": "minimalistic",
"sourceIds": [
"2"
],
"steps": [
{
"id": "11",
"sourceIds": [
"astNodeIds": [
"0"
],
"id": "11",
"text": "the minimalism inside a background"
},
{
"id": "12",
"sourceIds": [
"astNodeIds": [
"1"
],
"id": "12",
"text": "the minimalism"
}
],
Expand All @@ -27,25 +27,25 @@
}
{
"pickle": {
"astNodeIds": [
"4"
],
"id": "16",
"language": "en",
"name": "also minimalistic",
"sourceIds": [
"4"
],
"steps": [
{
"id": "14",
"sourceIds": [
"astNodeIds": [
"0"
],
"id": "14",
"text": "the minimalism inside a background"
},
{
"id": "15",
"sourceIds": [
"astNodeIds": [
"3"
],
"id": "15",
"text": "the minimalism"
}
],
Expand All @@ -54,34 +54,34 @@
}
{
"pickle": {
"id": "20",
"language": "en",
"name": "with examples",
"sourceIds": [
"astNodeIds": [
"10",
"8"
],
"id": "20",
"language": "en",
"name": "with examples",
"steps": [
{
"id": "17",
"sourceIds": [
"astNodeIds": [
"0"
],
"id": "17",
"text": "the minimalism inside a background"
},
{
"id": "18",
"sourceIds": [
"astNodeIds": [
"5"
],
"id": "18",
"text": "a rule background step"
},
{
"id": "19",
"sourceIds": [
"astNodeIds": [
"6",
"8"
],
"id": "19",
"text": "the 1 minimalism"
}
],
Expand All @@ -90,34 +90,34 @@
}
{
"pickle": {
"id": "24",
"language": "en",
"name": "with examples",
"sourceIds": [
"astNodeIds": [
"10",
"9"
],
"id": "24",
"language": "en",
"name": "with examples",
"steps": [
{
"id": "21",
"sourceIds": [
"astNodeIds": [
"0"
],
"id": "21",
"text": "the minimalism inside a background"
},
{
"id": "22",
"sourceIds": [
"astNodeIds": [
"5"
],
"id": "22",
"text": "a rule background step"
},
{
"id": "23",
"sourceIds": [
"astNodeIds": [
"6",
"9"
],
"id": "23",
"text": "the 2 minimalism"
}
],
Expand Down
26 changes: 13 additions & 13 deletions testdata/good/datatables.feature.pickles.ndjson
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"pickle": {
"astNodeIds": [
"13"
],
"id": "19",
"language": "en",
"name": "minimalistic",
"sourceIds": [
"13"
],
"steps": [
{
"argument": {
Expand Down Expand Up @@ -34,10 +34,10 @@
]
}
},
"id": "14",
"sourceIds": [
"astNodeIds": [
"2"
],
"id": "14",
"text": "a simple data table"
},
{
Expand All @@ -54,10 +54,10 @@
]
}
},
"id": "15",
"sourceIds": [
"astNodeIds": [
"4"
],
"id": "15",
"text": "a data table with a single cell"
},
{
Expand All @@ -80,10 +80,10 @@
]
}
},
"id": "16",
"sourceIds": [
"astNodeIds": [
"6"
],
"id": "16",
"text": "a data table with different fromatting"
},
{
Expand All @@ -104,10 +104,10 @@
]
}
},
"id": "17",
"sourceIds": [
"astNodeIds": [
"8"
],
"id": "17",
"text": "a data table with an empty cell"
},
{
Expand Down Expand Up @@ -147,10 +147,10 @@
]
}
},
"id": "18",
"sourceIds": [
"astNodeIds": [
"12"
],
"id": "18",
"text": "a data table with comments and newlines inside"
}
],
Expand Down
Loading

0 comments on commit 620c18b

Please sign in to comment.