Skip to main content

Given a bug report, suggests code files that may need to be fixed

Project description

README

PyConCodeSe is a bug localisation tool: given a bug report it suggests 10 code files that may contain the bug.

For PyConCodeSe to work it needs a Tree-sitter grammar to parse your code (we currently support Java, C#, PHP and Rust) and the spaCy library to parse the bug report and any natural language text in the code.

After installing the software as per the following instructions, you will need to edit a configuration file for each code repo. The configuration tells PyConCodeSe where your code and your bug reports are.

Installation

You need at least Python 3.11 to run PyConCodeSe and we strongly recommend you install it in a virtual environment. On Unix (incl. macOS) you would type in a terminal something like:

python3.11 -m venv venv
source venv/bin/activate

to create and activate a virtual environment in subfolder venv of your current folder. Next, type

pip install -i py-concodese

to install everything in the current environment and create the main executable script pyconcodese. Finally, set up spaCy with

python -m spacy download en_core_web_sm

Now you can run pyconcodese from any folder, as long as you have the virtual environment activated.

Configuration

When running PyConCodeSe, if there's no file config.toml in the current folder, you're prompted to create one with example values.

pyconcodese 

The PyConcodese config file 'config.toml' was not found in this path. 
 Do you want to copy an example file here? [y/N]y
Example config.toml file copied in the current directory.  
 Please make sure you change the fields accordingly

Open the configuration file and edit the paths of the various folders:

[py-concodese]
# the next 3 can be the root directory of the application if you wish (e.g.)
# the directory that you would like to store the sqlite database(s) in
sqlite_path = "/tmp/Pyconcodese"
# the directory that you would like to store the vsm data folders in
vsm_path = "/tmp/Pyconcodese"
# where to store output files generated by the application
output_path = "/tmp/Pyconcodese"
derby_path = "/tmp/Pyconcodese/derby"


[dataset]
bug_repository_file = "/tmp/Pyconcodese/bug_repository_file.xml"
src_path = "/tmp/Pyconcodese"

The config.toml file will be created with the current path prefilled as a starting point for all these values.

Dataset format

The dataset (bug reports) that you want to use should be in a particular format. Necessary fields that should be present in the dataset are: issue_id, issue_summary, issue_description, issue_status and files_changed.

The following examples show the correct format in which the dataset should be aligned:

Json version

{
    "closed_issues": {
        "1": {
            "issue_id": "#3085",
            "issue_summary": "Missing PR_SET_PTRACER_ANY",
            "issue_description": "JonathanWoollett-Light…..search=PR_SET_PTRACER_ANY).",
            "issue_status": "Closed",
            "files_changed": [
                [
                    "1",
                    "libc-test/semver/fuchsia.txt"
                ],
                [
                    "1",
                    "libc-test/semver/linux.txt"
                ],
                [ 
                    "1", 
                    "src/fuchsia/mod.rs" 
                ], 
                [ 
                    "1", 
                    "src/unix/linux_like/emscripten/mod.rs" 
                ], 
                [ 
                    "1", 
                    "src/unix/linux_like/linux/mod.rs" 
                ] 
            ] 
        }, 
        "437": { 
            "issue_id": "#100", 
            "issue_summary": "Outdated MIPS toolchain", 
            "issue_description": "Contributor…..further.", 
            "issue_status": "Closed", 
            "issue_reporting_time": "", 
            "fixed_by": "#114", 
            "files_changed": [ 
                [ 
                    "1", 
                    "src/unix/notbsd/linux/mips.rs" 
                ], 
                [ 
                    "1", 
                    "src/unix/notbsd/linux/mod.rs" 
                ], 
                [ 
                    "1", 
                    "src/unix/notbsd/linux/musl.rs" 
                ], 
                [ 
                    "1", 
                    "src/unix/notbsd/linux/other/mod.rs" 
                ] 
            ] 
        } 
    } 
} 

XML version

<?xml version="1.0" encoding="ISO-8859-1"?>

<bugrepository name="SWT">
  <bug id="88829" opendate="2005-03-22 20:41:00" fixdate="2005-04-06 17:05:00">
    <buginformation>
      <summary>Table.setColumnOrder() may not fire enough Move events</summary>
      <description>- start with five columns, all different widths - do Table.setColumnOrder(new int[] {4,1,2,3,0}); - SWT.Move events are fired for columns 0 and 4 because they swapped positions -&amp;gt; but Move should have been fired for all of the columns since the width of the first displayed column changed, and therefore all of the other columns are auto-shifted accordingly</description>
    </buginformation>
    <fixedFiles>
      <file>org.eclipse.swt.widgets.Table.java</file>
    </fixedFiles>
  </bug>
  <bug id="90018" opendate="2005-04-01 14:40:00" fixdate="2005-04-05 08:14:00">
    <buginformation>
      <summary>Native tooltips left around on CTabFolder</summary>
      <description>Hover over the PartStack CTabFolder inside eclipse until some native tooltip is displayed. For example, the maximize button. When the tooltip appears, change perspectives using the keybinding. the CTabFolder gets hidden, but its tooltip is permanently displayed and never goes away. Even if that CTabFolder is disposed (I'm assuming) when the perspective is closed.</description>
    </buginformation>
    <fixedFiles>
      <file>org.eclipse.swt.custom.CTabFolder.java</file>
    </fixedFiles>
  </bug>
</bugrepository>

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

py_concodese-3.1.0.tar.gz (14.8 MB view details)

Uploaded Source

Built Distribution

py_concodese-3.1.0-py3-none-any.whl (14.8 MB view details)

Uploaded Python 3

File details

Details for the file py_concodese-3.1.0.tar.gz.

File metadata

  • Download URL: py_concodese-3.1.0.tar.gz
  • Upload date:
  • Size: 14.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.0

File hashes

Hashes for py_concodese-3.1.0.tar.gz
Algorithm Hash digest
SHA256 400fa8d70ffd23414e8c9ed458234080a1d806878a7c6263e2a2562b89363b94
MD5 706f88d8bf9754f6fc8fa3e8b2a8e7e8
BLAKE2b-256 5aad2715bc3b0cf1a05947d4c5641903558bdc35c32659765ccbd5eaca7ab6b6

See more details on using hashes here.

File details

Details for the file py_concodese-3.1.0-py3-none-any.whl.

File metadata

  • Download URL: py_concodese-3.1.0-py3-none-any.whl
  • Upload date:
  • Size: 14.8 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.0

File hashes

Hashes for py_concodese-3.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0bc467eebe4f3a658ee21494734f8f28c379e117277810ba616789fd39c02b26
MD5 75075e17aec13c7d3ea3ec6d726fc094
BLAKE2b-256 61974fb61eb64a9912090a407a58a469982e217f51f6d2ee7a5d9c184da680c0

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page