Skip to content
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

Change all XXXs to FIXMEs #3303

Closed
brson opened this issue Aug 30, 2012 · 25 comments
Closed

Change all XXXs to FIXMEs #3303

brson opened this issue Aug 30, 2012 · 25 comments
Labels
C-cleanup Category: PRs that clean code up or issues documenting cleanup. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. P-medium Medium priority

Comments

@brson
Copy link
Contributor

brson commented Aug 30, 2012

Our development policy requires marking all FIXME's with issue numbers, and this is enforced by the tidy script. Having issues for all the FIXME's is particularly useful since they often consist of small tasks you can do at leisure or that new contributors can pick off easily.

Alas, it is awkward to open issues for bugs that one is still in the process of creating, and I have started marking problems with XXX.

With suitable advances in robot technology we could streamline the process: human write unnumbered FIXMEs; robot periodically find them, parse descriptions, open issues on github, patch issue numbers into code and submit a pull request.

To support the patching we would probably require FIXME to be written something like FIXME (####), so that the patched version is guaranteed to be under the line length limit.

@catamorphism
Copy link
Contributor

Good idea. With suitable advances in robot technology, the robot could also fix the bugs ;-)

@catamorphism
Copy link
Contributor

Nominating -- I think it would be great to have this before "maturity #5 - production ready", and then we would also not need both XXXs and FIXMEs.

@emberian
Copy link
Member

emberian commented Jul 7, 2013

Would still be handy

@graydon
Copy link
Contributor

graydon commented Jul 11, 2013

accepted for backwards-compatible milestone

@huonw
Copy link
Member

huonw commented Sep 10, 2013

Triage: loads of XXXs, and @bors is still only merging the bug fixes.

$ git grep '// XXX' | wc -l
141
$ git grep '// FIXME' | wc -l
421

@steveklabnik
Copy link
Member

To be clear, this is basically 'open an issue for every XXX, put text in the issue, switch to FIXME with a number'?

I'm willing to do that, it's less than two hundred of them.

@jdm
Copy link
Contributor

jdm commented Sep 29, 2013

@steveklabnik: Correct.

@catamorphism
Copy link
Contributor

@steveklabnik That would be great. In the process, you'll probably discover some that are already fixed or don't make sense; feel free to remove them completely or ask the person listed in git blame according to your judgment.

@reedlepee123
Copy link
Contributor

I would like to work on it!

@salemtalha
Copy link
Contributor

@huonw Since it seems this has been left alone, I'd like to tackle this, but I have a question (really new here): are these issues meant to be created manually? Some of the descriptions next to the XXX comments are not descriptive enough to stand on their own.

@emberian
Copy link
Member

if there isn't much information in the XXX, there isn't much to put in the
issue. you should live in the comment after the fixme.

On Sat, Jan 25, 2014 at 1:50 PM, salemtalha notifications@github.comwrote:

Since it seems this has been left alone, I'd like to tackle this, but I
have a question (really new here): are these issues meant to be created
manually? Some of the descriptions next to the XXX comments are not
descriptive enough to stand on their own.


Reply to this email directly or view it on GitHubhttps://github.com//issues/3303#issuecomment-33296578
.

@salemtalha
Copy link
Contributor

@cmr Could you clarify your last statement a bit? Not sure I follow.

@emberian
Copy link
Member

leave, not live. replace the XXX with FIXME #XXXXX, but leave the
explanation there

On Sat, Jan 25, 2014 at 2:01 PM, salemtalha notifications@github.comwrote:

Could you clarify your last statement a bit? Not sure I follow.


Reply to this email directly or view it on GitHubhttps://github.com//issues/3303#issuecomment-33296815
.

@salemtalha
Copy link
Contributor

@cmr So if I understand correctly: For all instances of "// XXX: comment", if the comment is explanatory enough then create an issue with the comment included and change the source code to "// FIXME #12345: comment". But if the comment doesn't make much sense, should I literally replace it with "// FIXME #XXX: comment"? I read the tidy script and I believe it rejects FIXMEs without numeric issue numbers.

@salemtalha
Copy link
Contributor

