Open stramel opened 2 years ago
Happy to take a PR to support multiple headers
// A
// B
// C
Until we have that consider using a single docblock header:
/**
* A
* B
*/
I can confirm this issue, ran into it today. May I suggest to document the (sole?) supported header type in the readme, until a respective PR is taken?
@suterma Happy to take a PR documenting the limitation in a lightweight manner. Preferred of course is a PR that adds support for // license headers
.
I took a quick look, turns out it's a bit tricky. When you say /*
you get a single block, but with //
you get multiple lines.
[
[
{
"type": "Block",
"value": "*\n * Copyright (c) Foo Corp.\n *\n * This source code is licensed under the WTFPL license found in the\n * LICENSE file in the root of this projects source tree.\n ",
"range": [
0,
164
],
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 6,
"column": 3
}
}
},
{
"type": "Block",
"value": "* do this ",
"range": [
166,
180
],
"loc": {
"start": {
"line": 8,
"column": 0
},
"end": {
"line": 8,
"column": 14
}
}
}
]
]
[
[
{
"type": "Line",
"value": "",
"range": [
0,
2
],
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 2
}
}
},
{
"type": "Line",
"value": " Copyright (c) Foo Corp.",
"range": [
3,
29
],
"loc": {
"start": {
"line": 2,
"column": 0
},
"end": {
"line": 2,
"column": 26
}
}
},
{
"type": "Line",
"value": "",
"range": [
30,
32
],
"loc": {
"start": {
"line": 3,
"column": 0
},
"end": {
"line": 3,
"column": 2
}
}
},
{
"type": "Line",
"value": " This source code is licensed under the WTFPL license found in the",
"range": [
33,
101
],
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 4,
"column": 68
}
}
},
{
"type": "Line",
"value": " LICENSE file in the root of this projects source tree.",
"range": [
102,
159
],
"loc": {
"start": {
"line": 5,
"column": 0
},
"end": {
"line": 5,
"column": 57
}
}
},
{
"type": "Line",
"value": "",
"range": [
160,
162
],
"loc": {
"start": {
"line": 6,
"column": 0
},
"end": {
"line": 6,
"column": 2
}
}
},
{
"type": "Block",
"value": "* do this ",
"range": [
167,
181
],
"loc": {
"start": {
"line": 9,
"column": 0
},
"end": {
"line": 9,
"column": 14
}
}
}
]
]
I attempted to merge these, but couldn't get it to work, maybe that's not the right strategy? Here's a test if someone wants to beat me to iterating on it.
Describe the Bug
When using this header,
the fix results in incorrect behavior
Steps to Reproduce
license-header.js
file to contain the content above.--fix
flagActual Behavior
First run,
second consecutive run,
Expected Behavior
I would expect the license header to be properly applied.
Environment