ManySStuBs4J / README.md
claudios's picture
Update README.md
60579fd verified
|
Raw
History Blame Contribute Delete
11.5 kB
metadata
dataset_info:
  - config_name: bugs
    features:
      - name: fixCommitSHA1
        dtype: large_string
      - name: fixCommitParentSHA1
        dtype: large_string
      - name: bugFilePath
        dtype: large_string
      - name: fixPatch
        dtype: large_string
      - name: projectName
        dtype: large_string
      - name: bugLineNum
        dtype: int64
      - name: bugNodeStartChar
        dtype: int64
      - name: bugNodeLength
        dtype: int64
      - name: fixLineNum
        dtype: int64
      - name: fixNodeStartChar
        dtype: int64
      - name: fixNodeLength
        dtype: int64
      - name: sourceBeforeFix
        dtype: large_string
      - name: sourceAfterFix
        dtype: large_string
    splits:
      - name: train
        num_bytes: 69913130
        num_examples: 25539
    download_size: 13039503
    dataset_size: 69913130
  - config_name: bugsLarge
    features:
      - name: fixCommitSHA1
        dtype: large_string
      - name: fixCommitParentSHA1
        dtype: large_string
      - name: bugFilePath
        dtype: large_string
      - name: fixPatch
        dtype: large_string
      - name: projectName
        dtype: large_string
      - name: bugLineNum
        dtype: int64
      - name: bugNodeStartChar
        dtype: int64
      - name: bugNodeLength
        dtype: int64
      - name: fixLineNum
        dtype: int64
      - name: fixNodeStartChar
        dtype: int64
      - name: fixNodeLength
        dtype: int64
      - name: sourceBeforeFix
        dtype: large_string
      - name: sourceAfterFix
        dtype: large_string
    splits:
      - name: train
        num_bytes: 432646122
        num_examples: 153652
    download_size: 76500373
    dataset_size: 432646122
  - config_name: sstub_input_no_comments
    features:
      - name: identifier
        dtype: int64
      - name: condition
        dtype: large_string
      - name: bug
        dtype: large_string
      - name: fix
        dtype: large_string
      - name: post_conditional
        dtype: large_string
      - name: bugType
        dtype: large_string
      - name: buggy_commit
        dtype: large_string
      - name: repository_url
        dtype: large_string
      - name: bug_timestamp
        dtype: int64
      - name: num_commits_til_fix
        dtype: int64
      - name: originating_commit
        dtype: large_string
    splits:
      - name: train
        num_bytes: 601223201
        num_examples: 16899
    download_size: 158694988
    dataset_size: 601223201
  - config_name: sstubs
    features:
      - name: bugType
        dtype: large_string
      - name: fixCommitSHA1
        dtype: large_string
      - name: fixCommitParentSHA1
        dtype: large_string
      - name: bugFilePath
        dtype: large_string
      - name: fixPatch
        dtype: large_string
      - name: projectName
        dtype: large_string
      - name: bugLineNum
        dtype: int64
      - name: bugNodeStartChar
        dtype: int64
      - name: bugNodeLength
        dtype: int64
      - name: fixLineNum
        dtype: int64
      - name: fixNodeStartChar
        dtype: int64
      - name: fixNodeLength
        dtype: int64
      - name: sourceBeforeFix
        dtype: large_string
      - name: sourceAfterFix
        dtype: large_string
    splits:
      - name: train
        num_bytes: 22474181
        num_examples: 10231
    download_size: 3355994
    dataset_size: 22474181
  - config_name: sstubsLarge
    features:
      - name: bugType
        dtype: large_string
      - name: fixCommitSHA1
        dtype: large_string
      - name: fixCommitParentSHA1
        dtype: large_string
      - name: bugFilePath
        dtype: large_string
      - name: fixPatch
        dtype: large_string
      - name: projectName
        dtype: large_string
      - name: bugLineNum
        dtype: int64
      - name: bugNodeStartChar
        dtype: int64
      - name: bugNodeLength
        dtype: int64
      - name: fixLineNum
        dtype: int64
      - name: fixNodeStartChar
        dtype: int64
      - name: fixNodeLength
        dtype: int64
      - name: sourceBeforeFix
        dtype: large_string
      - name: sourceAfterFix
        dtype: large_string
    splits:
      - name: train
        num_bytes: 148605032
        num_examples: 63923
    download_size: 21951751
    dataset_size: 148605032
  - config_name: topJavaMavenProjects
    features:
      - name: repository_url
        dtype: large_string
      - name: forks
        dtype: int64
      - name: watchers
        dtype: int64
      - name: normForks+normWatchers
        dtype: float64
    splits:
      - name: train
        num_bytes: 7028
        num_examples: 100
    download_size: 6282
    dataset_size: 7028
  - config_name: topProjects
    features:
      - name: repository_url
        dtype: large_string
      - name: forks
        dtype: int64
      - name: watchers
        dtype: int64
      - name: normForks+normWatchers
        dtype: float64
    splits:
      - name: train
        num_bytes: 264573273
        num_examples: 3114516
    download_size: 74470636
    dataset_size: 264573273
configs:
  - config_name: bugs
    data_files:
      - split: train
        path: bugs/train-*
  - config_name: bugsLarge
    data_files:
      - split: train
        path: bugsLarge/train-*
  - config_name: sstub_input_no_comments
    data_files:
      - split: train
        path: sstub_input_no_comments/train-*
  - config_name: sstubs
    data_files:
      - split: train
        path: sstubs/train-*
  - config_name: sstubsLarge
    data_files:
      - split: train
        path: sstubsLarge/train-*
  - config_name: topJavaMavenProjects
    data_files:
      - split: train
        path: topJavaMavenProjects/train-*
  - config_name: topProjects
    data_files:
      - split: train
        path: topProjects/train-*

