37

There are a few members of Stack Overflow especially who have a ridiculous number of helpful flags.

At the moment, there does not appear to be any way to display the top users with the most helpful flags. Even though this information is already available publicly, there does not seem to be any way to query all users and make a custom leaderboard, using SEDE, or other programming tools.

A quick search on Meta did not yield anything related to this topic.

This is not limited to Stack Overflow (although that site will no doubt prove to be the most voluminous).

Is there any way to see a short list of top flaggers on the Stack Exchange sites?


See this? This is what I'm talking about! Totally awesome.

enter image description here

1

2 Answers 2

27

One way to find out is to look at the profile of every user with the Marshal badge, and compare. On Stack Overflow, the following users have 20K+ helpful flags as of now (2019-08-27):

  1. Andy, 130603 helpful flags
  2. Floern, 125891 helpful flags
  3. Pang, 99641 helpful flags
  4. Jamal, 47735 helpful flags
  5. gnat, 41872 helpful flags
  6. Wai Ha Lee, 37314 helpful flags
  7. Tunaki, 37170 helpful flags
  8. ayaio, 36201 helpful flags
  9. CRABOLO, 34947 helpful flags
  10. Shree, 34704 helpful flags
  11. Bo Persson, 22717 helpful flags
  12. Taryn, 22118 helpful flags
  13. Mitch Wheat, 20945 helpful flags
  14. Zoe, 20780 helpful flags

A complete list can be found here on GitHub; note that some users have less than 500 helpful flags because of a bug in the system, cf. I got the Marshal badge with less than 500 helpful flags.

Notes:

  • Andy is now a moderator and spends more time handling flags than casting them. Before that, he ran a bot under his account to automatically flag comments.
  • Community is a bot raising flags based on heuristics.
  • CRABOLO and Tunaki are no longer active.
  • Taryn was a moderator and later community manager and DBA at Stack Overflow.
  • Not all helpful flags are equally helpful.
2
  • 5
    Moderators still have their helpful flag counts incremented, it's just rare for moderators to actually cast flags (usually only ever cast spam/abusive flags to insta kill a post) so the number rarely goes up anymore. Moderators are simply ineligible to receive the helpful flags badges (like Marshall) while they have a diamond.
    – animuson StaffMod
    Apr 5, 2018 at 1:50
  • 3
    I have updated the ranking. gist.github.com/kamil-tekiela/e5d3b2b8f3b48f3b0a426feb85b1369f
    – Dharman
    Jun 29, 2021 at 13:50
14
+50

There's no such list, but will a little bit of JavaScript it's possible to generate this list yourself. You'll need to visit the Marshal badge page (on the target site), open the browser console and execute the code below. Sometimes, a little patience is required (generating this list with 2910 top flaggers on Stack Overflow took about 15 minutes), but the console will give some indication about the progress and finally spit out some Markdown you can use to update the top list.

// Execute this snippet in the browser console on the Marshal badge page,
// e.g. https://meta.stackexchange.com/help/badges/160/marshal
// It'll probably work on Deputy as well, but then it takes longer...

// { relative URL to profile page -> display name }
var users = {};
// { relative URL to profile page -> flag count }
var flagCounts = {};
// [ relative URL to profile page ]
var urls = [];

// Determine current & last page number
let pager = $(".s-pagination--item.is-selected");
let currentPage = pager.length == 0 ? 1 : parseInt(pager[0].innerText);
var lastPage = 1;
let pageLinks = $("div.pager").find("a");
let baseLink = window.location.href.split('?')[0] + "?page=";
if (pageLinks.length != 0) {
  // The last link is 'next', unless we're on the last page itself.
  if ("next" == pageLinks[pageLinks.length - 1].getAttribute("rel")) {
    // We need the one before to determine the # of pages.
    lastPage = parseInt(pageLinks[pageLinks.length - 2].getAttribute("href").split("?page=")[1]);      
  } else {
    lastPage = currentPage;
  }
}

// Process a single user
function processUser(index) {
  if (index == urls.length) {
    // All profiles have been read
      
    // Sort by # of helpful flags
    urls.sort(function (a, b) {
      return flagCounts[b] - flagCounts[a];
    });
      
    // Output to console
    var output = "";
    for (var rank = 0; rank < urls.length; rank++) {
      let topFlagger = urls[rank];
      output += (rank + 1) + ". " + flagCounts[topFlagger] + " helpful flags: [" + users[topFlagger] + "](" + topFlagger + ")\n";
    }
    console.log(output);
    return;
  }
  
  if (index > 0 && index % 10 == 0) {
    console.log(index + " top flagger details fetched");
  }

  // Fetch profile page
  let url = urls[index];
  $.get(url + "?tab=topactivity", function (data) {
    // NOTE: second cell (the last cell is the # of unhelpful flags, if you're a moderator on that site)
    for (let header of $(data).find("h1")) {
      if (header.innerText == "Impact") {
        for (let label of $(header).parent().find("div")) {
          if (label.innerText == "helpful flags") {
            flagCounts[url] = parseInt($(label).parent().children()[0].innerText.replace(",", ""));
            processUser(++index);
            break;
          }
        }
        break;
      }
    }
  }).error(function(xhr, status, error) {
    console.error(url + ': ' + status + ' - ' + error);
    processUser(++index);
  });
}

