Skip to content

Conversation

@bmedx
Copy link
Contributor

@bmedx bmedx commented Jan 23, 2019

Description: Adds documentation for the search tools, cleans up some things which have grown inaccurate.

JIRA: PLAT-2402


``coverage_target``
A number from 0 - 100 that represents the percentage of Django models in the project that should have annotations.
The Django Search tool will fail if run with the ``--coverage`` option if the covered percentage is below this
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: ...will fail when run with...

choice_annotation:
".. annotation_token::":
".. annotation_token2::":
"".. choice_annotation::"":
Copy link
Contributor

Choose a reason for hiding this comment

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

Why does this annotation have double quotes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No idea, will fix.

free-form text following the annotation itself. At this time the comment must be all on one line to be included
- Basic, or comment, annotations such as ``annotation_token`` and ``first_group_token`` above, allow for
free-form text following the annotation itself. Note the colon after the annotation token! In configuration this
type is a mapping type, mapping to a null value. At this time the comment must be all on one line to be included
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe separate this single-line note into a NOTE: At this time,....?

in some way. If you do not need this functionality and simply want to find annotations and create a report, the static
search tool is much easier to configure and can search all of your code (instead of just model docstrings).

.. important::
Copy link
Contributor

Choose a reason for hiding this comment

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

This important should be bolded/capitalized? It seems strange as it is now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a Sphinx admonition. In the processed docs it will highlight the text and put a border around it: http://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html#rst-directives

search tool is much easier to configure and can search all of your code (instead of just model docstrings).

.. important::
In order to use the Django tool you must first set the ``DJANGO_SETTINGS_MODULE`` environment variable to point to
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: To use the Django tool, you must...

.. code-block:: yaml
social_django.Association:
social_django.Code:
Copy link
Contributor

Choose a reason for hiding this comment

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

Actually, freshly-created looks like this:

    social_django.Association: {}
    social_django.Code: {}

second ``.. no_pii::`` annotation to ``social_django.Association``.

.. important::
Some types of "local" models are procedurally generated and do not have files in code, for instance those created by
Copy link
Contributor

Choose a reason for hiding this comment

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

in code, e.g. models created by django-simple-history.

language searches, even the ones that come by default, are implemented as extensions. A language extension is
responsible for finding all comments in files of the given type.
responsible for finding all comments in files of the given type. Note that extensions are only used in the Static Search
and not in Django search, as Django models are obviously all written in Python.
Copy link
Contributor

Choose a reason for hiding this comment

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

Django Search to mirror Static Search?

``_add_annotation_group`` - On construction this will be called once for each annotation group that is configured,
allowing you to do any setup necessary to find these tokens in your search. Note that annotations in a group are
*not* also sent to ``_add_annotation_token``, though you can do that yourself.

Copy link
Contributor

Choose a reason for hiding this comment

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

👍


Overview
========
The Static Search Tool, or Static Tool, is written as an extensible way to find annotations in code. It does this by
Copy link
Contributor

Choose a reason for hiding this comment

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

The tool performs static...

@bmedx bmedx merged commit b3f1a71 into master Jan 24, 2019
@bmedx bmedx deleted the bmedx/django_docs branch January 24, 2019 18:51
Copy link
Contributor

@pwnage101 pwnage101 left a comment

Choose a reason for hiding this comment

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

You already merged, but better late than never! I should have mentioned it was on my TODO list for today.

source_path: ../path/to/be/searched/
# Path that you wish to static search, can be passed on the command line
# Directories will be searched recursively, but this can also point to a single file
source_path: ../
Copy link
Contributor

Choose a reason for hiding this comment

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

should this example use ./ or ../? Julia once copied this verbatim into the edx-notes-api pii config, and so we had to change it to ./ to only search the local source checkout.


Group members can be be comment or choice types. The only limitation on ordering is that the group member listed first
in the configuration must also appear first in the comment.
that all group members are consecutively, though ordering does not matter.
Copy link
Contributor

Choose a reason for hiding this comment

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

typo: "consecutive"

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.

4 participants