示例#1
0
"""C and C++ analysis using a clang compiler plugin

This plugin handles structural analysis of C++ code by building the project
under clang while interposing a custom compiler plugin that dumps out
structural data to CSV files during compilation. This is then pulled into
elasticsearch as a post-processing phase.

"""
from dxr.plugins import Plugin, filters_from_namespace
from dxr.plugins.clang import direct, filters
from dxr.plugins.clang.indexers import TreeToIndex, mappings

plugin = Plugin(filters=filters_from_namespace(filters.__dict__),
                tree_to_index=TreeToIndex,
                mappings=mappings,
                direct_searchers=direct.searchers)
示例#2
0
    return True


mappings = {
    LINE: {
        'properties': {
            'rust_function': QUALIFIED_LINE_NEEDLE,
            'rust_function_ref': QUALIFIED_LINE_NEEDLE,
            'rust_var': QUALIFIED_LINE_NEEDLE,
            'rust_var_ref': QUALIFIED_LINE_NEEDLE,
            'rust_type': QUALIFIED_LINE_NEEDLE,
            'rust_type_ref': QUALIFIED_LINE_NEEDLE,
            'rust_module': QUALIFIED_LINE_NEEDLE,
            'rust_module_ref': QUALIFIED_LINE_NEEDLE,
            'rust_module_alias_ref': QUALIFIED_LINE_NEEDLE,
            'rust_extern_ref': QUALIFIED_LINE_NEEDLE,
            'rust_module_use': QUALIFIED_LINE_NEEDLE,
            'rust_impl': QUALIFIED_LINE_NEEDLE,
            'rust_fn_impls': QUALIFIED_LINE_NEEDLE,
            'rust_bases': QUALIFIED_LINE_NEEDLE,
            'rust_derived': QUALIFIED_LINE_NEEDLE,
            'rust_callers': QUALIFIED_LINE_NEEDLE,
        }
    }
}

plugin = Plugin(filters=filters_from_namespace(filters.__dict__),
                tree_to_index=TreeToIndex,
                mappings=mappings,
                refs=refs_from_namespace(refs.__dict__))
示例#3
0
"""C and C++ analysis using a clang compiler plugin

This plugin handles structural analysis of C++ code by building the project
under clang while interposing a custom compiler plugin that dumps out
structural data to CSV files during compilation. This is then pulled into
elasticsearch as a post-processing phase.

"""
from dxr.plugins import Plugin, filters_from_namespace, refs_from_namespace
from dxr.plugins.clang import direct, filters, menus
from dxr.plugins.clang.indexers import TreeToIndex, mappings

plugin = Plugin(filters=filters_from_namespace(filters.__dict__),
                tree_to_index=TreeToIndex,
                mappings=mappings,
                badge_colors={'c': '#F4FAAA'},
                direct_searchers=direct.searchers,
                refs=refs_from_namespace(menus.__dict__))
示例#4
0
                BugRef(self.tree,
                       (self.plugin_config.name, self.plugin_config.url, bug)))


class BugRef(Ref):
    plugin = 'buglink'

    def menu_items(self):
        name, url, bug = self.menu_data
        yield {
            'html': cgi.escape("Bug %s" % bug),
            'title': "Find this bug in %s" % name,
            'href': url % bug,
            'icon': 'buglink'
        }


plugin = Plugin(tree_to_index=partial(AdHocTreeToIndex,
                                      file_to_index_class=FileToIndex),
                refs=[BugRef],
                config_schema={
                    'url':
                    str,
                    Optional('name', default='the bug tracker'):
                    basestring,
                    Optional('regex',
                             default=re.compile('(?i)bug\\s+#?([0-9]+)')):
                    Use(re.compile,
                        error='"regex" must be a valid regular expression.')
                })
示例#5
0
文件: __init__.py 项目: zz22zz222/dxr
"""Python plugin, using the ast and tokenize standard library modules"""

from dxr.config import AbsPath
from dxr.plugins import filters_from_namespace, refs_from_namespace, Plugin
from dxr.plugins.python import filters, menus
from dxr.plugins.python.indexers import mappings, TreeToIndex

plugin = Plugin(filters=filters_from_namespace(filters.__dict__),
                tree_to_index=TreeToIndex,
                mappings=mappings,
                badge_colors={'py': '#ECE6FD'},
                refs=refs_from_namespace(menus.__dict__),
                config_schema={'python_path': AbsPath})
