14
\$\begingroup\$

I have just posted a question about an explicit song checker here. I decided not to include the explicit words.

Question:

Are explicit words allowed in a programs source code? If so, is there a limit to what words can be shown? If a programs source is dependent on these strings, should they be included to allow full depth review?

EDIT This is not related to this question. My code is dependent on having explicit words in the program. I understand that offensive words in comments or other random places should be removed, but my question is about code that cannot function without the use of explicit words.

\$\endgroup\$
4
  • 10
    \$\begingroup\$ Asking a question on Meta about profanity, about a question where the code's purpose is to detect profanity, is very… metacircular. \$\endgroup\$ Jun 15, 2019 at 6:20
  • 4
    \$\begingroup\$ Possible duplicate of Should we censor rude language in comments/strings of posted code? \$\endgroup\$
    – Zeta
    Jun 15, 2019 at 8:19
  • 2
    \$\begingroup\$ I vaguely recall we have a question on this site that's basically a keylogger that triggered, among other things, on porn. The code was not 'filtered' and that was an acceptable question. Does that answer your question? \$\endgroup\$
    – Mast Mod
    Jun 15, 2019 at 15:26
  • \$\begingroup\$ @Mast My list contains racial slurs, which I believe is much worse. \$\endgroup\$
    – Linny
    Jul 24, 2019 at 23:26

3 Answers 3

23
\$\begingroup\$

There is no simple answer to this question.

On one hand, Code Review requires real code. Anytime you redact something for the sake of posting it, something is lost in the process.

Different people react differently to profanity. Should sed -i -e 's/f.ck/hug/i' be applied to the Linux kernel? That's debatable, and therefore it is a valid topic to be addressed in a code review. I'd like to treat profanity in code academically, the same way that linguists study the use of profanity.

Some words will appear offensive, but aren't. "Brainfuck" comes to mind. Redacting or bowdlerizing the name just draws attention to it and makes it hard to search for. I'd prefer to leave it as is.

On the other hand, there are cases where the content is clearly intended to be obnoxious or cause offense. Those questions should be dealt with quite differently — we either redact the code by force, or delete the question altogether. Expectations of civility don't disappear just because the offensive text appears inside a code block.