ManySStuBs4J

About


The ManySStuBs4J corpus is a collection of simple fixes to Java bugs, designed for evaluating program repair techniques. We collect all bug-fixing changes using the SZZ heuristic, and then filter these to obtain a data set of small bug fix changes. These are single statement fixes, classified where possible into one of 16 syntactic templates which we call SStuBs. The dataset contains simple statement bugs mined from open-source Java projects hosted in GitHub. There are two variants of the dataset. One mined from the 100 Java Maven Projects and one mined from the top 1000 Java Projects. A project's popularity is determined by computing the sum of z-scores of its forks and watchers. We kept only bug commits that contain only single statement changes and ignore stylistic differences such as spaces or empty as well as differences in comments. Some single statement changes can be caused by refactorings, like changing a variable name rather than bug fixes. We attempted to detect and exclude refactorings such as variable, function, and class renamings, function argument renamings or changing the number of arguments in a function. The commits are classified as bug fixes or not by checking if the commit message contains any of a set of predetermined keywords such as bug, fix, fault etc. We evaluated the accuracy of this method on a random sample of 100 commits that contained SStuBs from the smaller version of the dataset and found it to achieve a satisfactory 94% accuracy. This method has also been used before to extract bug datasets (Ray et al., 2015; Tufano et al., 2018) where it achieved an accuracy of 96% and 97.6% respectively.

The bugs are stored in a JSON file (each version of the dataset has each own instance of this file). Any bugs that fit one of 16 patterns are also annotated by which pattern(s) they fit in a separate JSON file (each version of the dataset has each own instance of this file). We refer to bugs that fit any of the 16 patterns as simple stupid bugs (SStuBs).

For more information on extracting the dataset and a detailed documentation of the software visit the GitHub repo: https://github.com/mast-group/SStuBs-mining

Files


100 Java Maven Project Bugs bugs (bugs.json) 1000 Java Project Bugs bugsLarge (bugsLarge.json) 100 Java Maven Project SStuBs sstubs (sstubs.json) 1000 Java Project SStuBs sstubsLarge (sstubsLarge.json) Top 100 Ranked Java Maven Projects topJavaMavenProjects.csv Ranked Java Projects topProjects.csv

Due to a bug zenodo returns an error when uploading json files. The .json suffix can be restored by simply renaming the files (e.g. bugs -> bugs.json).

Corpus Statistics


Projects Bug Commits Buggy Statements Bug Statements per Commit Pattern Fitting Bugs
100 Java Maven 12,598 25,539 2.03 7,824
1000 Java 86,771 153,652 1.77 51,537

The table below provides information about the number of mined single statement bugs that fit each of the SStuB patterns.

Pattern Name Instances (100 Projects) Instances Large (1000 Projects)
Change Identifier Used 3,265 22,668
Change Numeric Literal 1,137 5,447
Change Boolean Literal 169 1,842
Change Modifier 1,852 5,011
Wrong Function Name 1,486 10,179
Same Function More Args 758 5,100
Same Function Less Args 179 1,588
Same Function Change Caller 187 1,504
Same Function Swap Args 127 612
Change Binary Operator 275 2,241
Change Unary Operator 170 1,016
Change Operand 120 807
Less Specific If 215 2,813
More Specific If 175 2,381
Missing Throws Exception 68 206
Delete Throws Exception 48 508

Use


The ManySStuBs4J Corpus is an automatically mined collection of Java bugs at large scale. We note that the automatic extraction could have inserted some noise. However, the amount of inserted noise is deemed to be almost negligible (see about). We also note that the code of the Java projects is not ours but is open-source. Please respect the license of each project.

If you use the data set in a research publication, please cite:

@inproceedings{ManySStuBs4JCorpus2020,
    author={Karampatsis, Rafael-Michael and Sutton, Charles},
    title={{How Often Do Single-Statement Bugs Occur?\\ The ManySStuBs4J Dataset}},
    booktitle={},	
    year={2020},
    pages={},
    organization={}
}

Features


The files sstubs.json and sstubsLarge.json contain the following fields:

  • bugType: The bug type (16 possible values).
  • commitSHA1: The hash of the commit fixing the bug.
  • fixCommitParentSHA1: The hash of the last commit containing the bug.
  • commitFile: Path of the fixed file.
  • patch: The diff of the buggy and fixed file containing all the changes applied by the fix commit. Helps humans to understand the change.
  • projectName: The concatenated repo owner and repo name separated by a ..
  • bugLineNum: The line in which the bug exists in the buggy version of the file.
  • bugNodeStartChar: The character index (i.e., the number of characters in the java file that must be read before encountering the first one of the AST node) at which the affected ASTNode starts in the buggy version of the file.
  • bugNodeLength: The length of the affected ASTNode in the buggy version of the file.
  • fixLineNum: The line in which the bug was fixed in the fixed version of the file.
  • fixNodeStartChar: The character index at which the affected ASTNode starts in the fixed version of the file.
  • fixNodeLength: The length of the affected ASTNode in the fixed version of the file.
  • before: The affected AST's tree (sometimes subtree e.g., Change Numeric Literal) text before the fix.
  • after: The affected AST's tree (sometimes subtree e.g., Change Numeric Literal) text after the fix.

The "before", "after", "patch" fields help humans to understand the change. The "bugLineNum", "bugNodeStartChar", "bugNodeLength", "fixLineNum", "fixNodeStartChar", and "fixNodeLength" allow pinpointing of the AST nodes and lines that contained the bug and their equivalent ones in the fixed version of the file.

Similarly the bugs in bugs.json contain the above fields except bugType. All bugs appearing in sstubs.json have also an entry in bugs.json.