示例#6
0
from functools import partial
from os.path import abspath

from schema import Optional, Use, And

from dxr.config import AbsPath
from dxr.plugins import Plugin, AdHocTreeToIndex, filters_from_namespace, refs_from_namespace
from dxr.plugins.xpidl import filters, refs
from dxr.plugins.xpidl.mappings import mappings
from dxr.plugins.xpidl.indexers import FileToIndex


def split_on_space_into_abspaths(value):
    return map(abspath, value.strip().split())


ColonPathList = And(basestring,
                    Use(split_on_space_into_abspaths),
                    error='This should be a space-separated list of paths.')

plugin = Plugin(
    tree_to_index=partial(AdHocTreeToIndex,
                          file_to_index_class=FileToIndex),
    refs=refs_from_namespace(refs.__dict__),
    filters=filters_from_namespace(filters.__dict__),
    mappings=mappings,
    config_schema={
        'header_path': AbsPath,
        Optional('include_folders', default=[]): ColonPathList})
示例#7
0
"""Python plugin, using the ast and tokenize standard library modules"""
from dxr.config import AbsPath
from dxr.plugins import filters_from_namespace, Plugin
from dxr.plugins.python import filters
from dxr.plugins.python.indexers import mappings, TreeToIndex

plugin = Plugin(filters=filters_from_namespace(filters.__dict__),
                tree_to_index=TreeToIndex,
                mappings=mappings,
                config_schema={'python_path': AbsPath})
示例#8
0
esprima.
"""

from dxr.plugins import Plugin, filters_from_namespace, refs_from_namespace
from dxr.filters import LINE
from dxr.indexers import QUALIFIED_LINE_NEEDLE
from dxr.plugins.js.indexers import TreeToIndex
from dxr.plugins.js.refs import PLUGIN_NAME
from dxr.plugins.js import refs, filters


mappings = {
    LINE: {
        'properties': {
            PLUGIN_NAME + '_prop': QUALIFIED_LINE_NEEDLE,
            PLUGIN_NAME + '_var': QUALIFIED_LINE_NEEDLE,
            PLUGIN_NAME + '_prop_ref': QUALIFIED_LINE_NEEDLE,
            PLUGIN_NAME + '_var_ref': QUALIFIED_LINE_NEEDLE
        }
    }
}


plugin = Plugin(
    tree_to_index=TreeToIndex,
    mappings=mappings,
    badge_colors={'js': '#D0FCF8'},
    refs=refs_from_namespace(refs.__dict__),
    filters=filters_from_namespace(filters.__dict__),
)
示例#9
0
文件: __init__.py 项目: zz22zz222/dxr

mappings = {
    LINE: {
        'properties': {
            'rust_function': QUALIFIED_LINE_NEEDLE,
            'rust_function_ref': QUALIFIED_LINE_NEEDLE,
            'rust_var': QUALIFIED_LINE_NEEDLE,
            'rust_var_ref': QUALIFIED_LINE_NEEDLE,
            'rust_type': QUALIFIED_LINE_NEEDLE,
            'rust_type_ref': QUALIFIED_LINE_NEEDLE,
            'rust_module': QUALIFIED_LINE_NEEDLE,
            'rust_module_ref': QUALIFIED_LINE_NEEDLE,
            'rust_module_alias_ref': QUALIFIED_LINE_NEEDLE,
            'rust_extern_ref': QUALIFIED_LINE_NEEDLE,
            'rust_module_use': QUALIFIED_LINE_NEEDLE,
            'rust_impl': QUALIFIED_LINE_NEEDLE,
            'rust_fn_impls': QUALIFIED_LINE_NEEDLE,
            'rust_bases': QUALIFIED_LINE_NEEDLE,
            'rust_derived': QUALIFIED_LINE_NEEDLE,
            'rust_callers': QUALIFIED_LINE_NEEDLE,
        }
    }
}

plugin = Plugin(filters=filters_from_namespace(filters.__dict__),
                tree_to_index=TreeToIndex,
                badge_colors={'rust': '#FEDFB0'},
                mappings=mappings,
                refs=refs_from_namespace(refs.__dict__))