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

Fix "Unknow" comment when the concept IS defined but no code provided. #559

Conversation

pulgamecanica
Copy link
Contributor

… present
Hello, I am André, I hope you can consider this PR

What GitHub issue does this PR apply to?

Resolves #558

What changed and why?

I changed the models.py and views.py in order to avoid the display of the message "Unknown" when the concept IS defined but there is no "code" implemented.

(If editing Django app) Please add screenshots

BEFORE

Screen Shot 2022-10-05 at 15 59 54

AFTER

Screen Shot 2022-10-05 at 15 40 12

Both images are produced by this JSON file:

{
  "meta": {
    "language": "ruby",
    "language_name": "Ruby",
    "structure": "strings",
    "language_version": "3"
  },
  "concepts": {
    "is_primitive_or_not": {
      "name": "Is this a built-in type in this language?",
      "comment": "Yes"
    },
    "import": {
      "name": "Import the string class",
      "comment":
        "Built-in included in the default Modules"
    },
    "default_string_byte_encoding": {
      "name": "Default byte encoding (ex: ASCII UTF-8, UTF-16, etc.)",
      "comment": "UTF-8"
    },
    "create_new_string": {
      "name": "Create new string",
      "code": [
        "varName = \"Hello World\"",
        "varName = 'This also works'",
        "anotherVar = %{another way to do it}\n"
      ],
      "comment": "Using the %char-style quoting mechanism generates either a single or doubled quoted string.\nYou can preceed the % by a character option and a delimiter.\nThe most common delimiter is {} like the example, but you can use any non alpha-numerical delimiter."
    },
    "create_multiline_string": {
      "name": "Create new multi-line string",
      "code": [
        "text = <<EOM\nLine1\nAnother Line\nNow this is the last line.\nEOM\n",
        "text = <<-EOM\nLine1\nAnother Line\nNow this is the last line.\n      EOM\n\n"
      ],
      "comment": "\"HERE\" document (heredoc), generates a string, usually a multiline string.\nUses the << operator followed by a delimiter. The string wont end until the delimiter is founded flush left.\nPlacing a '-' after the << operator will disable the flush left requirement."
    },
    "assign_new_string": {
      "name": "Assign string from another string",
      "code": [
        "a = \"String\"",
        "b = a"
      ]
    }
    ...........

Checklist

  • I claimed any associated issue(s) and they are not someone else's
  • I have looked at documentation to ensure I made any revisions correctly
  • I tested my changes locally to ensure they work
  • (If editing Django) I have added or edited any appropriate unit tests for my changes

Any additional comments or things to be aware of while reviewing?

Cheers 😃

@geekygirlsarah
Copy link
Member

As I mentioned in #558, I think this is a good thing to think on but still pondering if this is the ideal solution (or at least a part of the solution). I'll think on it more.

@geekygirlsarah geekygirlsarah temporarily deployed to codethesaurus-test-pr-559 October 29, 2022 15:01 Inactive
@geekygirlsarah geekygirlsarah temporarily deployed to codethesaurus-test-pr-559 October 29, 2022 15:02 Inactive
@geekygirlsarah geekygirlsarah temporarily deployed to codethesaurus-test-pr-559 November 4, 2022 16:00 Inactive
Copy link
Member

@geekygirlsarah geekygirlsarah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this is fine to leave in, however, I'd like the validatelanginfofiles command and GitHub Action to reflect this. Would you mind updating that too? It's in web/management/commands/validatelanginfofiles.py.

Also the test_language_get_concept_code unit test is failing, I think because it requires the concept code to exist and this lets it not exist. So that will need to be fixed.

@geekygirlsarah geekygirlsarah temporarily deployed to codethesaurus-test-pr-559 November 8, 2022 19:30 Inactive
@geekygirlsarah geekygirlsarah temporarily deployed to codethesaurus-test-pr-559 November 19, 2022 01:45 Inactive
@geekygirlsarah
Copy link
Member

I'm going to close this since it hasn't had any work on it since October.

If you wish to pick this back up @pulgamecanica, you're welcome to! You can either reopen this or make a new pull request to work on it.

Thanks for the work you started on so far!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"Unknown" when code is missing.
2 participants