Platform for Machine Learning projects on Software Engineering
Перейти к файлу
dependabot[bot] 974643b9e1
Bump pydriller from 1.12 to 2.7
Bumps [pydriller](https://github.com/ishepard/pydriller) from 1.12 to 2.7.
- [Release notes](https://github.com/ishepard/pydriller/releases)
- [Commits](https://github.com/ishepard/pydriller/compare/1.12...2.7)

---
updated-dependencies:
- dependency-name: pydriller
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-04 03:54:42 +00:00
.github Create a workflow to add new issues to the team project (#3596) 2023-07-26 11:08:28 -04:00
bugbug Initial LLM-powered code generation script (#4537) 2024-10-30 08:33:09 -04:00
docs Document downloading data through BugBug (#3873) 2023-11-30 13:24:01 -05:00
functions/diff2html Bump path-to-regexp and express in /functions/diff2html (#4483) 2024-09-19 12:42:53 +02:00
http_service Use the new utils.get_user_agent function everywhere instead of hardcoding a User-Agent 2024-10-22 17:11:43 +02:00
infra Bump taskcluster from 72.1.0 to 73.0.0 (#4560) 2024-10-22 11:31:47 +02:00
scripts Initial LLM-powered code generation script (#4537) 2024-10-30 08:33:09 -04:00
tests [New Model] Performance Bug Model (#3895) 2024-01-17 08:58:47 -05:00
ui/changes Bump apexcharts from 3.54.0 to 3.54.1 in /ui/changes (#4567) 2024-10-22 11:29:57 +02:00
.codecov.yml Disable codecov pull request comments 2021-01-11 17:16:11 +01:00
.dockerignore Ignore http_service directory when building bugbug base images (#1338) 2020-02-28 19:21:28 +01:00
.gitignore Drop the similarity models 2023-11-29 17:29:11 -05:00
.pre-commit-config.yaml Update `types-tabulate` for `pre-commit` from 0.1.0 to 0.9.0.20240106 2024-07-03 11:37:26 -04:00
.prettierrc Use the same Prettier configuration as mozilla-central 2021-03-10 09:18:07 +01:00
.taskcluster.yml Get bugbug package version outside setup.py 2024-09-19 14:01:34 +02:00
CITATION.cff Add back DOI 2024-10-14 00:53:45 +02:00
CODE_OF_CONDUCT.md Enable Prettier for JavaScript, HTML, CSS, yaml, Markdown (#2006) 2020-12-17 18:13:49 +01:00
CONTRIBUTING.md Add a link to Discussions in CONTRIBUTING.md (#3333) 2023-03-14 07:41:16 -04:00
LICENSE First commit 2018-03-11 20:12:35 +00:00
MANIFEST.in Move Keras as an optional dependency (#319) 2019-04-26 18:50:02 +02:00
README.md Docs: Typo Fix (#4570) 2024-10-22 13:36:59 -04:00
VERSION Version 0.0.563 2024-10-22 18:24:24 +02:00
docker-compose.yml Add support for GitHub issue classification to the HTTP service (#2330) 2021-05-11 08:48:07 +02:00
extra-nlp-requirements.txt Bump spacy from 3.7.5 to 3.7.6 (#4437) 2024-09-09 01:12:15 -04:00
extra-nn-requirements.txt Drop the dependency on TensorFlow 2023-11-29 20:01:09 -05:00
pyproject.toml Added ruff for linting and formatting (#4031) 2024-02-15 22:21:32 -05:00
requirements.txt Bump pydriller from 1.12 to 2.7 2024-11-04 03:54:42 +00:00
setup.py [inline_comments_data_collection] Add CL arguments for patch and diff length thresholds (#4470) 2024-09-06 17:21:14 -04:00
test-requirements.txt Bump hypothesis from 6.115.3 to 6.115.5 (#4574) 2024-11-01 12:49:30 +01:00

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:

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.