Commit 0e0f23e
committed
Report removal of final newline
If a file does not end in a newline, then every line added to the end of the file results in a diff to the previous final
line.
An example using `\n` to symbolize end of line characters:
https://github.com/arduino-libraries/Servo\n
https://github.com/arduino-libraries/Stepper
When another line is added at the end:
https://github.com/arduino-libraries/Servo\n
https://github.com/arduino-libraries/Stepper\n
https://github.com/arduino-libraries/FooBar
you can see there is necessarily a diff on line 2 even though the editor did not touch that line.
For this reason, it is best practices to always retain a newline at the end of files.
In addition to it being common practice, the GitHub web editor automatically adds this newline. Between this and my
expectation that people would either add URLs to the top of the list or in alphabetical order, leaving the distant end of
the file alone, I was hoping that this would not be a common problem with the library submission system, but this is
simply not a realistic expectation.
What I hadn’t considered is that the person to suffer for this formatting is the next to add a URL to the end of the
file. Because of this “ghost diff”, the submission system sees this PR as a modification to an existing item on the list
rather than an addition.
I think this will be best handled by detecting and dealing with the problem at its introduction, rather than attempting
to make the system resilient to a missing final newline.1 parent 8252c14 commit 0e0f23e
File tree
5 files changed
+77
-23
lines changed- test
- testdata/no-final-newline-diff
5 files changed
+77
-23
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
| 77 | + | |
77 | 78 | | |
78 | 79 | | |
79 | 80 | | |
| |||
127 | 128 | | |
128 | 129 | | |
129 | 130 | | |
130 | | - | |
| 131 | + | |
131 | 132 | | |
132 | 133 | | |
133 | 134 | | |
| |||
177 | 178 | | |
178 | 179 | | |
179 | 180 | | |
180 | | - | |
181 | | - | |
| 181 | + | |
| 182 | + | |
182 | 183 | | |
183 | 184 | | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
184 | 191 | | |
185 | 192 | | |
186 | 193 | | |
187 | 194 | | |
188 | 195 | | |
189 | 196 | | |
190 | 197 | | |
191 | | - | |
| 198 | + | |
192 | 199 | | |
193 | 200 | | |
194 | 201 | | |
| |||
227 | 234 | | |
228 | 235 | | |
229 | 236 | | |
230 | | - | |
| 237 | + | |
231 | 238 | | |
232 | 239 | | |
233 | 240 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
| 49 | + | |
50 | 50 | | |
| 51 | + | |
51 | 52 | | |
52 | 53 | | |
53 | 54 | | |
| |||
62 | 63 | | |
63 | 64 | | |
64 | 65 | | |
65 | | - | |
| 66 | + | |
66 | 67 | | |
| 68 | + | |
67 | 69 | | |
68 | 70 | | |
69 | 71 | | |
| |||
80 | 82 | | |
81 | 83 | | |
82 | 84 | | |
83 | | - | |
| 85 | + | |
84 | 86 | | |
| 87 | + | |
85 | 88 | | |
86 | 89 | | |
87 | 90 | | |
| |||
96 | 99 | | |
97 | 100 | | |
98 | 101 | | |
99 | | - | |
| 102 | + | |
100 | 103 | | |
| 104 | + | |
101 | 105 | | |
102 | 106 | | |
103 | 107 | | |
| |||
112 | 116 | | |
113 | 117 | | |
114 | 118 | | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
119 | 124 | | |
120 | 125 | | |
121 | 126 | | |
| |||
125 | 130 | | |
126 | 131 | | |
127 | 132 | | |
128 | | - | |
| 133 | + | |
129 | 134 | | |
130 | 135 | | |
131 | | - | |
| 136 | + | |
132 | 137 | | |
| 138 | + | |
133 | 139 | | |
134 | 140 | | |
135 | 141 | | |
| |||
143 | 149 | | |
144 | 150 | | |
145 | 151 | | |
146 | | - | |
| 152 | + | |
147 | 153 | | |
| 154 | + | |
148 | 155 | | |
149 | 156 | | |
150 | 157 | | |
| |||
159 | 166 | | |
160 | 167 | | |
161 | 168 | | |
162 | | - | |
| 169 | + | |
163 | 170 | | |
| 171 | + | |
164 | 172 | | |
165 | 173 | | |
166 | 174 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
25 | 30 | | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
31 | 44 | | |
32 | 45 | | |
33 | 46 | | |
| 47 | + | |
34 | 48 | | |
35 | 49 | | |
36 | 50 | | |
| |||
48 | 62 | | |
49 | 63 | | |
50 | 64 | | |
| 65 | + | |
51 | 66 | | |
52 | 67 | | |
53 | 68 | | |
| |||
65 | 80 | | |
66 | 81 | | |
67 | 82 | | |
| 83 | + | |
68 | 84 | | |
69 | 85 | | |
70 | 86 | | |
| |||
82 | 98 | | |
83 | 99 | | |
84 | 100 | | |
| 101 | + | |
85 | 102 | | |
86 | 103 | | |
87 | 104 | | |
| |||
101 | 118 | | |
102 | 119 | | |
103 | 120 | | |
| 121 | + | |
104 | 122 | | |
105 | 123 | | |
106 | 124 | | |
| |||
119 | 137 | | |
120 | 138 | | |
121 | 139 | | |
| 140 | + | |
122 | 141 | | |
123 | 142 | | |
124 | 143 | | |
| |||
136 | 155 | | |
137 | 156 | | |
138 | 157 | | |
| 158 | + | |
139 | 159 | | |
140 | 160 | | |
141 | 161 | | |
| |||
153 | 173 | | |
154 | 174 | | |
155 | 175 | | |
| 176 | + | |
156 | 177 | | |
157 | 178 | | |
158 | 179 | | |
| |||
170 | 191 | | |
171 | 192 | | |
172 | 193 | | |
| 194 | + | |
173 | 195 | | |
174 | 196 | | |
175 | 197 | | |
| |||
187 | 209 | | |
188 | 210 | | |
189 | 211 | | |
| 212 | + | |
190 | 213 | | |
191 | 214 | | |
192 | 215 | | |
| |||
205 | 228 | | |
206 | 229 | | |
207 | 230 | | |
| 231 | + | |
208 | 232 | | |
209 | 233 | | |
210 | 234 | | |
| |||
224 | 248 | | |
225 | 249 | | |
226 | 250 | | |
| 251 | + | |
227 | 252 | | |
228 | 253 | | |
229 | 254 | | |
| |||
242 | 267 | | |
243 | 268 | | |
244 | 269 | | |
| 270 | + | |
245 | 271 | | |
246 | 272 | | |
247 | 273 | | |
| |||
273 | 299 | | |
274 | 300 | | |
275 | 301 | | |
| 302 | + | |
276 | 303 | | |
277 | 304 | | |
278 | 305 | | |
| |||
286 | 313 | | |
287 | 314 | | |
288 | 315 | | |
| 316 | + | |
289 | 317 | | |
290 | 318 | | |
291 | 319 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
0 commit comments