-
Notifications
You must be signed in to change notification settings - Fork 14
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
Create a script that verifies issues marked in a TODO are open #946
Comments
Marking as high priority for dev meeting - but mainly just first to decide if we should put in the effort for this script, or if this is a rare enough issue to not yet worry about. |
Discussion 5/21/20
Reassigning to @ariel-phet to assign someone to investigate. |
To help determine how useful this would be, I hacked the lint script to print all TODOs with an issue reference URL (I didn't check for I used this patch: Index: eslint/rules/todo-should-have-issue.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- eslint/rules/todo-should-have-issue.js (revision d264fd91c408e0c77cc8ab3f6f1cd15e0caa2ef6)
+++ eslint/rules/todo-should-have-issue.js (date 1590096288407)
@@ -11,42 +11,46 @@
module.exports = function( context ) {
// Whitelist of directories to check that TODOs have GitHub issues
- const directoriesToRequireIssues = [ /joist[/\\]js/ ];
+ // const directoriesToRequireIssues = [ /joist[/\\]js/ ];
return {
Program: function checkTodoShouldHaveIssue( node ) {
// Check whether the given directory matches the whitelist
- let directoryShouldBeChecked = false;
- for ( let i = 0; i < directoriesToRequireIssues.length; i++ ) {
- const d = directoriesToRequireIssues[ i ];
- if ( context.getFilename().match( d ) ) {
- directoryShouldBeChecked = true;
- break;
- }
- }
+ // let directoryShouldBeChecked = true;
+ // for ( let i = 0; i < directoriesToRequireIssues.length; i++ ) {
+ // const d = directoriesToRequireIssues[ i ];
+ // if ( context.getFilename().match( d ) ) {
+ // directoryShouldBeChecked = true;
+ // break;
+ // }
+ // }
- if ( directoryShouldBeChecked ) {
+ if ( true ) {
const comments = context.getSourceCode().getAllComments();
if ( comments ) {
for ( let i = 0; i < comments.length; i++ ) {
const comment = comments[ i ];
- if ( comment.value.indexOf( 'TODO' ) >= 0 ) {
+ if ( comment.value.indexOf( 'TODO' ) >= 0 && comment.value.indexOf( '/issues/' ) >= 0 ) {
+
+ const startIndex = comment.value.indexOf('https://github.com/phetsims/');
+ const tail = comment.value.substring(startIndex);
+ console.log( tail );
// '#' followed by any number of digits
- const missingIssueNumber = comment.value.search( /#\d+/ ) === -1;
- const missingLink = comment.value.indexOf( 'https://github.com/phetsims/' ) === -1;
-
- if ( missingLink && missingIssueNumber ) {
- context.report( {
- node: comment,
- loc: comment.loc.start,
- message: 'TODO should have an issue: ' + comment.value
- } );
- }
+ // const missingIssueNumber = comment.value.search( /#\d+/ ) === -1;
+ // const missingLink = comment.value.indexOf( 'https://github.com/phetsims/' ) === -1;
+ //
+ // if ( missingLink && missingIssueNumber ) {
+ // context.report( {
+ // node: comment,
+ // loc: comment.loc.start,
+ // message: 'TODO should have an issue: ' + comment.value
+ // } );
+ // }
}
}
}
|
Good progress here today! I made |
Ok. That should do it. @samreid can you please review? |
Here is the log from daily-grunt-work last night:
When it catches something for reopening, it would say something like this for each issue below those lines: |
Looks very great! Nice work. Some review comments:
|
Noting that we can see all the issues that have been effected by this script with: I updated to support if chipper/dist doesn't exist. I see that my regex doesn't support something like this: https://github.com/phetsims/aqua/blob/d9bf6eba1244186646af8d236bcb5bfccbedd2a1/js/local/unitTestBatch.js#L32. Updating now. |
Anything else here? |
Excellent, the changes seem good. Thanks for building this, it has already been very useful! Closing. |
…ims/chipper#946" This reverts commit 7953bb0939e3545ae24331530261221167135ce7.
Last week @zepumph @chrisklus and I came across a TODO marked with an issue number and were surprised to see the issue was closed. The issue should have remained open since there was work identified in the code TODO. Would it be possible to create a script that we can run every now and then which will identify all TODOs in the code that reference issues, and for each one check the GitHub API to confirm those issues are open? For issues that have been closed, they should be reopened until the TODO is addressed.
The file chipper/eslint/rules/todo-should-have-issue.js shows how lint uses esprima to get all of the code comments for a file (includes single and multi-line comments). We would probably want to use esprima directly for simplicity: https://esprima.org/index.html
I created this issue here in chipper since it feels somewhat "lint-ish". However, I don't recommend running github API calls as part of the normal lint rules.
@ariel-phet can you please prioritize and assign?
The text was updated successfully, but these errors were encountered: