Giter Site home page Giter Site logo

ruben2020 / codequery Goto Github PK

View Code? Open in Web Editor NEW
663.0 40.0 85.0 7.69 MB

A code-understanding, code-browsing or code-search tool. This is a tool to index, then query or search C, C++, Java, Python, Ruby, Go and Javascript source code. It builds upon the databases of cscope and ctags, and provides a nice GUI tool.

Home Page: https://ruben2020.github.io/codequery/

License: Mozilla Public License 2.0

CMake 0.25% C++ 73.65% Perl 0.30% C 1.67% HTML 19.18% Batchfile 0.09% Makefile 1.80% QMake 0.06% Python 2.81% Shell 0.05% OCaml 0.01% CSS 0.01% D 0.01% Erlang 0.01% F# 0.07% GDScript 0.01% PHP 0.02% ASP.NET 0.01% Classic ASP 0.01% Inno Setup 0.01%
cscope ctags code-analysis code-search

codequery's People

Contributors

brianonn avatar devjoe avatar jonashaag avatar ruben2020 avatar stweise avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

codequery's Issues

Replace code editing widget with QScintilla

Instead of reinventing the wheel with syntax highlighting, brace matching, text searching etc. for the editor, it's easier to use a proper mature open source code editing widget, and QScintilla is the right candidate. The plan is to do this inside a different branch then merge it into the master if it turns out well.

Prefixing issues (alternative install directories)

I'm trying to get codequery working on a server at work that I do not have root privileges to. I've installed a number of tools/libraries to my user directory, which when using pkg-config is really easy (./configure --prefix=whatever). However in Cmake it doesn't appear to be straight forward at all.

Here is where I'm at right now:
I've installed all the codequery prerequisites (new gcc, sqlite3, etc) to my home drive.
I found this wiki page about env variables:
http://www.cmake.org/Wiki/CMake_Useful_Variables
I have to set the following env variables to get the prefix stuff correct:
DESTDIR
CMAKE_INCLUDE_PATH
CMAKE_LIBRARY_PATH
But cmake doesn't use PATH so you have to set the compilers manually:
CMAKE_C_COMPILER
CMAKE_CXX_COMPILER
And then it seems that my custom include directory/library path isn't been passed to g++ when compiling, so I have to add this as well:
CMAKE_CXX_FLAGS
CMAKE_C_FLAGS

Here is the full configure cmd line from a fresh build directory:

$ DESTDIR="/home/dlinnington/tools/" CMAKE_INCLUDE_PATH="/home/dlinnington/tools/include" CMAKE_LIBRARY_PATH="/home/dlinnington/tools/lib:/home/dlinnington/tools/lib64" cmake -DCMAKE_CXX_FLAGS="-B/home/dlinnington/tools/lib/gcc/ -isystem=/home/dlinnington/tools/include -L/home/dlinnington/tools/lib" -DCMAKE_C_FLAGS="-B/home/dlinnington/tools/lib/gcc/ -isystem=/home/dlinnington/tools/include -L/home/dlinnington/tools/lib" -DCMAKE_C_COMPILER=/home/dlinnington/tools/bin/gcc -DCMAKE_CXX_COMPILER=/home/dlinnington/tools/bin/g++ -G "Unix Makefiles" ..
-- The C compiler identification is GNU 4.8.0
-- The CXX compiler identification is GNU 4.8.0
-- Check for working C compiler: /home/dlinnington/tools/bin/gcc
-- Check for working C compiler: /home/dlinnington/tools/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /home/dlinnington/tools/bin/g++
-- Check for working CXX compiler: /home/dlinnington/tools/bin/g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Found Sqlite3 header file in /home/dlinnington/tools/include
-- Found Sqlite3 libraries: /home/dlinnington/tools/lib/libsqlite3.so
-- Looking for Q_WS_X11
-- Looking for Q_WS_X11 - found
-- Looking for Q_WS_WIN
-- Looking for Q_WS_WIN - not found
-- Looking for Q_WS_QWS
-- Looking for Q_WS_QWS - not found
-- Looking for Q_WS_MAC
-- Looking for Q_WS_MAC - not found
-- Found Qt4: /home/dlinnington/tools/bin/qmake (found version "4.8.4")
-- Configuring done
-- Generating done
-- Build files have been written to: /home/dlinnington/tools/install/codequery/codequery/build