@brson I came up with a quick script that maybe does what you're meaning, what do you think?

#!/usr/bin/env python

import sys, fileinput, subprocess, re, requests, json

def report_error_name_no(name, no, s):
    global err
    print("%s:%d: %s" % (name, no, s))  
    err=1

def report_err(s):
    report_error_name_no(fileinput.filename(), fileinput.filelineno(), s)

def report_warn(s):
    print("%s:%d: %s" % (fileinput.filename(), fileinput.filelineno(), s))

file_names = [s for s in sys.argv[1:] if (not s.endswith("_gen.rs")) 
    and (not ".#" in s)]

try:
    for line in fileinput.input(file_names, inplace=1):
        if "// FIXME" in line:
            comment = line.partition(':')[2]
            url = 'https://api.github.com/repos/mozilla/rust/issues'
            payload = {
                'title' : comment,
                'body' : ''
            }
            headers = { 'content-type' : 'application/json' }
            r = requests.post(url, data=json.dumps(payload), headers=headers)

            if r.status_code == 201:
                sys.stdout.write(line.replace("FIXME", "FIXME(#" + r['number'] + ")")
            else:
                sys.stdout.write(line)
        else:
             sys.stdout.write(line)

except UnicodeDecodeError, e:
    report_err("UTF-8 decoding error " + str(e))


sys.exit(err)

@brson
Copy link
Contributor Author

brson commented Jan 26, 2014

@salemtalha Yes, that is something like I was thinking. We would probably want to do the same for XXX comments since those are what people use a lot now since the tidy script doesn't allow unnumbered FIXMEs. And we should probably change the tidy script to allow unnumbered FIXMEs, since the policy of always requiring issues on FIXME's just makes people not use FIXME.

@brson
Copy link
Contributor Author

brson commented Jan 26, 2014

Oh, I don't think this script idea will work. Looking through the code there are lots of places where many XXX's refer to the same issue, like "XXX: bad copy".

Personally, I just don't think it's a good policy to require issues for all FIXMEs. There are a lot of them and many are so minor it doesn't really matter if they ever get fixed.

@brson
Copy link
Contributor Author

brson commented Jan 26, 2014

Perhaps a smart script could coalesce FIXMEs with the same description.

@brson
Copy link
Contributor Author

brson commented Jan 26, 2014

Per #11815 my preference is to remove our futile attempts to enforce the FIXME policy with the tidy script, replace all the XXXs with FIXMEs, then keep encouraging people to file issues for FIXMEs manually.

@salemtalha
Copy link
Contributor

Sounds good. I'll get on this.

@steveklabnik
Copy link
Member

Personally, I just don't think it's a good policy to require issues for all FIXMEs. There are a lot of them and many are so minor it doesn't really matter if they ever get fixed.

While I agree, don't underestimate the power of "I wrote something that closed an issue forreal" for new contributors. If they're so minor, they should be easy for a new contributor to handle, and making them 'second-class' makes the contribution feel second class.

@JIghtuse
Copy link
Contributor

JIghtuse commented Apr 7, 2014

I run git grep XXX and it found a few occurences which current tidy script cannot find. So I slightly changed tidy script and changed all this occurences to FIXME. See PR: #13378

@JIghtuse
Copy link
Contributor

JIghtuse commented Apr 7, 2014

Sorry, I messed up with my local repo at first so here are two references. Now it must be fine.

alexcrichton pushed a commit to alexcrichton/rust that referenced this issue Apr 8, 2014
Few places where previous version of tidy script cannot find XXX:
* inside one-line comment preceding by a few spaces;
* inside multiline comments (now it finds it if multiline comment starts
on the same line with XXX).

Change occurences of XXX found by new tidy script.
@JIghtuse
Copy link
Contributor

JIghtuse commented Apr 8, 2014

Can this issue be closed? I think there is nothing to do more here.

@brson
Copy link
Contributor Author

brson commented Apr 8, 2014

Yes, thanks @JIghtuse

@brson brson closed this as completed Apr 8, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-cleanup Category: PRs that clean code up or issues documenting cleanup. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. P-medium Medium priority
Projects
None yet
Development

No branches or pull requests

10 participants