// Process a single page of users with the badge
function processPage(page, lastPage) {
  if (page > lastPage) {
    // Fetch profile pages
    let numberOfUsers = Object.keys(users).length;
    if (numberOfUsers == 0)
      return;
    console.log("Found " + numberOfUsers + " top flaggers");
    urls = Object.keys(users);
    processUser(0);
    return;
  }
  console.log("Page " + page);
  let selector = "div.user-details a";
  if (page == currentPage) {
    // Process current page
    $(selector).each(function() {
      users[$(this).attr("href")] = $(this).text();
    });
    processPage(page + 1, lastPage);
  } else {
    // Fetch page
    $.get(baseLink + page, function (data) {
      // Process fetched page
      $(data).find(selector).each(function() {
        users[$(this).attr("href")] = $(this).text();
      });
      processPage(page + 1, lastPage);
    });
  }
}
 
// Start processing pages 
processPage(1, lastPage);

Some notes:

  • Profile links are relative, so if you want to update the list above, you'll need to find /users/ and replace it with https://stackoverflow.com/users/.
  • The script works for Deputy as well, but this will of course take more time. You might even get rate-limited because the script has to fetch each profile page separately.
  • Some users have less helpful flags than the badge requirement; this is due to an old bug in the system, cf. I got the Marshal badge with less than 500 helpful flags.
11
  • I tried your script on SO's Marshal badge page and after reading "270 top flagger details fetched" I repeatedly got the error "Too many requests". Is there a way to overcome the rate limit or do you need to update the list in the other answer by yourself? wink wink
    – honk
    Jun 29, 2021 at 12:43
  • 1
    @honk too bad ... You could try adding a delay of, say, 1 second, at the beginning of the processUser function. It does mean the script will take an hour or so longer to complete.
    – Glorfindel Mod
    Jun 29, 2021 at 13:33
  • How didn't you suffer from the rate limit? I don't think it was introduced recently, wasn't it? Anyway, if I updated the other answer, it would be out of sync with your list on GitHub that you linked, so I leave that to you ;)
    – honk
    Jun 29, 2021 at 13:44
  • @honk Dharman already did it (sort of), see the other answer
    – Glorfindel Mod
    Jun 29, 2021 at 14:43
  • This seems to break for usernames containing RTL characters - see entry 83 of this answer. Sep 19, 2023 at 10:10
  • Also, it may be worth excluding moderators from the list, for two reasons: 1. mods are excluded from earning flagging badges, so if a mod didn't have at least 500 helpful flags at the time they became a mod and later got past that, they wouldn't show up in the ranking, and 2. mods frequently get helpful flags through mod actions rather than flagging, such as red-flag-nuking posts. deleting comments with an explanation, etc. Sep 19, 2023 at 18:33
  • @Glorfindel Changing the output += assignment to output += (rank + 1) + ". " + flagCounts[topFlagger] + " helpful flags: [" + users[topFlagger] + "](" + topFlagger + ")\n"; seems to fix the RTL issue that @sonic is referring to. I have tested this and it justs reorders the output to: 614 helpful flags: [نور](/users/738249/%d9%86%d9%88%d8%b1) and the RTL problems seems to be avoided.
    – PeterJames
    Mar 12 at 10:21
  • Thank you @PeterJames - I'm currently very limited w.r.t. time, so I've just applied that fix and hope it works :)
    – Glorfindel Mod
    Mar 13 at 20:36
  • 2
    @Glorfindel I have run the new script and updated the list in this answer and it all looks OK (and the RTL username is now entry 91) and it seems to work OK on Stack Overflow too (this time it took 30 minutes to run)
    – PeterJames
    Mar 13 at 21:30
  • @SonictheAnonymousHedgehog It is possible to exclude active moderators from the list by changing the CSS selector let selector = "div.user-details a" to let selector = "div.user-details>a:has(+div)". This is because active moderators have a following span element, whereas normal users have a following div element. And this would work across all sites. But it would only exclude active moderators and not previous moderators. See caniuse.com for :has() which makes this possible since December 2023.
    – PeterJames
    Mar 14 at 12:13
  • @PeterJames It's OK to include former moderators, because as soon as a moderator loses their diamond, they'll earn the Marshal badge if they would have earned it while a mod but didn't. Mar 14 at 17:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .