bugbug

Platform for Machine Learning projects on Software Engineering

https://github.com/mozilla/bugbug

Science Score: 54.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
    4 of 115 committers (3.5%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (13.8%) to scientific vocabulary

Keywords

ai developer-tools llm machine-learning ml python software-engineering

Keywords from Contributors

cryptocurrencies data-mining cryptography jax transformer astronomy telegram-bot trade trading-bot mesh
Last synced: 4 months ago · JSON representation ·

Repository

Platform for Machine Learning projects on Software Engineering

Basic Info
  • Host: GitHub
  • Owner: mozilla
  • License: mpl-2.0
  • Language: Python
  • Default Branch: master
  • Homepage:
  • Size: 9.44 MB
Statistics
  • Stars: 545
  • Watchers: 30
  • Forks: 316
  • Open Issues: 405
  • Releases: 2
Topics
ai developer-tools llm machine-learning ml python software-engineering
Created almost 8 years ago · Last pushed 4 months ago
Metadata Files
Readme Contributing License Code of conduct Citation

README.md

bugbug

Task Status codecov

Bugbug aims at leveraging machine learning techniques to help with bug and quality management, and other software engineering tasks (such as test selection and defect prediction).

Chat with us in the bugbug Matrix room.

More information on the Mozilla Hacks blog:

  • https://hacks.mozilla.org/2020/07/testing-firefox-more-efficiently-with-machine-learning/
  • https://hacks.mozilla.org/2019/04/teaching-machines-to-triage-firefox-bugs/

Data generated by BugBug to train the models can be used independently from BugBug. See the docs for details.

Classifiers

  • assignee - The aim of this classifier is to suggest an appropriate assignee for a bug.

  • backout - The aim of this classifier is to detect patches that might be more likely to be backed-out (because of build or test failures). It could be used for test prioritization/scheduling purposes.

  • bugtype - The aim of this classifier is to classify bugs according to their type. The labels are gathered automatically from bugs: right now they are "crash/memory/performance/security". The plan is to add more types after manual labeling.

  • component - The aim of this classifier is to assign product/component to (untriaged) bugs.

  • defect vs enhancement vs task - Extension of the defect classifier to detect differences also between feature requests and development tasks.

  • defect - Bugs on Bugzilla aren't always bugs. Sometimes they are feature requests, refactorings, and so on. The aim of this classifier is to distinguish between bugs that are actually bugs and bugs that aren't. The dataset currently contains 2110 bugs, the accuracy of the current classifier is ~93% (precision ~95%, recall ~94%).

  • devdocneeded - The aim of this classifier is to detect bugs that should be documented for developers.

  • needsdiagnosis - The aim of this classifier is to detect issues that are likely invalid and don't need to be diagnosed for webcompat use case.

  • qaneeded - The aim of this classifier is to detect bugs that would need QA verification.

  • regression vs non-regression - Bugzilla has a regression keyword to identify bugs that are regressions. Unfortunately it isn't used consistently. The aim of this classifier is to detect bugs that are regressions.

  • regressionrange - The aim of this classifier is to detect regression bugs that have a regression range vs those that don't.

  • regressor - The aim of this classifier is to detect patches which are more likely to cause regressions. It could be used to make riskier patches undergo more scrutiny.

  • spam - The aim of this classifier is to detect bugs which are spam.

  • stepstoreproduce - The aim of this classifier is to detect bugs that have steps to reproduce vs those that don't.

  • testfailure - The aim of this classifier is to detect patches that might be more likely to cause test failures.

  • testselect - The aim of this classifier is to select relevant tests to run for a given patch.

  • tracking - The aim of this classifier is to detect bugs to track.

  • uplift - The aim of this classifier is to detect bugs for which uplift should be approved and bugs for which uplift should not be approved.

Setup and Prerequisites

Install the Python dependencies:

pip3 install -r requirements.txt

You may also need pip install -r test-requirements.txt. Depending on the parts of bugbug you want to run, you might need to install dependencies from other requirement files (find them with find . -name "*requirements*").

Currently, Python 3.10+ is required. You can double check the version we use by looking at setup.py.

Also, libgit2 (needs v1.0.0, only in experimental on Debian), might be required (if you can't install it, skip this step).

sudo apt-get -t experimental install libgit2-dev

Auto-formatting

This project is using pre-commit. Please run pre-commit install to install the git pre-commit hooks on your clone.

Every time you will try to commit, pre-commit will run checks on your files to make sure they follow our style standards and they aren't affected by some simple issues. If the checks fail, pre-commit won't let you commit.

Usage

Training

Run the trainer.py script with the command python -m scripts.trainer (with --help to see the required and optional arguments of the command) to perform training (warning this takes 30min+).

Testing

To use a model to classify a given bug, you can run python -m scripts.bug_classifier MODEL_NAME --bug-id ID_OF_A_BUG_FROM_BUGZILLA. N.B.: If you run the classifier script without training a model first, it will automatically download an already trained model.

Example for the "defect" model

training To train the model for mode defect:

python3 -m scripts.trainer defect

testing To use the model to classify a given bug, you can run python -m scripts.bug_classifier defect --bug-id ID_OF_A_BUG_FROM_BUGZILLA.

Training on Taskcluster (Mozilla's CI platform)

You could run the model training task on the CI. To do this, simply include Train on Taskcluster: <model name> in the pull request description.

Example

To train the spambug model on Taskcluster, you need to add the following line in the pull request description, ideally at the bottom:

Train on Taskcluster: spambug

There are a few things to consider when training a model on Taskcluster:

  • This is currently only supported in GitHub pull requests.
  • The training task will be re-run every time you push to the branch linked to the pull request. Limiting the number of times you push is wise to avoid unnecessary training and resource wastage. Alternatively, you could temporarily remove the "Train on Taskcluster" keyword from the pull request description.
  • Currently, the training task extracts only the model's name and does not consider arguments.

Running the repository mining script

Note: This section is only necessary if you want to perform changes to the repository mining script. Otherwise, you can simply use the commits data we generate automatically.

  1. Clone https://hg.mozilla.org/mozilla-central/.
  2. Run ./mach vcs-setup in the directory where you have cloned mozilla-central.
  3. Enable the extensions mentioned in infra/hgrc. For example, if you are on Linux, you can add firefoxtree to the extensions section of the ~/.hgrc file as: firefoxtree = ~/.mozbuild/version-control-tools/hgext/firefoxtree
  4. Run the repository.py script, with the only argument being the path to the mozilla-central repository.

Note: If you run into problems, it's possible the version of Mercurial you are using is not supported. Check the Docker definition at infra/dockerfile.commit_retrieval to see what we are using in production.

Note: the script will take a long time to run (on my laptop more than 7 hours). If you want to test a simple change and you don't intend to actually mine the data, you can modify the repository.py script to limit the number of analyzed commits. Simply add limit=1024 to the call to the log command.

Structure of the project

  • bugbug/labels contains manually collected labels;
  • bugbug/db.py is an implementation of a really simple JSON database;
  • bugbug/bugzilla.py contains the functions to retrieve bugs from the Bugzilla tracking system;
  • bugbug/repository.py contains the functions to mine data from the mozilla-central (Firefox) repository;
  • bugbug/bug_features.py contains functions to extract features from bug/commit data;
  • bugbug/model.py contains the base class that all models derive from;
  • bugbug/models contains implementations of specific models;
  • bugbug/nn.py contains utility functions to include Keras models into a scikit-learn pipeline;
  • bugbug/utils.py contains misc utility functions;
  • bugbug/nlp contains utility functions for NLP;
  • bugbug/labels.py contains utility functions for handling labels;
  • bugbug/bug_snapshot.py contains a module to play back the history of a bug;
  • bugbug/github.py contains functions to retrieve issues from GitHub for a specified owner/repository.

Using bugbug for non-Mozilla projects

Bugbug is focussing on Mozilla use-cases for Firefox, Bugzilla and GitHub. However, we will be happy to accept pull requests adding support for other projects or bug trackers.

Owner

  • Name: Mozilla
  • Login: mozilla
  • Kind: organization
  • Location: Mountain View, California

This technology could fall into the right hands.

Citation (CITATION.cff)

cff-version: 1.2.0
message: "If you use this software, please cite it as below."
type: software
authors:
  - family-names: Castelluccio
    given-names: Marco
    orcid: https://orcid.org/0000-0002-3285-5121
    affiliation: Mozilla
title: bugbug
doi: 10.5281/zenodo.4911345
identifiers:
  - type: doi
    value: 10.5281/zenodo.4911345
repository-code: https://github.com/mozilla/bugbug
license: MPL-2.0

Committers

Last synced: 6 months ago

All Time
  • Total Commits: 6,316
  • Total Committers: 115
  • Avg Commits per committer: 54.922
  • Development Distribution Score (DDS): 0.497
Past Year
  • Commits: 580
  • Committers: 9
  • Avg Commits per committer: 64.444
  • Development Distribution Score (DDS): 0.333
Top Committers
Name Email Commits
Marco Castelluccio m****o@m****m 3,180
dependabot[bot] 4****] 1,969
dependabot-preview[bot] 2****] 418
Suhaib Mujahid s****d@m****m 153
pyup.io bot g****t@p****o 98
Boris Feld l****n@g****m 81
Ayush Shridhar a****6@g****m 80
Ayush Shridhar a****9@g****m 24
Promise Fru 3****u 20
John Pangas s****y@o****m 19
Benjamin Mah 8****h 17
Harshit chittora c****i@g****m 15
Ksenia k****a@m****m 15
Bastien Abadie b****n@n****m 14
cklyyung c****g 11
Brian Grinstead b****d@g****m 9
calixteman c****t@g****m 9
Shubham Garg s****m 8
Bastien Abadie b****e@m****m 7
Anurag Aggarwal k****4@g****m 6
Armen Zambrano a****g 6
John Giannelos j****s@g****m 6
olewicki d****i@g****m 5
Riya Sharma r****5@g****m 4
Yun Seob Lee f****j@g****m 4
Lakshya A Agrawal l****2@i****n 4
Kushagra Shekhawat 4****4 4
Benjamin Forehand Jr b****9@g****m 4
Assiya Khuzyakhmetova a****a@n****z 4
Abhay Katheria 4****a 4
and 85 more...
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 4 months ago

All Time
  • Total issues: 256
  • Total pull requests: 1,780
  • Average time to close issues: 6 months
  • Average time to close pull requests: 9 days
  • Total issue authors: 16
  • Total pull request authors: 28
  • Average comments per issue: 1.44
  • Average comments per pull request: 0.46
  • Merged pull requests: 1,107
  • Bot issues: 6
  • Bot pull requests: 1,433
Past Year
  • Issues: 96
  • Pull requests: 1,052
  • Average time to close issues: 25 days
  • Average time to close pull requests: 8 days
  • Issue authors: 10
  • Pull request authors: 12
  • Average comments per issue: 0.48
  • Average comments per pull request: 0.38
  • Merged pull requests: 607
  • Bot issues: 5
  • Bot pull requests: 884
Top Authors
Issue Authors
  • marco-c (132)
  • suhaibmujahid (87)
  • benjaminmah (11)
  • jensstutte (5)
  • jpangas (5)
  • sentry-io[bot] (3)
  • dependabot[bot] (3)
  • hsinyi (2)
  • arai-a (2)
  • theres-waldo (1)
  • calixteman (1)
  • ncalexan (1)
  • mboldan1 (1)
  • unna97 (1)
  • Standard8 (1)
Pull Request Authors
  • dependabot[bot] (1,520)
  • suhaibmujahid (103)
  • marco-c (73)
  • benjaminmah (52)
  • olewicki (22)
  • pyup-bot (19)
  • jpangas (16)
  • ayush1999 (15)
  • PromiseFru (8)
  • Lothiraldan (5)
  • poojan124 (3)
  • effaf (3)
  • sdsubhajitdas (3)
  • steveprokopienko (3)
  • YBCS (3)
Top Labels
Issue Labels
bug (27) good-first-bug (21) feature-extraction (12) reserved-for-beginners (9) code-review (6) dependencies (3) python (3) enhancement (2) meta (2) http_service (1)
Pull Request Labels
dependencies (1,520) python (1,409) javascript (89) docker (22) code-review (7)

Dependencies

ui/changes/package-lock.json npm
  • 409 dependencies
ui/changes/package.json npm
  • prettier ^2.7.1 development
  • snowpack ^3.8.8 development
  • @js-temporal/polyfill ^0.4.2
  • apexcharts ^3.35.5
  • localforage ^1.10.0
extra-nlp-requirements.txt pypi
  • elasticsearch ==8.4.0
  • gensim ==4.2.0
  • nltk ==3.7
  • pyemd ==0.5.1
  • spacy ==3.4.1
  • wmd ==1.3.2
extra-nn-requirements.txt pypi
  • tensorflow ==2.9.1
http_service/requirements.txt pypi
  • Flask ==2.2.2
  • apispec ==5.2.2
  • apispec-webframeworks ==0.5.2
  • cerberus ==1.3.4
  • flask-apispec ==0.11.4
  • flask-cors ==3.0.10
  • gunicorn ==20.1.0
  • kombu ==5.2.4
  • marshmallow ==3.17.1
  • requests ==2.28.1
  • rq ==1.11.0
  • rq-dashboard ==0.6.1
  • sentry-sdk ==1.9.5
infra/spawn_pipeline_requirements.txt pypi
  • json-e ==4.4.3
  • pyyaml ==6.0
  • requests ==2.28.1
  • taskcluster ==44.19.1
requirements.txt pypi
  • amqp ==5.1.1
  • beautifulsoup4 ==4.11.1
  • boto3 ==1.24.61
  • imbalanced-learn ==0.9.1
  • libmozdata ==0.1.82
  • lmdb ==1.3.0
  • markdown2 ==2.4.3
  • matplotlib ==3.5.3
  • mercurial ==6.2.1
  • microannotate ==0.0.24
  • mozci ==2.2.1
  • numpy ==1.22.4
  • orjson ==3.8.0
  • ortools ==9.4.1874
  • pandas ==1.4.3
  • psutil ==5.9.1
  • pyOpenSSL >=0.14
  • pydriller ==1.12
  • python-dateutil ==2.8.2
  • python-hglib ==2.6.2
  • ratelimit ==2.2.1
  • requests ==2.28.1
  • rs_parsepatch ==0.3.7
  • scikit-learn ==1.1.2
  • scipy ==1.9.1
  • sendgrid ==6.9.7
  • shap ==0.41.0
  • tabulate ==0.8.10
  • taskcluster ==44.19.1
  • tenacity ==8.0.1
  • tqdm ==4.64.0
  • xgboost ==1.6.2
  • zstandard ==0.18.0
test-requirements.txt pypi
  • coverage ==6.4.4 test
  • hypothesis ==6.54.4 test
  • jsonschema ==4.14.0 test
  • pre-commit ==2.20.0 test
  • pytest ==7.1.2 test
  • pytest-cov ==3.0.0 test
  • pytest-responses ==0.5.0 test
  • python-igraph ==0.9.11 test
  • responses ==0.21.0 test
docker-compose.yml docker
  • mozilla/bugbug-base latest
  • mozilla/bugbug-base-nlp latest
  • mozilla/bugbug-commit-retrieval latest
  • mozilla/bugbug-http-service latest
  • mozilla/bugbug-http-service-bg-worker latest
  • mozilla/bugbug-spawn-pipeline latest
http_service/Dockerfile docker
  • mozilla/bugbug-base $BUGBUG_VERSION build
http_service/docker-compose.yml docker
  • mozilla/bugbug-http-service latest
  • mozilla/bugbug-http-service-bg-worker latest
  • redis 4
.github/workflows/add_to_project.yaml actions
  • actions/add-to-project v0.5.0 composite
functions/diff2html/package-lock.json npm
  • 141 dependencies
functions/diff2html/package.json npm
  • @google-cloud/functions-framework ^3.1.2
  • diff2html 3.4.35
http_service/setup.py pypi
setup.py pypi