Context matters. Some factors to consider are:

  • Is the profanity just in the code comments? Is it "reasonable" (// shitty firmware occasionally requires reset), or is there a gratuitous amount?
  • Is the profanity part of the output of the program, and is there any good justification for it? (I can't think of any good valid reason.)
  • Are the explicit words technically relevant to the review? For example, are you writing a profanity detector, where the detection-evasion relationship is adversarial?

I think that what you did, leaving out the specific words, was acceptable. The main goal of your program was to detect the presence of some words in a blacklist, and in some sense, the exact strings don't matter that much. I asked for (and received) clarification about the approximate length of the list, and that was all I needed to know.

You could have added a layer of discussion had you chosen to include some specific words as an example. For instance, does your blacklist include "piss"? Does it also include "pissed" and "pissing"? What about "abso-fucking-lutely"? Could we improve the program, from a point of view, if we had that level of detail? If you wanted to go there, and found a way to do it tastefully, in a way that promotes academic discussion, sure.

\$\endgroup\$
0
12
\$\begingroup\$

You could go for a humourous approach. Instead of embedding “explicit” words in the code, you could embed “dirty” words.

# Explicit words replaced with "dirty" words during code review.
explicit_words = [
    "stain", "stained", "staining",
    "dust", "dusty",                # Note: "dusting" would be a clean word
    "soil", "soiled", "soiling",
    "dirt", "dirty",
    "garbage"
]

This makes it clear that you’ve probably considered past / present / future and possibly singular / plural variants of your explicit words.

\$\endgroup\$
6
\$\begingroup\$

This is a good question, and I think you made all the right moves with your actions:

  1. You left the explicit words out;
  2. You asked a question on Meta as to whether they're acceptable or not;

So, let's discuss that.


Are explicit words allowed in a programs source code?

This is the first question you ask: are explicit words allowed? That's a very relevant question, but it bears two subquestions:

  1. What determines if a word is explicit?
  2. Is the word necessary?

The answer to 1 is subjective, there's no formula. We know of a few general answers to that question, but there are a lot of words that are subject to interpretation.

In general, if the word is plausibly explicit (think the major four-letter words starting with f, s, etc.), I would start thinking about part 2. If the word is absolutely necessary, then there might be other possibilities.

Your question requires an explicit-word dictionary, so they're required, and necessary. So how could we put them in your question?

Some list of explicit words:

this would be our list of stuff

We can use a spoiler tag to hide them, and make a clear notation that there are explicit words embedded, the syntax for this is:

>! ...

This offers the best, in my opinion, degree of inclusion and protection. It makes absolutely certain that you took consideration for the potential severity of the language, and acted accordingly.

But, there's a limit!

Here's the thing: there are some words that we ought not share, period. Your list might include some racially- or sexually-insensitive language. I won't name them, but I think we all know what some examples are.

What do we do about those?

I'm not a big fan of racially- or sexually-insensitive language, even if it's in earnest. If your code relies on the use of a degrading term, I'm not against saying "it doesn't belong here."

Everything has a limit, and I'm Ok with drawing the line at terms that are commonly assumed to be used to attack someone based on their:

  1. Race / ethnicity / cultural background;
  2. Sexual orientation or disposition;
  3. Religion or religious beliefs;

As an example of each of these, if you're using a term that attacks someone because:

  1. They are black, hispanic, or another marginalized racial group;
  2. They are categorized under the LGBTQ+ group (that is, lesbian / gay / bisexual / transgender / queer / etc.);
  3. They are Christian, Catholic, Jewish, Islamic, etc.;

Then keep it off this site. Either remove it from the question, or don't post the question.

\$\endgroup\$
6
  • 2
    \$\begingroup\$ You've probably answered this already, but I didn't see it. If I were making a program to do with cigarettes, but since it's common for me to call them fags, without thinking too much into it I make the variable fags = []. Would you want to penalize me for using an anti-LGBTQ+ term? \$\endgroup\$
    – Peilonrayz Mod
    Jun 19, 2019 at 22:15
  • \$\begingroup\$ @Peilonrayz Your usage is cultural, in different cultures the same word may not mean the same thing. I think that the context and cultural basis is important as well. \$\endgroup\$
    – pacmaninbw
    Jun 19, 2019 at 22:31
  • 1
    \$\begingroup\$ @pacmaninbw Yes, that's why I'm asking. \$\endgroup\$
    – Peilonrayz Mod
    Jun 19, 2019 at 22:32
  • 1
    \$\begingroup\$ @Peilonrayz For that specific circumstance, if it were obviously a cultural difference, I'd leave you a comment mentioning you might want to consider changing it and why, but I wouldn't 'penalize' you. That said, if someone else reported it as offensive I would back them up. Yes, it has cultural differences in meaning, but that doesn't stop people from being hurt by it. \$\endgroup\$ Jun 19, 2019 at 22:39
  • \$\begingroup\$ "We can use a spoiler tag to hide them" We're talking about codeblocks here though, right? Are you suggesting using spoiler tags in the middle of a piece of code? I mean, sure, if the list is an external file (like a configuration), this could be an option. But if it's hardcoded in the code itself such a solution would not be ideal. \$\endgroup\$
    – Mast Mod
    Jun 20, 2019 at 10:08
  • \$\begingroup\$ @Mast It's situationally specific. I'm not saying dump individual lines et al in code-blocks. The point here is that, in a situation like OP's, where they have a large list that is concentrated in one area, they can leave the same indication they left but add a spoiler tag with the actual terms so that folks can decide if they want or need to see the exact list. \$\endgroup\$ Jun 20, 2019 at 13:21

You must log in to answer this question.

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