And I actually got the build working correctly and (what appears) to be linking correctly. However after all that when I run make install:

-- Installing: /usr/local/bin/cqmakedb
CMake Error at makedb/cmake_install.cmake:42 (FILE):
file INSTALL cannot copy file
"/home/dlinnington/tools/install/codequery/codequery/build/cqmakedb" to
"/usr/local/bin/cqmakedb".
Call Stack (most recent call first):
cmake_install.cmake:38 (INCLUDE)

Do I need to set CMAKE_INSTALL_PREFIX, even though the cmake wiki says not to?

autocomplete should be asynchronized (not blocking)

Thanks for make this wonderful tool. I totally love this tool.
we have a huge code base. when we use the auto-complete feature, the UI is not very responsive. that is due to the query to the sqlite db.

is it possible to make it not blocking?

database file open error

Hi Ruben,

I appreciate your work on this project, I basically rely heavily on ctags and cscope for code browsing. But when I tried to use your tool, it showed a pop-up saying 'file open error'. I followed steps written in documentation to generate the myproject.db file.

Here are some more information about the code I'm using.

  1. All .c and .h files
  2. Basically it's an embedded/firmware code base
  3. The generated 'myproject.db' is almost 2.5 Giga bytes (hope you got sense of code base I'm using) - ofcourse it took about 45 mns to generate that file.
  4. running on Ubuntu 12.04

Let me know if you need more information,
image

cqmakedb gives cscope sanity check error

Hi,
I have created cscope.files and ctags as mentioned in
http://ruben2020.github.io/codequery/windows-install/HOWTO-WINDOWS.txt
I still get this error. not sure what the problem is. any help would be appreciated.
cscope -cb (BTW, this step just hangs). therefore, I run cscope once, which creates cscope,out automatically.
ctags --fields=+i -n -R -L cscope.files
cqmakedb -s .\myproject.db -c cscope.out -t tags -p
cscope.out sanity check Error

I tried using just *.c files in cscope.files hoping to keep the code base smaller. But it doesn't seem to have helped.

Type of variable for C/C++, Java

The type of variable, if possible, can be shown. For e.g. for a symbol that is a member, we could show if it's a int, blah, char[] etc. Info may be available from ctags. Could be useful for class diagram.

I got "cqmakedb.exe has stopped working" popup in Windows 7

Hello,

I started to use codequery and thank you for this open source tool.
But I have one problem with cqmakedb.exe.

I followed HOWTO-WINDOWS.txt but it stops working during processing ctags file.

D:\Tmp\Source>cscope -cb
D:\Tmp\Source>ctags --fields=+i -n -R -L cscope.files
D:\Tmp\Source>cqmakedb -s .\my.db -c cscope.out -t tags -p
cscope.out sanity check OK
cscope.out detailed check OK
Adding symbols ...
Finalizing ...
Processing ctags file ...
-> here, I get "cqmakedb.exe has stopped working" error

Although there is an error, it seems that I can use code search features, but I'm not sure it is complete or not.
So I'd like to know how I can help you to fix the error if you are available for this.

Thank you.

Slow to clear search result

Hi,

I am working on a large code base. If I search in CodeQuery gui (windows 7) for a symbol and get like 20.000 results then the search is very fast around 1 second. But any search I do after getting such a large result takes around 1 minute. If I make the same search (that just took 1 minute) again then it only takes 1 sec (if the search give few hits). When having a result with many hits like the 20.000 I restart the gui (which takes a few sec), then any search is fast again.

My conclusion is that clearing the current result when making a new search is very slow somehow (if it contains many hits). Is that something you can do anything about?

Best regards,
Ivan

"-c" with different language classes

It is actually a wish.

I have some projects with mixed python, c and c++ files. Since python is processed by pycscope and c/c++ is processed by cscope (besides ctags) it is a bit cumbersome to combine all things in just one database file (I need to parse and combine the cscope files before right now). It would be easier and way more practical if it was possible to cqmakedb to accept multiple -c (and also -t) input. Right now it doesn't.

Another thing that would be wonderful is if we could set a base path for files with relative paths.

And as a last wish (I know, too many wishes), it would be great if on filters we could put ';' to separate file extensions.

Anyway, nice app, thanks for sharing.

double-free or corruption when building database

Given the following cscope and ctags databases (I gzipped them for sharing, so uncompress them first) to cqmakedb reliably causes a crash.
https://dl.dropboxusercontent.com/u/171647/codequery-samples/cscope.out.gz
https://dl.dropboxusercontent.com/u/171647/codequery-samples/tags.gz

The complete output:

โžœ  wireshark (master) cqmakedb -s ../cq.db -c cscope.out -t tags
cscope.out sanity check OK
cscope.out detailed check OK
Adding symbols ...
Finalizing ...
Processing ctags file ...
*** Error in `cqmakedb': double free or corruption (!prev): 0x00000000015cad60 ***
[1]    31449 abort (core dumped)  cqmakedb -s ../cq.db -c cscope.out -t tags

Build currently doesn't work on Linux

As mentioned in INSTALL-LINUX.md
CMake Error: The source directory "~/installs/codequery/build" does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.

Cscope sanity check overly restrictive

Certain parameters (specifically in my case -q but probably others) don't affect the output in a way that causes problems for codequery, but do make the sanity check fail (and thus make it impossible to build the DB).

The sanity check should probably use regexes or string::find or something to make sure that -c is included and that problematic flags (are there any?) are excluded, and leave all other flags alone.

How to make cscope doesn't search the standard directories for #include

Hi Ruben,

Thank you for your open source tool - codequery, which is very helpful for me.
Now, I want to use your tool to get all function calls of one function only limited in source code. That means I need to find out function A call function B, function B call function C, function C call function D and so on. A -> B ->C -> D (like the function of "scitools understand", this tool can get all function calls). For codequery, give one function, we can know all functions called by this function, but only limit in this function definition. So I want to change something. I also meet some questions as follows.

  1. I hope to get all function calls only limited in source code, but cscope will search the standard directories for #include files. How to make search only in the source code?
  2. Because I need to get all funtion calls. So I change the file main_cli.cpp, and change the function process_query(). I add recursive, but I meet one error - "Error: File myproject.db open error!", when recursive 1021 times. I think the reason is that only FOPEN_MAX files can be open simultaneously. However, every time, I open dbfile ,search functions, close dbfile (sq->close_dbfile();), and then open dbfile again. I think I close the dbfile, but the fact seems to be dbfile always open, till 1021 dbfile open simultaneously, there will be error.
    I also try to open dbfile only one time when recursive. So I split process_query() to two functions. But std::auto_ptr is very inappropriate for passing values, so I change to use boost::shared_ptr (it can be used to pass values). However, the result is that vector resultlst.resultlist will be empty.

Can you give me some suggestion or tips?

Thank you very much!

Best Regards,
Sun

Generate UML Class Diagram for entire codebase

All necessary info from ctags. If can't generate internal visualization, then we can use Graphviz DOT. Only applicable to OO languages. In addition, for Java and C++, we should be able to see the types of the members.

Sanity Check Error is ambigious

I am getting a Sanity Check Error message (cscope.out sanity check Error) as soon as I run the command. I looked at the code and it looks like the actual Error Code is getting swallowed instead of being written out. It would be helpful to get the actual error code. I can also provide the cscope.out file for your perusal.

Calls of this function or macro (new search type)

Not just "definition of this function" or "functions that call this function", but also simply "calls of this function". I would use this when I do not care who calls this function, but I want to see all the cases where it is called.

Add visualization (call graph)

If the user searches for function "printHelp" and selects visualization, it should show functions calling printHelp and functions called by printHelp up to 1 or 2 levels deep in either direction, in a graph.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.