-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't break lines in some blocks #208
base: main
Are you sure you want to change the base?
Conversation
I'm inclined not to merge this kind of change unless we have some way to maintain the formatting going forward. Otherwise it's going to regress again pretty quickly. |
[=...=]
blocks
I don't know an automatic way to handle this, so I don't have a better idea rather then rely on authors and reviewers. |
I added an agenda to today's meeting. |
Not sure if we should keep |
I misread your message as "inclined to merge", so continued working on that. From one side, checking string length manually doesn't seem convinient. From the other, the overhead doesn't seem to be that big comparing to the advantage of being able to search without tricky regexps. |
This sounds easy to test with a small script, which could be triggered automatically via github actions. Don't know if we want to add a package.json here, but the following should do the trick? const fs = require('fs');
const lines = fs.readFileSync('index.bs').toString().split("\n");
let failed;
for(let i = 0; i < lines.length; i++) {
const line = lines[i];
if (line.lastIndexOf("[=") > line.lastIndexOf("=]")) {
console.log(`Unclosed [= ... =] at line ${i + 1}`)
console.log(`L${i}: ${line}`);
failed = true;
}
if ((line.split("|") - 1).length % 2) {
console.log(`Unclosed | ... | at line ${i + 1}`)
console.log(`L${i}: ${line}`);
failed = true;
}
}
if (failed) {
throw new Error("Unclosed '[= ... =]' or '|...|'");
} |
The Browser Testing and Tools Working Group just discussed The full IRC log of that discussion<sadym> https://github.com//pull/208<jgraham> github: https://github.com//pull/208 <jgraham> sadym: I wanted to find things in the spec, but found that line breaks interfered with that. I reformatted the spec, but there was pushback that it wasn't automatically enforced. jdescottes suggested a script to detect the issue, but I'm not sure how to set it up. <jgraham> (for CI) <jgraham> Scribe AlexRudenko1 <jgraham> q? <jdescottes> q+ <jgraham> ack jdescottes <whimboo> https://github.com/w3c/webdriver-bidi/blob/master/scripts/build.sh <jgraham> q+ <AlexRudenko1> jdescottes: I proposed the script but I don't know what is the preferred tooling. Happy to try smth like this if there is nothing to lint the spec. I can see how to set up github actions to lint <sadym> q+ <whimboo> q+ <jgraham> ack jgraham <sadym> q- <sadym> q+ <whimboo> https://github.com/w3c/webdriver-bidi/blob/master/scripts/test.sh <whimboo> q- <AlexRudenko1> jgraham (IRC): in terms of CI, we already have a job set up that is installing node and running the validation stuff. Because CDDL extraction is still running in node. I think the script will be easy to add to this job. The only problem is that the lint does not automatically fix it and increases the feedback time. If it is irritating enough we can probably write a script to fix it automatically <jgraham> ack sadym <AlexRudenko1> sadym (IRC): I can take another look at that PR and try to implement one of the options. I can take it over. |
I've updated the comment from the css meeting bot given that most of the details were related to other topics. As we agreed on @sadym-chromium will have a look in how to get it integrated into the current scripts that we already run in CI - especially where we install |
ce9da8c
to
c85bbb3
Compare
5251878
to
1a75a4a
Compare
a02ef3c
to
89f7aea
Compare
I added the checks and reformatted the code. |
I think that this looks good and the formatter detects line breaks correctly. I wonder if we should also add this check to the |
29450ae
to
97fcc31
Compare
97fcc31
to
294b993
Compare
294b993
to
ed7ebf9
Compare
done |
Thanks Maksim! @jgraham given that you had concerns regarding missing verifications for upcoming changes can you please do the final review? |
The Browser Testing and Tools Working Group just discussed The full IRC log of that discussion<jgraham> Topic: Don't break lines in some blocks by sadym-chromium<jgraham> GitHub: https://github.com//pull/208 <jgraham> sadym: This PR adds a restriction to not add breaks in specific markdown constructs to make it easier to search in the markdown. We've added some tooling to help enforce this. This PR will involve lots of editing changes to the spec, so it would be nice to land it soon to avoid the need to rebase it and other PRs. <jgraham> jgraham: I will try to look at that. We'll need to coordinate to avoid conflicts when landing |
I wonder if using https://github.com/domfarolino/specfmt is a better approach here (I haven't tested it yet). |
Apparently that doesn't try to enforce this kind of condition yet (and therefore this PR would make us incompatible with using that tool). Bleh. Would be really nice to have some proper autoformatting for specs that could enforce this kind of property. |
To ease text search, added check verifying:
[=...=]
blocks.[...]
blocks.|...|
blocks.<var>...</var>
blocks.<dfn>...</dfn>
blocks.And fixed existing issues in code.
Preview | Diff